Closed MMitsuha closed 1 year ago
For performance reasons, AsmResolver does not calculate offsets and sizes unless you tell it to. Thus, make sure that you align all sections accordingly after adding the new section to the file, but before you retrieve their new RVAs. This can be done either by calling OriginalFile.UpdateHeaders()
or OriginalFile.AlignSections()
. Both of them calculate offsets, and have slightly different meanings. In short, UpdateHeaders
aligns sections but also updates some fields in the PE headers accordingly. You can refer to the the xmldocs attached to these methods to figure out these differences.
Description
I added a section with some content to a
PEFile
and I have to get the RVA of the section in order to set newAddressOfEntryPoint
, but I found that bothAddedContent.Rva
andAddedSection.Rva
are always 0x1000Here is my code: