gpt4 book ai didi

c++ - 如何检测Windows 2012 Core 版(C++)

转载 作者:塔克拉玛干 更新时间:2023-11-03 02:11:56 26 4
gpt4 key购买 nike

我需要在我的程序中检测 Windows 2012 上的版本。
在以前的操作系统上,我使用了 GetProductInfo 的 pdwReturnedProductType,但根据 msdn:

PRODUCT_*_SERVER_CORE values are not returned in Windows Server 2012. For example, the base server
edition, Server Datacenter, is used to build the two different installation options: "full server"
and "core server". With Windows Server 2012, GetProductInfo will return PRODUCT_DATACENTER regardless of the option used during product installation.

还有其他检测核心版本的方法吗?
谢谢。

最佳答案

HKLM\Software\Microsoft\Windows NT\CurrentVersion\Server\ServerLevels\
ServerCore = 1
Server-Gui-Mgmt = 1
Server-Gui-Shell = 1

根据 MSDN使用这些注册表值是一种方法。另一种方法是解析 dism /online/get-features/format:table 的输出并查看功能 ServerCore-FullServer 是启用还是禁用。如果它被禁用,那么您处于 servercore 无图形用户界面模式。

关于c++ - 如何检测Windows 2012 Core 版(C++),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13065479/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com