Expand description
Resource editor for portable executables.
Supports:
- Parsing and introspection of portable executables
- Resource editing and icon replacement
- Resource transfer between files
See Image
for the main entry point for parsing, querying and updating a portable executable image.
Examples
Icon replacement
use editpe::Image;
let data = std::fs::read(BINARY_PATH)?;
let icon = std::fs::read(ICON_PATH)?;
// parse the executable image
let mut image = Image::parse(&data)?;
// get the resource directory
let mut resources = image.resource_directory().cloned().unwrap_or_default();
// set the icon in the resource directory
resources.set_icon(&image)?;
// set the resource directory in the image
image.set_resource_directory(resources)?;
// build an executable image with all changes applied
let target = image.data();
Resource transfer
use editpe::Image;
let source = std::fs::read(SOURCE_PATH)?;
let target = std::fs::read(TARGET_PATH)?;
// parse the source executable image
let image = Image::parse(&source)?;
// get the source resource directory
let resources = image.resource_directory()?;
// parse the target executable image
let mut image = Image::parse(&target)?;
// set the resource directory in the target image
image.set_resource_directory(resources)?;
// build an executable image with all changes applied
let target = image.data();
Modules
- Windows API and binary constants.
- Portable executable data types.
Structs
- Portable executable image representation.
- Error that can occur when reading and parsing bytes.
- Raw resource data.
- Portable executable resource directory.
- Portable executable resource table.
- Version info resource. This is a special resource that contains the version information of the executable.
Enums
- Image data directory type enumeration.
- Errors that can occur when reading a PE image.
- Errors that can occur when writing a PE image.
- Resource entry in a resource table. This can be either a child table or raw data.
- Resource directory entry name. This can either be a raw id or a name.
- Errors that can occur when modifying resource data.