/AsmResolver

A library for editing PE files with full .NET metadata support

Primary LanguageC#MIT LicenseMIT

AsmResolver

Master branch build status Nuget feed License: MIT Documentation Status Discord

AsmResolver is a PE inspection library allowing .NET programmers to read, modify and write executable files. This includes .NET as well as native images. The library exposes high-level representations of the PE, while still allowing the user to access low-level structures.

AsmResolver is released under the MIT license.

Features

AsmResolver has a lot of features. Below a non-exhaustive list:

  • Create, read and write PE files
    • Inspect and update PE headers.
    • Create, read and write sections.
  • Create, read and write various data directories
    • Debug Directory (CodeView)
    • .NET Directory
      • CIL assembler and disassemblers
      • Metadata Directory (tables, strings, user-strings, blobs, GUIDs)
      • Resources Directory
      • Strong Name Signing
      • VTable Fixup Directory
    • Exception Directory (AMD64)
    • Export Directory
    • Import Directory
    • Base Relocation Directory
    • TLS Directory
    • Win32 Resources Directory
  • Fully mutable object model for .NET modules that is similar to System.Reflection
    • Strong type-system with many useful factory methods for quickly constructing new metadata.
    • Full metadata importing and cloning (useful for injecting metadata into another assembly)
    • .NET Framework 2.0+, .NET Core and .NET 5+ binary file support.
    • Infer memory layout of types statically.
    • Create, read and write managed resource sets (.resources files)
    • Create new method bodies containing native code.
    • Highly configurable reader and writer options and custom error handling for both.
    • Rich support for AppHost and SingleFileHost bundled files.

Documentation

Check out the wiki for guides and information on how to use the library.

Binaries

Stable builds:

Nightly builds:

Branch Build status
master Master branch build status
development Development branch build status

Compiling

The solution can be build using the .NET SDK or an IDE that works with the .NET SDK (such as Visual Studio and JetBrains Rider). The main packages target .NET Standard 2.0, and the xUnit test projects target .NET Core 3.1.

To build the project from the commandline, use:

$ dotnet restore
$ dotnet build

To run all tests, simply run:

$ dotnet test

Contributing

See CONTRIBUTING.md for guidelines on general workflow and code style.

Found a bug or have questions?

Please use the issue tracker. Try to be as descriptive as possible.

You can also join the Discord to engage more directly with the community.

Acknowledgements

AsmResolver started out as a hobby project, but has grown into a community project with various contributors. Without these people, AsmResolver would not have been where it is today!

  • Special thanks to all the people who contributed directly with code commits.

  • Another big thank you to all the people that suggested new features, provided feedback on the API design, have done extensive testing, and/or reported bugs on the issue board, by e-mail, or through DMs.

If you feel you have been under-represented in these acknowledgements, feel free to contact me.