IsWindows10OrGreater() is failing on Windows 10

泪湿孤枕 提交于 2020-01-14 17:37:06

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/33566988/iswindows10orgreater-is-failing-on-windows-10

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!