getting offset in file from RVA

Idov picture Idov · Mar 31, 2012 · Viewed 7.8k times · Source

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?

Answer

Evgeny picture Evgeny · Apr 13, 2012

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.