CURRENT WORK ITEM - PREVIEW ONLY

Operating System Identification

Microsoft’s own programmers have at least as much trouble as any with how their code may have to adapt its behaviour depending on what operating system it happens to get run on. Essential to this exercise is, of course, the means to identify the operating system and its key features or configurations. (No less important is to know what those key features are, and which variations of which operating systems have which features, but this is perhaps another story.)

It seems that after a few years of developing the 32-bit Windows shell, and certainly by the time Microsoft started integrating the shell and Internet Explorer, Microsoft’s programmers developed some stock code—indeed, it first appears in statically-linked libraries with names like STOCKLIB.LIB, STOCK4.LIB and STOCK5.LIB—for this work of answering standardised questions about the operating system. From version 5.00 of SHLWAPI.DLL onwards, this standard code is exported. There is just the one function:

Curiously, SHLWAPI versions 5.00 up to but not including the version 6.00 with Windows Vista carry two more or less identical copies, one exported, one not. Also, modules such as SHDOCVW.DLL retain (and use) their statically linked copies, yet also import the functionality from SHLWAPI.