On Sat Jan 7 17:34:05 2023 <to...@tuxteam.de> wrote:
> On Sat, Jan 07, 2023 at 08:47:09AM -0500, Jude DaShiell wrote: > >> If I remember correctly, dos and windows .com and .exe programs >> all have control-z as their first character. The file command >> may also help. > > No. Control-Z (aka 0x1a) was an EOF character under DOS. Files were > (sometimes...) terminated with that. Hilarity ensued when there was > stuff after that (DOS/Windows was very hilarious, for some value of > hilarious). The use of control-Z to mark the end of a text file was inherited from CP/M, whose directory entries store the size of a file as a number of 128-byte sectors. The control-Z was a hack to enable the actual end of the text to be found in the last sector - and if the file size is a multiple of 128 it isn't even necessary. MS-DOS and Windows store the size of a file to the byte, so control-Z is not needed. However it lives on to this day, still causing its share of headaches. In fact, an early version of MS-DOS (3.0 or 3.1, IIRC) contained a bug: if you redirected standard output to append to a file, e.g. dir >>foo and the file foo existed and contained text ending in hex 1A, the appended text did not overwrite the hex 1A, resulting in the appended text being dropped by any program that subsequently read the file. Microsoft fixed that one pretty quickly. A control-Z EOF marker is not required - and has never been required - in any version of MS-DOS or Windows. Any program I write eradicates it. But getting back to the original poster's message, try using a hex editor or running the strings utility on the executable file, and look at the first 128 bytes or so. If it's MS-DOS, you probably won't see anything interesting. I've looked at various Windows programs, compiled by different compilers, and found one of the following messages in the first 128 bytes: This program must be run under Microsoft Windows. This program must be run under Win32 This program cannot be run in DOS mode. This program requires Microsoft Windows. -- /~\ Charlie Gibbs | They don't understand Microsoft \ / <cgibbs@kltpzyxm.invalid> | has stolen their car and parked X I'm really at ac.dekanfrus | a taxi in their driveway. / \ if you read it the right way. | -- Mayayana