Date: Thu, 26 Oct 1995 16:15:10 +0300 From: "Alexander V. Lukyanov" To: A DOT APPLEYARD AT fs2 DOT mt DOT umist DOT ac DOT uk, eliz AT is DOT elta DOT co DOT il Cc: djgpp AT sun DOT soe DOT clarkson DOT edu Subject: Re: .exe file format > Date: Thu, 26 Oct 1995 13:46:32 +0200 (IST) > From: Eli Zaretskii > > On Thu, 26 Oct 1995, A.Appleyard wrote: > > > Where anywhere at all can I find information on the internal format and layout > > of .COM and .EXE etc files? > > Look in the Ralph Brown's Interrupt List (where else?), under the DOS > Exec function (4Bh). There is a large table there which explains the > structure of all the executables. > > > If a .COM file did start with `MZ' or `ZM', would that correspond with any > > legal or likely PC instructions? > > The first instruction of .COM file is at offset 100h. DOS checks if the > first 2 bytes are "MZ" or "ZM", and if not, it assumes it's a .COM > program. DOS ignores the file extension (but COMMAND.COM and other > shells don't, but that's another story). So if a .COM starts with "MZ", > DOS will treat it as a .EXE program (actually, a few such ``hidden'' .EXE > programs come with DOS itself, so this behavior is intended). > Furthermore, DOS EXEC system call can load and run any file, not only .COM or .EXE --- Alexander Lukyanov lav AT video DOT yars DOT free DOT net