-
-
Notifications
You must be signed in to change notification settings - Fork 142
Description
Problem Description
Some structures in the PE file format (such as CodeSegment and TlsDirectory) rely on a virtual address (VA) rather than a relative virtual address (RVA). Currently, ISegment.UpdateOffsets only takes a file offset and an RVA. This means that implementations for these structures need an additional ImageBase property or similar for them to be able to implement their Write method. This is problematic, as this is not necessarily in sync with image base of the underlying PE image. Rebasing a PE image would therefore require manually setting all these image bases of these models.
Proposal
Add an ulong imageBase parameter to ISegment.UpdateOffsets. This ensures that all segments can be rebased automatically without any need for a separate property or similar that needs to stay in sync.
Alternatives
None yet.
Additional context
This would be a breaking change for all classes that implement ISegment. This might be a minor issue though, since not many users will actually implement their own version of ISegment.