获取系统固件类型和Windows固件API学习
从Win7以上开始提供一个函数,可以获取系统固件类型;
BOOL GetFirmwareType(
[in, out] PFIRMWARE_TYPE FirmwareType
);
FirmwareType是一个枚举,定义如下;
typedef enum _FIRMWARE_TYPE {
FirmwareTypeUnknown,
FirmwareTypeBios,
FirmwareTypeUefi,
FirmwareTypeMax
} FIRMWARE_TYPE, *PFIRMWARE_TYPE;
调用看一下;新建一个单文档工程;
void CFiretestView::OnDraw(CDC* pDC)
{
CFiretestDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
if (!pDoc)
return;
// TODO: 在此处为本机数据添加绘制代码
FIRMWARE_TYPE myfire;
GetFirmwareType(&myfire);
switch (myfire)
{
case FirmwareTypeUnknown:
pDC->TextOutW(50, 50, _T("不知名引导")); break;
case FirmwareTypeBios:
pDC->TextOutW(50, 50, _T("BIOS引导")); break;
case FirmwareTypeUefi:
pDC->TextOutW(50, 50, _T("UEFI引导")); break;
case FirmwareTypeMax:
pDC->TextOutW(50, 50, _T("Not implemented")); break;