Skip to content

Commit

Permalink
Breaking change: make Export.offset optional
Browse files Browse the repository at this point in the history
  • Loading branch information
dureuill committed Dec 2, 2021
1 parent 3667fb4 commit f984749
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions src/pe/export.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ impl<'a> Reexport<'a> {
/// An exported symbol in this binary, contains synthetic data (name offset, etc., are computed)
pub struct Export<'a> {
pub name: Option<&'a str>,
pub offset: usize,
pub offset: Option<usize>,
pub rva: usize,
pub size: usize,
pub reexport: Option<Reexport<'a>>,
Expand Down Expand Up @@ -301,16 +301,7 @@ impl<'a, 'b> scroll::ctx::TryFromCtx<'a, ExportCtx<'b>> for Export<'a> {
match *rva {
ExportRVA(rva) => {
let rva = rva as usize;
let offset = utils::find_offset_or(
rva,
sections,
file_alignment,
&opts,
&format!(
"cannot map RVA ({:#x}) of export ordinal {} into offset",
rva, ordinal
),
)?;
let offset = utils::find_offset(rva, sections, file_alignment, &opts);
Ok((
Export {
name,
Expand Down Expand Up @@ -339,7 +330,7 @@ impl<'a, 'b> scroll::ctx::TryFromCtx<'a, ExportCtx<'b>> for Export<'a> {
Ok((
Export {
name,
offset,
offset: Some(offset),
rva,
reexport: Some(reexport),
size: 0,
Expand Down

0 comments on commit f984749

Please sign in to comment.