exe - The value Address of Entry Point different in PE Explorer and UltraEdit -
i wrote basic helloworld.exe
c simple line printf("helloworld!\n");
then used ultraedit view bytes of exe file , used pe explorer see header values. when comes address of entry point, pe explorer displays 0x004012c0
.
magic 010bh pe32 linker version 1902h 2.25 size of code 00008000h size of initialized data 0000b000h size of uninitialized data 00000c00h address of entry point 004012c0h base of code 00001000h base of data 00009000h image base 00400000h
but in ultraedit see 0x000012c0
after counting 16 bytes after magic 0x010b
.
3f 02 00 00 e0 00 07 03 0b 01 02 19 00 80 00 00 00 b0 00 00 00 0c 00 00 c0 12 00 00 00 10 00 00 00 90 00 00 00 00 40 00 00 10 00 00 00 02 00 00 04 00 00 00 01 00 00 00 04 00 00 00 00 00 00 00 00 10 01 00 00 04 00 00 91 f6 00 00 03 00 00 00 00 00 20 00 00 10 00 00 00 00 10 00 00 10 00 00 00 00 00 00 10 00 00 00 00 00 00 00 00 00 00 00 00 e0 00 00 c0 06 00 00 00 00 00 00 00 00 00 00
which 1 correct?
simply read image_optional_header structure
addressofentrypoint
a pointer entry point function, relative image base address. executable files, starting address. device drivers, address of initialization function. entry point function optional dlls. when no entry point present, member zero.
so absolute address of entrypoint
addressofentrypoint ? imagebase + addressofentrypoint : 0
in case addressofentrypoint == 12c0
, imagebase == 400000
as result absolute address of entrypoint
12c0+400000==4012c0
Comments
Post a Comment