Mail Archives: djgpp/1998/04/19/07:20:31
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 -