Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IsWindows10OrGreater() is failing on Windows 10

I wrote a piece of code to retrieve windows major and minor version using GetVersionEx function, but this function always returns major version 6 and minor version 2.

MSDN is saying to use Version Helper APIs to find the current OS. I built the project in windows 8.1 and referred Windows 8.1 kits path to include VersionHelpers header file. There is no IsWindows10OrGreater() function available in VersionHelpers header file.

So I downloaded VersionHelper header file from GitHub and added into my project. Compile error gone but IsWindows10OrGreater function is getting fail.

Am i doing anything wrong?

like image 760
user2385610 Avatar asked Nov 06 '15 12:11

user2385610


1 Answers

The VersionHelper functions are simply wrappers for VerifyVersionInfo(). Starting in Windows 10, VerifyVersionInfo() is now subject to the same version manifestation rules that GetVersionEx() is subject to. To get the true OS version regardless of manifestation, you can use RtlGetVersion(), NetServerGetInfo(), or NetWkstaGetInfo() instead.

like image 165
Remy Lebeau Avatar answered Oct 05 '22 22:10

Remy Lebeau