Search code examples
64-bitportable-executable

getting offset in file from RVA


I'm trying to read a PE file.
The problems is that the data uses RVA pointers while I need offset within the file
to get what I need. How can I convert the RVA to offset in the file?


Solution

  • To determine the file offset by RVA, you need:

    1. to determine in which section points RVA.
    2. subtract from your address relative virtual address of section
    3. add to result the file offset of section

    You will receive a file offset that you need.