从 Windows 内核驱动程序检测固件是 UEFI 还是 BIOS 的可靠方法
Reliable way to detect if the firmware is UEFI or BIOS from a Windows kernel driver
有没有可靠的方法可以在运行时从 Windows 内核驱动程序检测固件是 BIOS 还是 UEFI 而无需访问磁盘?
试试 ExGetFirmwareEnvironmentVariable 函数。使用空变量名称和虚拟 GUID 调用此函数以确定 Windows 是使用 BIOS 还是 UEFI 安装的。有关详细信息,请参阅文档中所述的以下内容。
Firmware environment variables are not supported on a legacy BIOS-based platform. Calls to ExGetFirmwareEnvironmentVariable always fail on a legacy BIOS-based platform; they also fail if Windows was installed using the legacy BIOS on a platform that supports both legacy BIOS and UEFI. To identify these conditions, call the function with a dummy VariableName string (for example, an empty string) and a dummy GUID such as
"{00000000-0000-0000-0000-000000000000}"
for the VendorGuid parameter. On a legacy BIOS-based platform, or on a platform that supports both legacy BIOS and UEFI but in which Windows was installed using the legacy BIOS, the function will fail with STATUS_NOT_IMPLEMENTED. On a UEFI-based platform, the function will fail with an error specific to the firmware, such as STATUS_VARIABLE_NOT_FOUND, to indicate that the dummy GUID namespace does not exist.
有没有可靠的方法可以在运行时从 Windows 内核驱动程序检测固件是 BIOS 还是 UEFI 而无需访问磁盘?
试试 ExGetFirmwareEnvironmentVariable 函数。使用空变量名称和虚拟 GUID 调用此函数以确定 Windows 是使用 BIOS 还是 UEFI 安装的。有关详细信息,请参阅文档中所述的以下内容。
Firmware environment variables are not supported on a legacy BIOS-based platform. Calls to ExGetFirmwareEnvironmentVariable always fail on a legacy BIOS-based platform; they also fail if Windows was installed using the legacy BIOS on a platform that supports both legacy BIOS and UEFI. To identify these conditions, call the function with a dummy VariableName string (for example, an empty string) and a dummy GUID such as
"{00000000-0000-0000-0000-000000000000}"
for the VendorGuid parameter. On a legacy BIOS-based platform, or on a platform that supports both legacy BIOS and UEFI but in which Windows was installed using the legacy BIOS, the function will fail with STATUS_NOT_IMPLEMENTED. On a UEFI-based platform, the function will fail with an error specific to the firmware, such as STATUS_VARIABLE_NOT_FOUND, to indicate that the dummy GUID namespace does not exist.