Date: Sun, 19 Apr 1998 14:19:03 +0300 (IDT) From: Eli Zaretskii To: Luke Bishop cc: djgpp AT delorie DOT com Subject: Re: .COM's with DJGPP? In-Reply-To: <01bd6a50$8a708600$3048a5c6@technoid> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk 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.