Click here to Skip to main content
15,891,248 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have parsed the IMAGE_DATA_DIRECTORY for import symbols and have obtained the Virtual Address and Size. However, I am having an issue where I can't correspond the Virtual Address with the file Offset.

Here is the data I have parsed. Offset to the data directory is 304 (calculated by adding together e_lfanew and 128), which parsed me a size of 60 and virtual address of 8260. I can't find that virtual address in my PE file.

What I have tried:

I followed this tutorial (the file I mentioned above is the one provided by the tutorial): tutorial on import table[^]
I already had this part taken care of:
Quote:
So at offset 0xB0 + 0x80 = 0x130 is the Import Directory RVA. There you find 44200000 which is in the correct order 0x00002044. RVA 0x2044 is file offset 0x844.

Until the last part where it said offset 0x844. How did the author get that value? This is the one value I need but it was not explained it how it was calculated.
Posted
Updated 29-Jun-19 17:40pm

1 solution

Alright, so after fiddling with the the results and such; I realized the formula that was used. I will keep this here for those who are facing the same issue.

Virtual Address of the import directory - Virtual Address of the section it belongs to (I decide that while iterating through the sections. If VR of import < VR of the section, then the prior section is the one it belongs to), then add the PointerToRawData of the section to the new value, and all done.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900