Any API-based method is doomed to be circumvented.
Since Microsoft owns the loader, the loader is free to map
the GetVersionInfoEx / RtlGetVersion API to an equivalent
API for good App-Compat reasons.
The correct approach is not to rely on a certain OS version to work,
but to test the existence of all the explicitely required services from the
There are too many application that installs fine on a default machine,
but, as soon as IE-Hardened is installed,
or as soon as some less known service is stopped they cease to work.
For your problem, you need an external "trusted source" (a service or a
that is free from the App-Compat problems.
Look for example at the Win32_OperatingSystem class in MSDN.
It's a service that populates that class, and that service is free form
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of any included script samples are subject to the terms specified at