Page 1 of 1

Start Offset EXE

Posted: Sun Jul 27, 2008 12:14 pm
by asmZ80
Hi to all, only a question, how i can find (in asm x86) the start offset of an EXE. I'm coding a diassembler, and i must start to diasm from start offset. Any ideas?

Re: Start Offset EXE

Posted: Sun Jul 27, 2008 12:23 pm
by bewing
The loader always has to know where to load an executable. So the loadpoint must either be a default value, or the loadpoint must be encoded in the header. So you need to study up on the header format for the particular exe type.

Re: Start Offset EXE

Posted: Sun Jul 27, 2008 12:27 pm
by asmZ80
but can i set the start offset maybe at 0x0100 in asm? So i can use this offset?

Re: Start Offset EXE

Posted: Sun Jul 27, 2008 12:35 pm
by suthers
Try the attachment, it's got all the details on EXE format binaries you'll ever need (sorry couldn't find the original link so just attached it...)\
Jules

Re: Start Offset EXE

Posted: Sun Jul 27, 2008 12:40 pm
by asmZ80
yes i have simil one with debugging info, but my question is: in asm i can set start offset os each exe that i diasm use this offset? (maybe 0x0100)

Re: Start Offset EXE

Posted: Sun Jul 27, 2008 12:48 pm
by bewing
No, you have to use the offset that the header tells you to use. Otherwise any absolute memory address references will point to the wrong place.

Re: Start Offset EXE

Posted: Sun Jul 27, 2008 12:50 pm
by asmZ80
ok thx