https://github.com/jsok/petools
C# Library to handle the Portable Executable format
https://github.com/jsok/petools
Last synced: about 1 year ago
JSON representation
C# Library to handle the Portable Executable format
- Host: GitHub
- URL: https://github.com/jsok/petools
- Owner: jsok
- License: mit
- Created: 2014-06-21T07:12:09.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2014-06-21T07:25:21.000Z (almost 12 years ago)
- Last Synced: 2025-04-13T17:13:25.491Z (about 1 year ago)
- Language: C#
- Size: 133 KB
- Stars: 7
- Watchers: 3
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
PETools
=======
A C# Library for handling and manipulating this Portable Executable format.
Useful for modifying section data of a DLL.
Some preliminary work for supporting COFF with basic ability to read symbol tables.
Usage
-----
```csharp
using PETools;
PETool pe = new PETool();
pe.Read("target.dll");
using (MemoryStream stream = new MemoryStream(pe.GetSectionData(".data")))
{
// read contents using `stream` object
stream.Close()
}
// It's also possible to replace section data, e.g.:
byte[] data = ...;
pe.WriteSectionData(".data", data);
// Call layout to fix up headers and section layout
pe.Layout();
// Write it back to disk
pe.WriteFile("target.dll");
```