Skip to content
Merged
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
97b21d3
PE: Add resource parser
kkent030315 Oct 29, 2024
37422dd
Simplify expression
kkent030315 Oct 31, 2024
eae687e
Add doc comment
kkent030315 Oct 31, 2024
e68f7f9
alloc compatible
kkent030315 Oct 31, 2024
1c785df
Fix doc comment
kkent030315 Oct 31, 2024
6735a20
Simplify expressions
kkent030315 Oct 31, 2024
ca4f4d7
add test
kkent030315 Nov 1, 2024
f169791
more stricter tests
kkent030315 Nov 2, 2024
1d29ab6
Fix docs, check malformed to prevent panics
kkent030315 Nov 2, 2024
1dcb1ba
Fix doc
kkent030315 Nov 2, 2024
475bf2e
Check malformed for iterator data
kkent030315 Nov 2, 2024
a7c3a84
Remove `pub` from `num_resources`
kkent030315 Dec 11, 2024
8d24f32
Remove `pub` from `data`
kkent030315 Dec 11, 2024
b783f79
Remove `pub` from `data`
kkent030315 Dec 11, 2024
80943fd
Remove unnecessary lifetime from impl `VsFixedFileInfo`
kkent030315 Dec 11, 2024
a65c91c
Remove `pub` from `VersionInfo::data`
kkent030315 Dec 11, 2024
65c9e5f
Simplify entry id identification
kkent030315 Dec 11, 2024
8bd5837
try impl `ResourceEntryIterator::find_by_id`
kkent030315 Dec 11, 2024
834a6ab
adjustment for with or without alignments
kkent030315 Jan 4, 2025
2a03ef6
move `align_up` to `utils`
kkent030315 Jun 16, 2025
03347fe
add `Utf16String<'a>` for parsing utf16 strings
kkent030315 Jun 16, 2025
e1a1b2b
fix comment
kkent030315 Jun 16, 2025
31c68d2
make `StringFileInfo` fields private
kkent030315 Jun 16, 2025
947f923
make `next_iter` safe
kkent030315 Jun 16, 2025
1fd5b79
use `pread_with::<&[u8]>` for simplifying code
kkent030315 Jun 16, 2025
caab4f2
remove noop offset alignment
kkent030315 Jun 16, 2025
3198e67
use scroll for slicing bytes
kkent030315 Jul 7, 2025
63ed4bf
make `Utf16String::to_string` safe
kkent030315 Jul 7, 2025
92cf2d8
fix obsolated doc comment
kkent030315 Jul 7, 2025
56f0c08
use `alloc::string::ToString`
kkent030315 Jul 7, 2025
6c88ba0
make `to_utf16_string` simpler
kkent030315 Jul 18, 2025
7edb2f8
repr c
kkent030315 Jul 18, 2025
20a9f46
make key pub(crate)
kkent030315 Jul 18, 2025
e6ebca6
final fix
kkent030315 Jul 21, 2025
18ffb15
fix invalid surrogate pair test
kkent030315 Jul 26, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/pe/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use alloc::borrow::Cow;
use alloc::string::String;
use alloc::vec::Vec;
use log::warn;
use resource::ResourceData;

pub mod authenticode;
pub mod certificate_table;
Expand All @@ -24,6 +25,7 @@ pub mod load_config;
pub mod optional_header;
pub mod options;
pub mod relocation;
pub mod resource;
pub mod section_table;
pub mod subsystem;
pub mod symbol;
Expand Down Expand Up @@ -84,6 +86,8 @@ pub struct PE<'a> {
pub load_config_data: Option<load_config::LoadConfigData>,
/// Certificates present, if any, described by the Certificate Table
pub certificates: certificate_table::CertificateDirectoryTable<'a>,
/// Resource information if any
pub resource_data: Option<ResourceData<'a>>,
}

impl<'a> PE<'a> {
Expand Down Expand Up @@ -120,6 +124,7 @@ impl<'a> PE<'a> {
let mut relocation_data = None;
let mut load_config_data = None;
let mut certificates = Default::default();
let mut resource_data = Default::default();
let mut is_64 = false;
if let Some(optional_header) = header.optional_header {
// Sections we are assembling through the parsing, eventually, it will be passed
Expand Down Expand Up @@ -310,6 +315,18 @@ impl<'a> PE<'a> {
0
};

if let Some(&resource_table) = optional_header.data_directories.get_resource_table() {
let data = resource::ResourceData::parse_with_opts(
bytes,
resource_table,
&sections,
file_alignment,
opts,
)?;
resource_data = Some(data);
debug!("resource_data data: {:#?}", data.version_info);
}

authenticode_excluded_sections = Some(authenticode::ExcludedSections::new(
checksum,
datadir_entry_certtable,
Expand Down Expand Up @@ -339,6 +356,7 @@ impl<'a> PE<'a> {
relocation_data,
load_config_data,
certificates,
resource_data,
})
}

Expand Down
Loading
Loading