www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/10/26/09:06:50

Date: Thu, 26 Oct 1995 13:46:32 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: "A.Appleyard" <A DOT APPLEYARD AT fs2 DOT mt DOT umist DOT ac DOT uk>
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Re: .exe file format

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).

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019