IsWindows10OrGreater() 在 Windows 10 上失败 [英] IsWindows10OrGreater() is failing on Windows 10

查看:56
本文介绍了IsWindows10OrGreater() 在 Windows 10 上失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 GetVersionEx 函数编写了一段代码来检索 Windows 主要和次要版本,但该函数始终返回主要版本 6 和次要版本 2.

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 说要使用版本帮助程序 API 来查找当前的操作系统.我在 Windows 8.1 中构建了该项目,并引用了 Windows 8.1 工具包路径以包含 VersionHelpers 头文件.VersionHelpers 头文件中没有可用的 IsWindows10OrGreater() 函数.

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.

所以我从 GitHub 下载了 VersionHelper 头文件并添加到我的项目中.编译错误消失,但 IsWindows10OrGreater 函数失败.

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

我做错了什么吗?

推荐答案

VersionHelper 函数只是 VerifyVersionInfo() 的包装器.从 Windows 10 开始,VerifyVersionInfo() 现在遵循与 GetVersionEx() 相同的版本表现规则.要获得真实 OS 版本而不管表现如何,您可以使用RtlGetVersion()NetServerGetInfo()NetWkstaGetInfo() 代替.

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.

这篇关于IsWindows10OrGreater() 在 Windows 10 上失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆