C ++如何检测Windows 10 [英] C++ How to detect Windows 10

查看:330
本文介绍了C ++如何检测Windows 10的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在很多年前编写了一个PC审核工具,并一直保持最新。其中一个基本功能是报告在被审计的PC上运行的Windows的版本,我一直使用GetVersionEx调用。

I have written a PC auditing tool many years ago and have been keeping it up to date. One of basic functions is reporting the version of Windows running on the PC being audited for which I have always used the GetVersionEx call.

这可以工作到并包括Windows 8,但在Windows 10不支持,确实Windows 10返回8.2就像windows 8一样。 Microsoft似乎没有引入任何东西作为直接替换建议,而不是检查所需的特定功能,而不是查看操作系统,但为了审计的目的,我实际上想要的操作系统名称。

This works up to and including Windows 8 but is not supported under Windows 10 and indeed Windows 10 returns 8.2 just as windows 8 does. Microsoft do not seem to have introduced anything as a direct replacement suggesting instead that you check for specific features required rather than looking at the OS but for the purpose of the audit I actually want the OS name.

'scanner'是一个C ++程序,它必须在非特权帐户下运行,所以我不认为我已经读过另一个建议 - 挑选一个系统DLL的版本,如kernel32.dll将工作

The 'scanner' is a C++ program which must run under non-privileged accounts so I don't think another suggestion I have read - picking up the version of a system DLL such as kernel32.dll will work as these folders are typically not accessible to users.

任何其他建议/想法都是最受欢迎的!

Any other suggestions/thoughts are most welcome!

推荐答案

GetVersion和GetVersionEx已被各种版本辅助函数。您要的是 IsWindows10OrGreater 。可以在 VersionHelpers.h 中找到它们。

GetVersion and GetVersionEx were superseded by various version helper functions. The one you want is IsWindows10OrGreater. They can be found in VersionHelpers.h.

IsWindows10OrGreater 仅适用于最新的SDK / Visual Studio 2015 。不过在一般情况下你可以使用 IsWindowsVersionOrGreater 。例如在我的7框中,我为 IsWindowsVersionOrGreater(6,0,0)获得TRUE。

IsWindows10OrGreater is only available in the latest SDK/Visual Studio 2015. You can use IsWindowsVersionOrGreater in the general case however. For example on my 7 box I get TRUE for IsWindowsVersionOrGreater(6, 0, 0).

请记住, Windows内部版本号和非营销名称。所以Windows 8是build 6.2。 Windows 7是6.0等。

Remember that the parameters this function takes relate to Windows build number and NOT marketing name. So Windows 8 is build 6.2. Windows 7 is 6.0 etc.

这篇关于C ++如何检测Windows 10的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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