@@ -77,6 +77,8 @@ pub struct PE<'a> {
77
77
pub tls_data : Option < tls:: TlsData < ' a > > ,
78
78
/// Exception handling and stack unwind information, if any, contained in the PE header
79
79
pub exception_data : Option < exception:: ExceptionData < ' a > > ,
80
+ /// Base relocation data if any
81
+ pub relocation_data : Option < relocation:: RelocationData < ' a > > ,
80
82
/// Certificates present, if any, described by the Certificate Table
81
83
pub certificates : certificate_table:: CertificateDirectoryTable < ' a > ,
82
84
}
@@ -112,6 +114,7 @@ impl<'a> PE<'a> {
112
114
let mut debug_data = None ;
113
115
let mut tls_data = None ;
114
116
let mut exception_data = None ;
117
+ let mut relocation_data = None ;
115
118
let mut certificates = Default :: default ( ) ;
116
119
let mut is_64 = false ;
117
120
if let Some ( optional_header) = header. optional_header {
@@ -250,6 +253,18 @@ impl<'a> PE<'a> {
250
253
}
251
254
}
252
255
256
+ if let Some ( & baserelocs_dir) =
257
+ optional_header. data_directories . get_base_relocation_table ( )
258
+ {
259
+ relocation_data = Some ( relocation:: RelocationData :: parse_with_opts (
260
+ bytes,
261
+ baserelocs_dir,
262
+ & sections,
263
+ file_alignment,
264
+ opts,
265
+ ) ?) ;
266
+ }
267
+
253
268
// Parse attribute certificates unless opted out of
254
269
let certificate_table_size = if opts. parse_attribute_certificates {
255
270
if let Some ( & certificate_table) =
@@ -303,6 +318,7 @@ impl<'a> PE<'a> {
303
318
debug_data,
304
319
tls_data,
305
320
exception_data,
321
+ relocation_data,
306
322
certificates,
307
323
} )
308
324
}
0 commit comments