www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/04/19/07:20:31

Date: Sun, 19 Apr 1998 14:19:03 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Luke Bishop <lbishop AT calvin DOT stemnet DOT nf DOT ca>
cc: djgpp AT delorie DOT com
Subject: Re: .COM's with DJGPP?
In-Reply-To: <01bd6a50$8a708600$3048a5c6@technoid>
Message-ID: <Pine.SUN.3.91.980419141830.23362N-100000@is>
MIME-Version: 1.0

On 18 Apr 1998, Luke Bishop wrote:

> > > In fact, it will probably hang the machine when run!
> > 
> > It probably will not hang the machine when run!  Who knows about such
> > details?  We may never find out.
> 
> Oh yes it will.  An EXE has a header, a COM does not.  The "MZ" in the
> header for the magic number will crash the computer.

Actually, a .COM file with a .EXE-style MZ signature will work just
fine, with both DOS and Windows 9X.  It's so easy to try this by
yourself that I'm puzzled why this thread even exists.

The simple truth is DOS doesn't use the file's extension to decide how
to load and run it.  The extension is only used to look for the
executable file.  When the file is found, DOS examines its first two
bytes.  If they are MZ, DOS runs it as an .EXE-style; otherwise it
assumes it's a .COM image.

Having .EXE programs disguised by giving them a .COM extension goes
back to at least DOS 3.x; some of the stock DOS utilities were
distributed that way for a long time.  As a more recent example, look
at COMMAND.COM which comes with Windows 9X.

- Raw text -


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