I'm using IDA Pro to disassemble/modify a PE file. How can I get the file offset in the '.exe' where a specific data/instruction resides. Or how can I get the file offset which is the source of a virtual address?
2 Answers
At the bottom left of the IDA View, you'll see the location of the cursor, as file offset (red) as well as virtual location (blue).
(Underlines by me, not by Ida).
-
1
-
1
To find it using IDAPython:
ida_loader.get_fileregion_offset(ea)
where "ea" is your virtual offset like 0x400000
.
-
1For anyone interested, there is a reverse function, too:
get_fileregion_ea(offset)
, where offset is a long. More info about the two functions here: hex-rays.com/products/ida/support/idapython_docs/… Commented Nov 27, 2020 at 1:15