Import table dependencies

16 Feb 2017

In the last installment, I mentioned that some programs targeting new versions of Windows can be made to work on old versions by just updating the subsystem version in the header. Although this is true, it's also relatively unlikely - what typically happens is a program depends on functions that the old version of Windows doesn't have.

Taking the previous example, compiling sdir) with Visual C++ 2012 and its CRT results in a program that won't run on NT 4 regardless of its subsystem version, and instead complains about missing the EncodePointer function:

Taking a closer look with Dependency Walker shows that the program is missing EncodePointer, DecodePointer, GetModuleHandleExW, and SetFilePointerEx. None of these functions are used by sdir directly; instead, they are used by the Visual C++ 2012 CRT which has been included in the program.

Although it's somewhat odd to rank APIs by importance, these APIs were added to the platform much more recently than alternatives to solve limited problems, but they're hardly essential for programs to function.