@@ -9,6 +9,7 @@ use alloc::borrow::Cow;
99use alloc:: string:: String ;
1010use alloc:: vec:: Vec ;
1111use log:: warn;
12+ use resource:: ResourceData ;
1213
1314pub mod authenticode;
1415pub mod certificate_table;
@@ -24,6 +25,7 @@ pub mod load_config;
2425pub mod optional_header;
2526pub mod options;
2627pub mod relocation;
28+ pub mod resource;
2729pub mod section_table;
2830pub mod subsystem;
2931pub mod symbol;
@@ -84,6 +86,8 @@ pub struct PE<'a> {
8486 pub load_config_data : Option < load_config:: LoadConfigData > ,
8587 /// Certificates present, if any, described by the Certificate Table
8688 pub certificates : certificate_table:: CertificateDirectoryTable < ' a > ,
89+ /// Resource information if any
90+ pub resource_data : Option < ResourceData < ' a > > ,
8791}
8892
8993impl < ' a > PE < ' a > {
@@ -120,6 +124,7 @@ impl<'a> PE<'a> {
120124 let mut relocation_data = None ;
121125 let mut load_config_data = None ;
122126 let mut certificates = Default :: default ( ) ;
127+ let mut resource_data = Default :: default ( ) ;
123128 let mut is_64 = false ;
124129 if let Some ( optional_header) = header. optional_header {
125130 // Sections we are assembling through the parsing, eventually, it will be passed
@@ -310,6 +315,18 @@ impl<'a> PE<'a> {
310315 0
311316 } ;
312317
318+ if let Some ( & resource_table) = optional_header. data_directories . get_resource_table ( ) {
319+ let data = resource:: ResourceData :: parse_with_opts (
320+ bytes,
321+ resource_table,
322+ & sections,
323+ file_alignment,
324+ opts,
325+ ) ?;
326+ resource_data = Some ( data) ;
327+ debug ! ( "resource_data data: {:#?}" , data. version_info) ;
328+ }
329+
313330 authenticode_excluded_sections = Some ( authenticode:: ExcludedSections :: new (
314331 checksum,
315332 datadir_entry_certtable,
@@ -339,6 +356,7 @@ impl<'a> PE<'a> {
339356 relocation_data,
340357 load_config_data,
341358 certificates,
359+ resource_data,
342360 } )
343361 }
344362
0 commit comments