GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - coldtrace/PE-Library: A modern C++ library for parsing and manipulating Windows Portable Executable (PE) files.

BranchesTags
Open more actions menu

Latest commit

 

History

74 Commits
74 Commits

Folders and files

NameName
Last commit message
Last commit date
PE-Fuzzer
PE-Fuzzer
 
 
PE-Library
PE-Library
 
 
docs
docs
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
LICENSE.txt
LICENSE.txt
 
 
PE-Library.slnx
PE-Library.slnx
 
 
README.md
README.md
 
 

Repository files navigation

PE Library

A modern C++ library for parsing and manipulating Windows Portable Executable (PE) files.

Full API docs can be found here.

Overview

This 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.

Features

Core

  • Full PE32 & PE32+ (x86/x64) support with validation
  • Complete DOS Header, NT Headers, Optional Header, and Section Table access
  • Section addition and modification
  • RVA ↔ File Offset ↔ VA conversion utilities

Directories & Structures

  • Import Table – enumeration by name and ordinal
  • Export Table – function listing with ordinals and forwarders
  • Relocations – full block and entry parsing
  • TLS Directory – callbacks and data inspection
  • Resources – tree traversal, version info, manifest, and icon extraction
  • Rich Header – parsing, checksum validation, and compiler/linker identification
  • Debug Directory – support for common debug formats

Additional Capabilities

  • Unicode and ANSI string extraction
  • Data directory validation and bounds checking
  • Pattern Scanning

Getting Started

Prerequisites

  • Visual Studio 2022 (or later with C++17 support)
  • Windows SDK 10.0
  • Platform Toolset v143 or later

Installation (CMake)

The library can be added directly to your project using CMake's FetchContent

include(FetchContent)

FetchContent_Declare(
    pe_lib
    GIT_REPOSITORY https://github.com/NtProtectVirtualMemory/PE-Library.git
    GIT_TAG master # or whichever commit your prefer
    SOURCE_SUBDIR PE-Library
)

FetchContent_MakeAvailable(pe_lib)

target_link_libraries(your_target PRIVATE PE::Library)

After linking, the public headers are automatically available:

#include <image.hpp>
#include <sections.hpp>
#include <directories.hpp>
#include <rich.hpp>

Basic Usage

#include <vector>

#include "pe-lib/image.hpp"
#include "pe-lib/sections.hpp"

int main()
{
    // Read your PE file into a byte buffer
    std::vector<std::uint8_t> bytes = /* ... */;

    PE::Image image(std::move(bytes));
    PE::ImageSections sections(&image);

    // Your code here...

    return 0;
}

Note: PE::Image no longer performs file I/O. Load the file into memory, then construct the image from the resulting byte buffer.

PE Fuzzer

The fuzzer has already processed ~275,000 different PE samples and helped discover & fix multiple parsing edge-cases, buffer issues and potential crashes as well as slow units.

For more information see: PE-Fuzzer/

Current State

  • All discovered crashes, UB and slow units have been fixed.
  • Actively used during development & testing

Special Thanks

Special thanks to Christopher Wellons (skeeto) for the Fuzzer, design suggestions, and overall feedback that helped improve the library and fuzzer.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

A modern C++ library for parsing and manipulating Windows Portable Executable (PE) files.

crim.blog/

Topics

malware-analysispe-librarype-parserreverse-engineeringwindows-internals

Resources

Readme
MIT license

Contributing

Contributing
Activity

Stars

27 stars

Watchers

0 watching

Forks

3 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.