Crate winres_edit

source ·
Expand description

github license

This crate allows you to load and modify Windows resources inside of .exe and .res files. This crate currently does not support actual resource data destructuring with exception of Version Strings (VS_VERSIONINFO), which is useful to modify application manifests. Loaded resources are available as raw Vec<u8> data, useful to modify bitmaps and icons.

Please note that all operations performed on the opened resource file are accumulated and are then “flushed” to the file when the file is closed using the close() function. This is due to the behavior of the underlying Win32 API (UpdateResource) functionality used by this crate.


Load and update a resource
let mut resources = Resources::new(&Path::new("myfile.exe"));
resources.load().expect("Unable to load resources");"Unable to open resource file for updates");

    .expect("unable to find main icon")

let version: [u16;4] = [0,1,0,0];
resources.get_version_info()?.expect("Unable to get version info")
            ("ProductName","My Product")
            ("FileDescription","My File")

Create a new resource
let res = Resource::new(


  • List of resource constants representing Windows resource types expressed as Id



  • Date helper used for serializing and deserializing 2 LE-encoded u32 values into a single u64 value.
  • Rust representation of VS_FIXEDFILEINFO structure.
  • Helper representing structure data header used in VS_VERSIONINFO and all related data structures.
  • Structure representing a single resource
  • Placeholder for future data serialization (not implementated)
  • Data structure representing a resource file. This data structure points to a .res or .exe file and allows loading and modifying resource in this file.
  • Windows Version value represented as [u16;4] array. This version struct is helpful for serialization and deserialization of the versions packed into a u64 value represented as 2 LE-encoded u32 (DWORD) values.
  • VS_VERSIONINFO resource structure representation.


  • Wrapper of the underlying data that may be represented as a binary buffer or a text string.
  • Data type flag indicating if data is encoded as a binary or a text string.
  • Errors produced by this crate.
  • Id enum that contains a windows resource id representation. Windows resource ids can be a pointer to a string or if the pointer value is below 0xffff the id represents an integer resource id. Id encapsulates this representation into a Rust enum and provides From and Into trait implementations to interop with the Windows API.
  • Placeholder for future data serialization (not implementated)
  • Helper enum for serializing and deserializing StringFileInfo and VarFileInfo child structures.