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.
Comments
Anonymous
May 30, 2007
The comment has been removedAnonymous
May 30, 2007
I'm sure it'd be a mutually-assured destruction... that's what happens when you're dealing with thermonuclear devices :). (I'm sure Raymond's a nice guy, but Larry doesn't have his reputation for temper).Anonymous
June 01, 2007
Hi,i do at this in my stdafx.h file. #define NTDDI_VERSION NTDDI_LONGHORN But, c:program filesmicrosoft sdkswindowsv6.0includestructuredquery.h(372) : error C2061: syntax error : identifier '__RPC__out' c:program filesmicrosoft sdkswindowsv6.0includestructuredquery.h(376) : error C2061: syntax error : identifier '__RPC__in' c:program filesmicrosoft sdkswindowsv6.0includestructuredquery.h(380) : error C2061: syntax error : identifier '__RPC__deref_out_opt' c:program filesmicrosoft sdkswindowsv6.0includestructuredquery.h(383) : error C2061: syntax error : identifier '__RPC__in_opt' Build log was saved at "file://d:zzyunVista(volumn)MFCMFCDebugBuildLog.htm" MFC - 103 error(s), 0 warning(s)Anonymous
June 03, 2007
Hi, I add the Vista SDK to my visual studio environment(Tools/Options/Projects and Solutions/vc++ Directories/Show directories for/Include files,,add c:program filesmicrosoft SDKsWindowsv6.0include). i do at this in my stdafx.h file. #define NTDDI_VERSION NTDDI_LONGHORN Or #define NTDDI_VERSION NTDDI_VISTA but, c:program filesmicrosoft sdkswindowsv6.0includeshtypes.h(450) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:program filesmicrosoft sdkswindowsv6.0includepropsys.h(438) : error C2061: syntax error : identifier 'REFPROPVARIANT' Build log was saved at "file://d:zzyunVista(volumn)DLLVistaVolumeVistaVolumeDebugBuildLog.htm" VistaVolume - 22 error(s), 0 warning(s) What is worry with this? Some one can help me ? Thanks!Anonymous
June 04, 2007
I know this is off topic but ... personally I've been disappointed by Microsoft breaking backward compatibiliy ... for example Revenge of Arcade (especially xevious and ms pac man) broke when XP SP2 was released ... which is very sad ... 8(Anonymous
June 23, 2007
The comment has been removedAnonymous
June 23, 2007
Jon, why do you believe that NT doesn't have a two-tiered clean architectural model (User vs System)? Windows has had that since Windows 3.1. As far as the registry vs ini files, the registry has many advantages: strongly typed data (which means you don't have to worry about parsing issues), reliable atomic modification of operations. In Vista you can perform transacted operations to the registry which allows you to modify the contents of the registry transactionally (so registry modifications can span multiple operations). None of these are possible with INI files. In addition, the registry can be read and modified remotely, which allows for remote administration - you can't do the same with .ini files unless you also allow file&print access to the directory that contains the files. I can't speak about bugs or issues in 3rd party software (I don't know what SecuROM is or who makes it).