Crates.io | editpe |
lib.rs | editpe |
version | 0.2.0 |
source | src |
created_at | 2023-11-18 14:38:01.455514 |
updated_at | 2024-10-10 22:42:59.90514 |
description | Resource Editor for parsing and modification of Windows Portable Executables and their resources |
homepage | |
repository | https://github.com/Systemcluster/editpe |
max_upload_size | |
id | 1040537 |
size | 126,668 |
Resource editor for portable executables.
Enables cross-platform parsing and modification of Windows executables and their resources.
Compared to other resource editors like rcedit, editpe takes great care to keep the modified executable in a valid state. It does this by parsing and rebuilding the complete resource directory as well as all file and section headers, keeping existing sections intact, and leaving any additional data at the end of the file in place.
Note that packed executables (like packed with UPX) might not start with a modified resource table and might have compressed resources that can not be read. If you need a packed executable with modified resources, edit the resources first, and pack it afterwards.
Add editpe
as a dependency. Support for converting and resizing images in other formats when setting icons is provided by the image
crate.
editpe = "0.2"
image = "*" # optional
The std
and images
features are enabled by default and can be disabled for no-std
support.
See the tests for additional usage examples.
use editpe::Image;
let mut image = Image::parse_file("damocles.exe")?;
// get the resource directory
let mut resources = image.resource_directory().cloned().unwrap_or_default();
// set the icon file
resources.set_main_icon_file("sword.png")?;
// set the resource directory in the image
image.set_resource_directory(resources)?;
// write an executable image with all changes applied
image.write_file("damocles.exe");
use editpe::Image;
let image = Image::parse_file("damocles.exe")?;
// get the resource directory from the source
let resources = image.resource_directory()?;
let mut image = Image::parse_file("fortuna.exe")?;
// copy the resource directory to the target
image.set_resource_directory(resources)?;
// write an executable image with all changes applied
image.write_file("fortuna.exe");