Compatibility works both ways

Windows is rather famous for its ability to run applications that were written for previous versions of the Windows operating system.  Volumes have been written about Microsoft's backwards compatibility.

On the other hand, people have long criticized Microsoft because applications developed for the current SDKs sometimes don't work on previous versions of the operating system.  The problem is that as features get added to the operating system, the headers get updated to reflect those new features.  If your application inadvertently uses those new features, then your application isn't going to work on those older versions.

Recently, reader Nike was having problems with code I posted in one of my blog posts.  Fortunately he posted his errors, and I immediately knew what had happened.  Here's a snippet:

c:\program files\microsoft sdks\windows\v6.0\include\structuredquery.h(372) : error C2061: syntax error : identifier '__RPC__out'

c:\program files\microsoft sdks\windows\v6.0\include\structuredquery.h(376) : error C2061: syntax error : identifier '__RPC__in'

Ok, Larry - I don't get what a compilation problem that some reader's having with your code has to do with compatibility in the SDK.  Well, it turns out that the root cause of Nike's problem was related to an SDK versioning issue.  It turns out that Microsoft HAS built in backwards compatibility into it's SDKs.  Raymond wrote about this here, but basically there used to be a mismash of manifest constants that you could set to instruct the SDK which OS you're targetting.

As Raymond mentioned, at some point recently (I'm not sure when) the SDK guys decided to rationalize the various ways of specifying the target OS to one manifest constant which will set all the magic constants for whatever version of the OS you're targeting.

In Nike's case, I realized that the errors related to a a number of SAL annotations that were added for Vista.  From that, I used my psychic debugging skills and realized that Nike hadn't set NTDDI_VERSION to NTDDI_LONGHORN, and thus didn't have the new definitions included.

For those writing code for really old versions of Windows (pre Win2K), you're a bit stuck - the SDK guys only defined NTDDI_VERSION back to Win2K.  For operating systems before Win2K, you've got to use the old _WIN32_WINDOWS definitions as described in this MSDN article.