Legacy Extender Library for Visual Studio 2005/2008
Would you like to use Visual Studio 2008 (or Visual Studio 2005), while retaining legacy Windows support in existing C/C++ projects (with or without MFC)? Are you still using Visual Studio .NET or a previous version just because you cannot afford to make your binaries incompatible with older versions of Windows? If so, the Legacy Extender library for Visual Studio can help you!
Since Microsoft dropped support for Windows 95, Windows 98, Windows Me and Windows NT 4.0 in Visual Studio 2008 (and 2005), various hacks and patches (e.g. to individual function calls, or to the Subsystem version number) have been proposed to try to overcome this problem. We know about them because we were badly looking for a solution too! The issue first emerged in Visual Studio 2005, but got more complex with Visual Studio 2008, when even more incompatible functions started being invoked. That's when we decided to write our own compatibility library.
The Legacy Extender library was developed by Cloanto in order to retain legacy support in popular applications such as MenuBox. We placed this page online in August 2008 due to popular demand, to gather some initial feedback (feel free to contact us) and to prepare for search engine optimization.
We are going to release the library for public use soon, and we are confident that it will save you a lot of time and money. In the meantime you are welcome to contact us to beta test the library and documentation, or to be notified when the final version is released.
What's included:
- LegacyExtender.lib (link this with your project to include functions referenced by the newer Visual Studio but missing in older versions of Windows)
- EditVersion.exe (edit your binary to modify the required version information and apply a new checksum, similar to EditBin.exe that once was provided by Microsoft)
One-time setup in Visual Studio 2008 (or 2005):
- Add the location of LegacyExtender.lib as a new path for library files (Tools > Options dialog - Projects and Solutions > VC++ Directories > Library files).
- Add the location of EditVersion.exe as a new path for executable files files (Tools > Options dialog - Projects and Solutions > VC++ Directories > Executable files).

Configuring your project (for each configuration/platform):
- Enter the legacyextender.lib, kernel32.lib, user32.lib and ole32.lib library files as additional dependencies, and kernel32.lib, user32.lib and ole32.lib library files as libraries to be ignored (project Property Pages dialog - Linker > Input section). If this is an MFC project, also add the shlwapi.lib library file to both fields.
- Add "EditVersion "$(TargetPath)" 4.0" as a post-build command (project Property Pages dialog - Builds Events > Post-Build Events section). If the executable is signed (Authenticode), the SignTool command must follow the EditVersion command.

Using EditVersion manually:
EditVersion [file] [#[.##]]
If no version is specified, version 4.0 (Windows 95) is used.
Benefits:
- Retain Windows 95/98/Me/NT 4.0 compatibility in your existing C/C++ projects when migrating to Visual Studio 2005 or 2008 (including the latest SP1)
- Simple lightweight library
- Elegant solution, also compatible with code optimization (other proposed "patches" do not work)
- Final library version modification also sets the correct image file checksum (required for drivers and DLLs loaded at boot time)
Limitations:
- Works on C/C++ projects only (with or without MFC), not on projects that carry other dependencies (e.g. .NET)
- Debug does not fully work in Windows 95
Related web links:
- Visual C++ 2008 Breaking Changes, documentation on MSDN
- Subsystem Linker Option, documentation on MSDN
- Creating Programs for Windows 9x and NT with Visual C++ 2008, by Green Paste, Inc.
- C/C++ EXEs and DLLs created by Visual Studio 2008 don't run on Windows 4.0 (ie, NT4 and Win9x), by Louis Solomon
- EXEs created by Visual Studio 2008 vs. Win4.0, forum thread at sysinternals.com
- Visual Studio 2008 and Windows 9x, forum thread at msfn.org
- VC++ 9.0, msvcrt.dll, Windows 95, by NN