414B
May 1st, 2007, 19:27
Hey,
I am attempting to write a program that will read a PE file and find the start of the .text section (PointerToRawData) and then attempt disassembling it from there. As a test program I was using the windows calculator. For some reason, my program shows me that the .text section starts with
"EA 22 DD 77 D7 23 DD 77 9A 18 DD 77 00 00 00 00 2E 1E C7 77 83 1D C7 77 FF 1E C7 77 00 00 00 00" (just a snippet of the first 32 bytes)
However OllyDbg shows me :
"1B 76 DD 77 83 78 DD 77 F0 6B DD 77 00 00 00 00 39 5E F1 77 87 5D F1 77 EB 5E F1 77 00 00 00 00" which according to OllyDbg translates to:
1B76DD77 DD ADVAPI32.RegOpenKeyExA
8378DD77 DD ADVAPI32.RegQueryValueExA
F06BDD77 DD ADVAPI32.RegCloseKey
00000000 DD 00000000
395EF177 DD GDI32.SetBkColor
875DF177 DD GDI32.SetTextColor
EB5EF177 DD GDI32.SetBkMode
00000000 DD 00000000
I know for sure that my program is reading the correct bytes (the start offset comes to 400) since I have crossed checked the file with a HexEditor.
After approximately 1230 bytes from the beginning of the .text section, Olly and my program look the same and show the same bytes.
My question thus is:
1. Is OllyDbg doing some translation in the beginning of the .text section.
2. If I want to disassemble (I have disassembler code) the .text section, where should I start from. Should I start from the "ProgramEntryPoint" instead of the start of .text or from some place else.
3. If I had a polymorphic program, then the beginning of .text would be treated on a byte by byte basis (i.e. DB - being encrypted), thus how should I differentiate between what is code and what is data ?
Thanks
I am attempting to write a program that will read a PE file and find the start of the .text section (PointerToRawData) and then attempt disassembling it from there. As a test program I was using the windows calculator. For some reason, my program shows me that the .text section starts with
"EA 22 DD 77 D7 23 DD 77 9A 18 DD 77 00 00 00 00 2E 1E C7 77 83 1D C7 77 FF 1E C7 77 00 00 00 00" (just a snippet of the first 32 bytes)
However OllyDbg shows me :
"1B 76 DD 77 83 78 DD 77 F0 6B DD 77 00 00 00 00 39 5E F1 77 87 5D F1 77 EB 5E F1 77 00 00 00 00" which according to OllyDbg translates to:
1B76DD77 DD ADVAPI32.RegOpenKeyExA
8378DD77 DD ADVAPI32.RegQueryValueExA
F06BDD77 DD ADVAPI32.RegCloseKey
00000000 DD 00000000
395EF177 DD GDI32.SetBkColor
875DF177 DD GDI32.SetTextColor
EB5EF177 DD GDI32.SetBkMode
00000000 DD 00000000
I know for sure that my program is reading the correct bytes (the start offset comes to 400) since I have crossed checked the file with a HexEditor.
After approximately 1230 bytes from the beginning of the .text section, Olly and my program look the same and show the same bytes.
My question thus is:
1. Is OllyDbg doing some translation in the beginning of the .text section.
2. If I want to disassemble (I have disassembler code) the .text section, where should I start from. Should I start from the "ProgramEntryPoint" instead of the start of .text or from some place else.
3. If I had a polymorphic program, then the beginning of .text would be treated on a byte by byte basis (i.e. DB - being encrypted), thus how should I differentiate between what is code and what is data ?
Thanks
