Crate winres_edit
source ·Expand description
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.
Example
let mut resources = Resources::new(&Path::new("myfile.exe"));
resources.load().expect("Unable to load resources");
resources.open().expect("Unable to open resource file for updates");
resources.find(resource_type::ICON,Id::Integer(1))
.expect("unable to find main icon")
.replace(icon_data)?
.update()?;
let version: [u16;4] = [0,1,0,0];
resources.get_version_info()?.expect("Unable to get version info")
.set_file_version(&version)
.set_product_version(&version)
.insert_strings(
&[
("ProductName","My Product")
("FileDescription","My File")
]
)
.remove_string("SomeExistingString")
.update()?;
resources.close();Modules
List of resource constants representing Windows resource types
expressed as
IdMacros
Convert a string to a zero-terminated
windows::core::PCSTR string.Structs
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.Enums
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.
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.