我怎样才能编程通过什么意思的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或Legacy不适用于显示引导菜单、引导菜单键)?