Mail Archives: djgpp/1995/10/26/09:58:38
> Date: Thu, 26 Oct 1995 13:46:32 +0200 (IST)
> From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
>
> 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
- Raw text -