2008-05-25

Creating Programs for Windows 9x and NT with Visual C++ 2008

Note: this content originally from http://mygreenpaste.blogspot.com. If you are reading it from some other site, please take the time to visit My Green Paste, Inc. Thank you.

A recent topic in the Development forum at Sysinternals Forums contains some information about how to use Visual C++ 2008 to create binaries that run on Windows 9x and NT. For NT, it seems to just be a matter of changing the Subsystem Version to 4.0. One might think to use the /SUBSYSTEM linker switch for this. However, when one attempts to do so, the shipping link.exe reports:


LINK : warning LNK4010: invalid subsystem version number x.y; default subsystem version assumed


In this case, the default subsystem version is 5.0, and NT needs 4.0. One can use an older copy of EditBin.exe to change this (I found the version that shipped with Visual Studio .NET 2003 to work):


editbin /SUBSYSTEM:CONSOLE,4.0 c:\path\to\your.exe


The same requirement also exists to get the executable to run on Windows 9x, but one needs to do a bit more work.


Louis Solomon has taken the time and put forth the effort to find what is needed for this, and has documented it at C/C++ EXEs and DLLs created by Visual Studio 2008 don't run on Windows 4.0 (ie, NT4 and Win9x).

1 comment:

Takeo said...

I enjoyed this article, it remains one of the references on this topic. You may also want to give a look at our humble work at legacyextender.com: Legacy Extender for Visual Studio 2005/2008. We use a library + version editor approach to solve this. It is compatible with debug mode, and does not require post-build code patches.