Log in

View Full Version : RVAToOffset


_ColdMind
January 26th, 2004, 07:37
Could somebody tell me how to convert RVA to file offset and viceversa ?

AndreaGeddon
January 26th, 2004, 08:19
the formula is:

file_offset = (RVA - SectionVirtualOffset) + SectionRawOffset

SectionVirtualOffset is the base address of the section that contains your RVA, SectionRowOffset is the file offset of the section that contains the RVA. You can obtain both Virtual/Row offset from the section table.
In practice you calculate the distance of the rva from the beginning of its virtual section and use this distance in the file raw address of the section itself
Bye!
AndreaGeddon

ZaiRoN
January 26th, 2004, 08:37
Hi _ColdMind,
this question has been asked many times before and, I would like to suggest to use the search function. The function is accessible from any page (look at the top) or, for an advanced search, from this page: http://www.woodmann.net/forum/search.php?

Andrea, what are you doing here?

Best regards,
ZaiRoN

_ColdMind
February 4th, 2004, 02:32
Thanks a lot AndreaGeddon - this is my key up to search and discover more information discussed on this forum and web. Also Je remerci to ZaiRon.

Kayaker
February 4th, 2004, 03:08
Quote:
[Originally Posted by _ColdMind]Could somebody tell me how to convert RVA to file offset and viceversa ?


Hi

I'm sure you've found this already, I hope, but in this thread I posted almost exactly 24 hours before yours are some programming articles and a nice explanation of that called

Converting virtual offsets to raw offsets and vice versa

http://www.woodmann.com/forum/showthread.php?t=5423

Kind of ironic, even the vice versa is there

Cheers,
Kayaker

_ColdMind
February 16th, 2004, 08:28
Thanks a lot Kayaker.