A modern C++20 library for parsing and manipulating Windows Portable Executable (PE) files.
Premier PE Library provides a clean interface for working with Windows PE file formats. The library is designed to handle DOS headers, NT headers, Sections, Data directories and more with a focus on simplicity and performance.
The Following Features this Library currently offers will be listed below
- Full PE32 and PE32+ (x86 / x64) parsing support
- DOS header, NT headers, optional headers, and section table access
- Import and export table enumeration (by name and ordinal)
- Relocation table parsing with block and entry detail
- TLS directory inspection and callback enumeration
- Resource tree parsing with version info and manifest extraction
- Rich header parsing with checksum validation and tool identification
- RVA, VA, and file offset conversion utilities
- Debug directory parsing
- Unicode and ASCII String extraction
- PE Packer detection
PE Fuzzer/
├── Corpus/
│ └── 900+ Samples # Testing Samples
├── pe-fuzzer.dict # Fuzzer dictionary
└── main.cpp # Entry of the fuzzer
PE Library/
├── premier/
│ ├── PE.hpp # Main library header
│ ├── PE.cpp # Main library implementation
└── example.cpp # Usage examples
- Visual Studio 2022 (or later with C++20 support)
- Windows SDK 10.0
- Platform Toolset v145 or later
- Clone the repository:
git clone https://github.com/NtProtectVirtualMemory/PE-Library.git-
Open
PE Library.slnxin Visual Studio -
Select the correct configuration:
- Release
- x64
-
Build the solution (Ctrl+Shift+B)
- Binaries:
bin/PE Library/{Platform}/{Configuration}/ - Intermediates:
bin/intermediates/PE Library/{Platform}/{Configuration}/
#include <cstdio>
#include "PE.hpp"
int main() {
PE::Image image("path\to\file.exe");
// Your code here
return 0;
}The fuzzer has already processed ~150,000 different PE samples and helped discover & fix multiple parsing edge-cases, buffer issues and potential crashes as well as slow units.
- ~150k unique samples processed.
- All discovered crashes & undefined behavior issues have been fixed.
- Actively used during development & testing
- Open "x64 Native Tools Command Prompt for VS"
- cd "path/to/PE-Fuzzer.exe"
- PE-Fuzzer.exe "path/to/corpus" -jobs=6 -workers=6 -rss_limit_mb=0 -dict="path/to/pe-fuzzer.dict"
What we accept:
- Bug reports & crash reproducers (especially with ASAN logs)
- Parser robustness improvements / edge-case handling
- Performance optimizations - Better documentation / code comments
- Fuzzer corpus samples, dictionary entries, or mutation strategies
- If you're fixing a bug or adding a feature, please open an issue first (unless it's a very obvious typo/doc fix)
- Fork the repository and create your branch from
main - If possible, add or extend tests, this is highly appreciated.
- Make sure the code follows the current style:
- Use C++20 features when it improves readability/safety
- Keep public API clean & minimal
- Use
snake_casefor private members/functions,PascalCasefor public types
- Make small, focused pull requests with clear titles & description
This project is licensed under the MIT License - see the LICENSE file for details.