Shimming real software

22 Feb 2017

Previously I described how programs can be made to work by shimming new functions that the operating system doesn't natively support. Obviously the example there was somewhat contrived, since it amounted to four fairly simple functions. Can the same technique be applied to more substantial software?

The above screenshot shows Visual C++ 2010 running on NT 4 to produce an executable and running it. This was possible using the shimming technique and applying it to the compiler and its DLL dependencies, as well as the linker and its DLL dependencies. Fortunately this software is command line only, so it doesn't require very sophisticated modern APIs, and being a piece of code with a long history it doesn't have fundamental dependencies on newer operating system features.

For full disclosure, note that this is only Visual C++ 2010. Newer versions depend on TLS initialization semantics that exist in Vista and newer releases, and can't be provided by just adding functions. But even so, considering the last supported version of Visual C++ on NT 4 was Visual C++ .NET 2002, gaining 8 years of compatibility with some simple shims is still surprisingly straightforward.