Reputation: 23
I'm writting a PE viewer. I'm trying to print raw data of each section.
I want to use section[i]->PointerToRawData
in order to jump to section and create a loop with section[i]->SizeOfRawData)
to print raw data
Can you show me a flow to do that and how I display raw data?
Thank you and sorry for my bad English
Upvotes: 1
Views: 2713
Reputation: 1385
PointerToRawData is an offset relative to the beginning of the file, so simply adding it to the memory address you have loaded the file should give you the starting point. It sounds like you might want to try something like this:
const BYTE* p = (BYTE*)pFileBase + section[i]->PointerToRawData;
const BYTE* pEnd = p + section[i]->SizeOfRawData;
while (p<pEnd)
{
your_char_output_routine_goes_here(*p++);
}
Upvotes: 3