我如何通过编程方式来获取特定计算机上BIOS引导菜单键(例如F11)的含义。假设我有一个WinForms应用程序,即使在管理模式下,技术人员也可以运行该应用程序,并且该应用程序将返回BIOS引导菜单热键。
曾经有人以为我要使用WMI并枚举Win32_BIOS
键,例如下面的代码,但是该信息并没有返回BIOS引导菜单热键,至少不是直接返回。
这是C#代码段。
using System;
using System.Management;
private void Form1_Load(object sender, EventArgs e)
{
EnumBios();
}
private void EnumBios()
{
try
{
string query = "SELECT * FROM Win32_BIOS";
using (ManagementObjectSearcher wmiBiosItems = new ManagementObjectSearcher(query))
{
string textProperties = string.Empty;
foreach (ManagementObject wmiBiosItem in wmiBiosItems.Get())
{
textProperties += $"BIOS Information{Environment.NewLine}";
foreach (PropertyData item in wmiBiosItem.Properties)
{
textProperties += $"\t{item.Name}";
if (null != item.Value)
textProperties += $" = {item.Value.ToString()}";
textProperties += $"{Environment.NewLine}";
}
}
// Display the information.
this.TxtOutput.Text = textProperties;
}
}
catch (Exception ex)
{
this.TxtOutput.Text = ex.Message;
}
}
以下是输出:
BIOS Information BiosCharacteristics = System.UInt16[] BIOSVersion = System.String[] BuildNumber Caption = BIOS Date: 02/16/16 09:38:11 Ver: V1.13B0 CodeSet CurrentLanguage = en|US|iso8859-1 Description = BIOS Date: 02/16/16 09:38:11 Ver: V1.13B0 EmbeddedControllerMajorVersion = 255 EmbeddedControllerMinorVersion = 255 IdentificationCode InstallableLanguages = 1 InstallDate LanguageEdition ListOfLanguages = System.String[] Manufacturer = American Megatrends Inc. Name = BIOS Date: 02/16/16 09:38:11 Ver: V1.13B0 OtherTargetOS PrimaryBIOS = True ReleaseDate = 20160216000000.000000+000 SerialNumber = To be filled by O.E.M. SMBIOSBIOSVersion = V1.13 SMBIOSMajorVersion = 2 SMBIOSMinorVersion = 8 SMBIOSPresent = True SoftwareElementID = BIOS Date: 02/16/16 09:38:11 Ver: V1.13B0 SoftwareElementState = 3 Status = OK SystemBiosMajorVersion = 4 SystemBiosMinorVersion = 6 TargetOperatingSystem = 0 Version = ALASKA - 1072009
我认为WMI可能不会有所帮助。如何以编程方式确定BIOS,无论是UEFI还是旧版BIOS都不适用于显示启动菜单,启动菜单键?