[comp.os.msdos.programmer] what is the format of a .exe file?

gwoho@nntp-server.caltech.edu (g liu) (10/19/90)

i want to know the format of a .exe file.  i want to write a program
that can run a .exe file that is in character array.
it is impossable for me to just write the array to disk, and call
some library rootine to run it.
i would apreciate any help.

bank@lea.ncsu.edu (Dave The DM) (10/22/90)

   The first 1024 bytes of an .EXE file is a header containing
(among other things) relocation and file-size information. This
is not executable code but is instead used by the DOS loader.

   YOu cannot just copy the .EXE file into an array of char

and execute it. One of the things that makes a .EXE file superior
to the much older .COM file (aside from the fact that it is not
limited to 64 KB) is that it is relocatable during run-time.

   So...if you want to perform all the address calculations and 
the like that the DOS loader performs when executing a .EXE file,
have fun. You can do things like that (if I see where you are
heading, you're looking to write an interpreter of some sort) 
but there's a whole lot of homework and bookkeeping involved that
is normally handled by DOS.

   Suggested reading: The Waite Group's "MS-DOS Developer's
Guide   2nd Edition"   Published by Howard and Sams. Also
Dettman's "DOS Programmer's Reference  2nd Edition" published
by QUE.

Dave

richgi@microsoft.UUCP (Richard GILLMANN) (10/23/90)

The MS-DOS Encyclopedia describes the format of .exe files,
along with many other things.  It's a Microsoft Press book.

bright@nazgul.UUCP (Walter Bright) (10/27/90)

In article <1990Oct18.184341.25578@nntp-server.caltech.edu> gwoho@nntp-server.caltech.edu (g liu) writes:
<i want to know the format of a .exe file.  i want to write a program
<that can run a .exe file that is in character array.


The format is described in the MS-DOS Tech Ref manual. It might also be in
the MS-DOS Encyclopedia.

Coming with the sources to the Zortech C libraries is an example of a loader
for exe files. It might also be in the MSC library source (in the module
that loads overlays).