On Dec 28, 2013, at 8:12, "Giampaolo Rodola'" <g.rodola@gmail.com> wrote:


Meanwhile, Microsoft's suggested solution is that you not check for version numbers at runtime, but instead check for features. And there are good reasons for that--for example, XPSP3 N has exactly the same version numbers as XPSP3 normal, but if you try to use the new Windows Media APIs, you'll crash.

Mmm. What's weird is that if you use MSDN as a reference every Windows API has a "minimum supported client" section near the bottom of the page.
See for example:
To me that suggests that (most of the times at least) you are encouraged to use the windows version to decide whether to support a feature or not.

Those versions don't correspond to any unique kernel version number, so you _can't_ check for it that way.

What you _can_ do with that information is write your app's version requirements, so your end users know not to buy your all if they have xpsp1.

http://msdn.microsoft.com/en-us/library/windows/desktop/ms724832(v=vs.85).aspx is one of the places they recommend against using version numbers as a substitute for feature test. it says:


way to determine whether a particular operating system feature is present. This is because the operating system may have had new features added in a redistributable DLL. Rather than using the Version API Helper functions to determine the operating system platform or version number, test for the presence of the feature itself.

To determine the best way to test for a feature, refer to the documentation for the feature of interest. The following list discusses some common techniques for feature detection:

If you must require a particular operating system, be sure to use it as a minimum supported version, rather than design the test for the one operating system. This way, your detection code will continue to work on future versions of Windows.

Note that a 32-bit application can detect whether it is running under WOW64 by calling the IsWow64Process function. It can obtain additional processor information by calling theGetNativeSystemInfo function.