Skip to main content

Crate editpe

Crate editpe 

Source
Expand description

Resource editor for portable executables.

Supports:

  • Parsing and modification of portable executables
  • Resource editing including icons, manifests, subsystem, version info and more!
  • Resource transfer between files

See Image for the main entry point and ResourceDirectory for working with resource directories.

§Examples

§Adding an icon or manifest to an executable

let mut image = Image::parse_file("damocles.exe")?;
let mut resources = image.resource_directory().cloned().unwrap_or_default();

resources.set_main_icon_file("sword.png")?;

let manifest = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>";
resources.set_manifest(manifest)?;

image.set_resource_directory(resources)?;
image.write_file("damocles.exe");

§Transferring resources between executables

let source = Image::parse_file("damocles.exe")?;
let resources = source.resource_directory().unwrap();

let mut target = Image::parse_file("fortuna.exe")?;
target.set_resource_directory(resources.clone())?;
target.write_file("fortuna.exe");

§Cargo features

§Default features

  • std: Enables standard library features, including reading and writing files.
  • images: Enables support for converting and resizing images in other formats when setting icons. Also enables std.

Modules§

constants
Windows API and binary constants.
types
Portable executable data types.

Structs§

Image
Portable executable image representation.
ReadError
Error that can occur when reading and parsing bytes.
ResourceData
Raw resource data.
ResourceDirectory
Portable executable resource directory.
ResourceTable
Portable executable resource table.
VersionInfo
Version info resource. This is a special resource that contains the version information of the executable.
VersionStringTable
Version string table. This is an entry in the version info resource.

Enums§

DataDirectoryType
Image data directory type enumeration.
DynamicImageimages
A Dynamic Image
ImageReadError
Errors that can occur when reading a PE image.
ImageWriteError
Errors that can occur when writing a PE image.
ResourceEntry
Resource entry in a resource table. This can be either a child table or raw data.
ResourceEntryName
Resource directory entry name. This can either be a raw id or a name.
ResourceError
Errors that can occur when modifying resource data.

Traits§

ToIcon
Trait for data types that can be converted to icon data.