Blog

Software

AN.

Blog

The MS-DOS Program Within Windows Programs

7 June 2018

Within most 16-bit New Executables, 32-bit and even 64-bit Portable Executables is a tiny MS-DOS program. Most compilers fill this space with a small stub that prints a message along the lines of "This program cannot be run in DOS mode." What was the point of this, and can it be made to do something useful?

As MS-DOS and Windows programs both use the same extension (.exe), it is not possible to know if a program is for one or the other. Without the stub, it might try to run the Windows program's instructions with unpredictable results.

Another possible use is to load Windows, if you have it installed. It could pass itself as the argument so the program is started immediately (instead of the MS-DOS Executable or Program Manager).

But perhaps the most interesting use is to have a multiplatform program, along the lines of fat binaries on Apple Macintosh platforms. What about an installer (e.g. A:\SETUP.EXE) that could install an MS-DOS version under DOS, or a Windows version under Windows without having to change the command? Or perhaps a diagnostics program with both modes. However this was virtually never used, opting for two separate program files instead.

I did find one good example of such a program: WinAdv. It is a 16-bit Windows version of the text adventure game Colossal Cave, which also runs within MS-DOS.

Screenshot of Colossal Cave in Windows.

Colossal Cave under Windows 3...

Screenshot of Colossal Cave in MS-DOS. The text is the same.

...and the same program under MS-DOS.

I think this was a rather neat feature (I don't know if it has an official name), and I wonder why it wasn't used more often. I suppose having them separated meant you could save disk space by only installing the one you needed. It may have been more difficult to debug. There is also no easy way to run just the MS-DOS portion within a command prompt window, as it launches the Windows version instead.

Return to Blog Index

2024

2023

2022

2021

2020

2019

2018

© Andrew Nile 2018-2024. Privacy