Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views

DOS Mode...

Sign in to follow this  


Everyone knows of the message This program cannot be run in MS-DOS mode.

This is a stub program that is embedded by the complier of 32 bit PE executables. It is inside the old MZ header section of the PE file, and is executed if you try to run the program under DOS.

It is possible to change the stub program. This is done using the /STUB option in MSVC++ 2005.

Under Project Properties=>Linker Options=>Command Line, type in:


...Where myprog.exe is a valid 32 bit PE executable.

Now, MSVC++ will embed myprog.exe as the stub program, instead, so you can do whatever you want...Perhaps display another message like:

DOS is dead! This game will not work for you, oldie.

This will probably be useless, but who knows.

Perhaps execute a different DOS version of the game, instead?
Sign in to follow this  


Recommended Comments

I think that was the genesis of the Portable Executable, actually.

I do remember seeing at least one Origin game use that trick to spell out to you why you had to switch up to a 386.

When they were still making the Alpha and PowerPC versions of NT, I think it was proposed that it could be used for alternate bytecode, but they ended up shipping separate binaries for each.

MacOS had a similar trick when they were moving from 68K to PPC; the "fat" binary wasn't quite the same, though. I think they use the same method for the OS X Universal binaries (i386/IA64/ppc64/ppc32).

Share this comment

Link to comment
Way back in the Windows 3.x and earlier days when you launched Windows manually, you could make the DOS stub launch Windows with your app as the argument "win.exe myapp.exe"

IIRC, there were only a couple of apps that ran "dual mode" and appeared as a Windows and DOS-based app.

Share this comment

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!