以编程方式检测是否在 Windows 上启用了 VT-x 或 AMD-v [英] Programatically detect if VT-x or AMD-v is enabled on Windows

查看:23
本文介绍了以编程方式检测是否在 Windows 上启用了 VT-x 或 AMD-v的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 OSX 或 linux 上,在终端中查看 CPU 功能相当简单.有没有办法在 Windows 上访问 CPU 信息,特别是硬件辅助虚拟化功能?

我只找到了微软的工具:http://www.microsoft.com/en-us/download/details.aspx?id=592

但想要一些不需要额外二进制文件的东西.

解决方案

我相信检查虚拟化是否启用的最佳方法是使用 WMI 并检查 Win32_Processor 类.如果启用,VirtualizationFirmwareEnabled"字段的值应该给你.

我已经通过在 BIOS 中启用和禁用在我的机器上进行了测试,该值显示正确.

Win32_处理器:http://msdn.microsoft.com/en-us/library/aa394373%28v=vs.85%29.aspx

为了检查支持的内容,我相信您需要使用信息类型为 0x1 和 0x80000001 的 __cpuid() 内部函数来查询 CPU 功能.可以在以下链接中找到示例.

CPUID 维基:http://en.wikipedia.org/wiki/CPUID>

__cpuid 函数:msdn.microsoft.com/en-us/library/hskdteyh(VS.80).aspx

On OSX or linux, it is rather trivial to view CPU capabilities in the terminal. Is there a way to access the CPU information, specifically the hardware assisted virtualization capabilities, on Windows?

I only found Microsoft's tool: http://www.microsoft.com/en-us/download/details.aspx?id=592

but would like something that doesn't require additional binaries.

解决方案

I believe the best bet to check if virtualisation is enabled is by using WMI and check the Win32_Processor class. The value of the "VirtualizationFirmwareEnabled" field should give you if it is enabled.

I have tested on my machine by enabling and disabling in the BIOS and this value appears correct.

Win32_Processor: http://msdn.microsoft.com/en-us/library/aa394373%28v=vs.85%29.aspx

For checking what is supported I believe you will need to use the __cpuid() intrinsic function with an Information type of 0x1 and 0x80000001 to query the CPU features. Examples can be found on the following links.

CPUID Wiki: http://en.wikipedia.org/wiki/CPUID

__cpuid Function: msdn.microsoft.com/en-us/library/hskdteyh(VS.80).aspx

这篇关于以编程方式检测是否在 Windows 上启用了 VT-x 或 AMD-v的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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