Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jsok/petools

C# Library to handle the Portable Executable format
https://github.com/jsok/petools

Last synced: 3 months ago
JSON representation

C# Library to handle the Portable Executable format

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");

```