1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//! Resource **edit**or for **p**ortable **e**xecutables.
//!
//! 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.
//!
//! See [`ResourceDirectory`] for working with resource directories.
//!
//! # Examples
//!
//! ### Replacing the icon of an executable
//! ```
//! 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");
//! ```
//!
//! ### Transferring resources between executables
//! ```
//! 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");
//! ```
//!
//! # 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`.
extern crate alloc;
pub
pub
pub
pub
pub use crate::;