#pe #dll #bin #exe #file-format #load-file #mui

no-std bin+lib pelite

Lightweight, memory-safe, zero-allocation library for reading and navigating PE binaries

15 releases (9 breaking)

0.10.0 Nov 4, 2022
0.9.1 Jun 18, 2022
0.9.0 Sep 5, 2020
0.8.1 Apr 15, 2020
0.1.0 Feb 23, 2016

#265 in Parser implementations

Download history 2315/week @ 2024-01-10 1751/week @ 2024-01-17 1785/week @ 2024-01-24 1741/week @ 2024-01-31 1885/week @ 2024-02-07 2921/week @ 2024-02-14 1711/week @ 2024-02-21 2273/week @ 2024-02-28 2858/week @ 2024-03-06 3126/week @ 2024-03-13 3099/week @ 2024-03-20 3440/week @ 2024-03-27 3198/week @ 2024-04-03 2095/week @ 2024-04-10 2424/week @ 2024-04-17 2569/week @ 2024-04-24

10,883 downloads per month
Used in 27 crates (19 directly)

MIT license


Contains (Windows DLL, 30KB) demo/Demo64.dll, (Windows DLL, 28KB) demo/Demo.dll, (Windows exe, 1KB) tests/tiny/tiny.128, (Windows exe, 1KB) tests/tiny/tiny.168, (Windows exe, 1KB) tests/tiny/tiny.296, (Windows exe, 1KB) tests/tiny/tiny.356 and 7 more.


MIT License crates.io docs.rs Changelog Build status Build Status

Lightweight, memory-safe, zero-allocation library for reading and navigating PE binaries.


The purpose of this library is inspecting PE binaries (whether on disk or already loaded in memory).

A trade-off was made to not unify the 32-bit (PE32) and 64-bit (PE32+) formats for two reasons:

  • There are small but incompatible differences, which would add overhead by requiring constant matching even if at source code level the match arms look identical.

  • Most of the time you know (at build time) what format you're working with anyway.

This makes it rather awkward to work with both formats together transparently.

Note that while the correct name is PE32+, the name PE64 is used as it is a valid identifier; they are otherwise synonymous.


Included are bins showing some uses for the library, try them out on the demos!


This library is available on crates.io.

Documentation can be found on docs.rs.

In your Cargo.toml, put

pelite = "0.8"


Try this example: cargo run --example readme.

use pelite::FileMap;
use pelite::pe64::{Pe, PeFile};

fn main() {
	// Load the desired file into memory
	let file_map = FileMap::open("demo/Demo64.dll").unwrap();
	// Process the image file

fn dll_deps(image: &[u8]) -> pelite::Result<()> {
	// Interpret the bytes as a PE32+ executable
	let file = PeFile::from_bytes(image)?;

	// Let's read the DLL dependencies
	let imports = file.imports()?;
	for desc in imports {
		// Get the DLL name being imported from
		let dll_name = desc.dll_name()?;
		// Get the number of imports for this dll
		let iat = desc.iat()?;
		println!("imported {} functions from {}", iat.len(), dll_name);



Licensed under MIT License, see license.txt.


Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, shall be licensed as above, without any additional terms or conditions.