Page 1 of 1

running exe's

Posted: Wed Jun 29, 2005 1:57 pm
by GLneo
does anyone know how to / or a good tutorial on running 32-bit djgpp exe. I have syscalls and can load + call flat bianarys which work. but i have no clue what to do the exe header or what it is for ???

Re:running exe's

Posted: Wed Jun 29, 2005 2:14 pm
by Kim
Search for WIN32 PE COFF FORMAT.

Microsoft has released a EXE format doc on msdn:

http://msdn.microsoft.com/msdnmag/issue ... fault.aspx

PE Tutorials:

http://win32asm.cjb.net/

This is the information i used to make a dll injector (win32) with his own remote process mapping functions. So the dll isn't known on the system :) Isn't win32 secure :P

Even if you got your exe mapped in the process space. Please note that windows uses the FS register as the thread information block with the exception handle list (SEH). You will have have to add SEH support to your OS if you want your compiler generated code to have working exception handles :P

Re:running exe's

Posted: Wed Jun 29, 2005 2:23 pm
by GLneo
hold on not PE thx though, but DOS 32bit (djgpp) i think the header does some sort of addressing set up or stack, am i a little wright.

Re:running exe's

Posted: Wed Jun 29, 2005 2:58 pm
by Kim
Oww but then you have to get rid of the DOS Extender.
But I am not sure, don't know much about DOS 32bit exe's...

Re:running exe's

Posted: Wed Jun 29, 2005 5:09 pm
by GLneo
well i dont think there made to run in DOS, just text mode, so there is no linux/windows api stuff (like for making the shell, i think) in the file.

Re:running exe's

Posted: Wed Jun 29, 2005 5:24 pm
by AR
It looks to me as though they switch themselves in and out of protected mode to call DOS Interrupts since there are x86Int() or something like it functions which may call the BIOS directly but will more likely call DOS so you'll have to provide the DOS API, I have no reference for it though. And due to the switching it is probably going to have to run in Ring 0, and it will probably attempt to start protected mode itself during the first stage of the program (since my understanding is that DPMI are realmode programs that setup protected mode for themselves then exit back to DOS in realmode at the end).

What exactly do you want this for? You will most likely not be able to import any programs from other OS' without emulating at least some of their APIs, and DOS counts as an OS. Win16 programs may be better in this regard as they run in protected mode (but all programs run in the same address space IIRC) but you would still have to emulate the APIs.

Re:running exe's

Posted: Wed Jun 29, 2005 6:01 pm
by GLneo
What exactly do you want this for?
i made a stdlib/io for my os, but for a flat binary you have to pre define offset so multipule progs will run on top of each other, and i thought exe let you set offset so i can dynamicly place progs ;)

Re:running exe's

Posted: Thu Jun 30, 2005 7:27 am
by Kim
I would say try to use a more newer executable format :)
What about ELF, its fully documented, different compilers support it,...