這個值被稱爲Universal Unique ID number
,是SMBIOS表的一部分,如果你使用Win32_BIOS WMI類的SerialNumber屬性youu將得到uuid.bios
的相同的ID(來自VMX文件)項加前綴VMware-
(例如:VMware-56 4d af ac d8 bd 4d 2c-06 df ca af 89 71 44 93
)
uses
SysUtils,
ActiveX,
ComObj,
Variants;
// The Win32_BIOS class represents the attributes of the computer system's basic input/output services (BIOS) that are installed on the computer.
procedure GetWin32_BIOSInfo;
const
WbemUser ='';
WbemPassword ='';
WbemComputer ='localhost';
wbemFlagForwardOnly = $00000020;
var
FSWbemLocator : OLEVariant;
FWMIService : OLEVariant;
FWbemObjectSet: OLEVariant;
FWbemObject : OLEVariant;
oEnum : IEnumvariant;
iValue : LongWord;
begin;
FSWbemLocator := CreateOleObject('WbemScripting.SWbemLocator');
FWMIService := FSWbemLocator.ConnectServer(WbemComputer, 'root\CIMV2', WbemUser, WbemPassword);
FWbemObjectSet:= FWMIService.ExecQuery('SELECT SerialNumber FROM Win32_BIOS','WQL',wbemFlagForwardOnly);
oEnum := IUnknown(FWbemObjectSet._NewEnum) as IEnumVariant;
if oEnum.Next(1, FWbemObject, iValue) = 0 then
Writeln(Format('SerialNumber %s',[String(FWbemObject.SerialNumber)]));// String
end;
begin
try
CoInitialize(nil);
try
GetWin32_BIOSInfo;
finally
CoUninitialize;
end;
except
on E:EOleException do
Writeln(Format('EOleException %s %x', [E.Message,E.ErrorCode]));
on E:Exception do
Writeln(E.Classname, ':', E.Message);
end;
Writeln('Press Enter to exit');
Readln;
end.
如果你想返回相同的UUID沒有VMware-
前綴必須直接讀取SMBIOS tables(查看系統信息表1型和UUID場),嘗試本文Reading the SMBios Tables using Delphi
whcih包括有一個樣本代碼來列出這個值。
UUID格式
從System Management BIOS (SMBIOS) Reference Specification
UUID是一個被設計成橫跨時間和空間的獨特的標識符。它不需要中央註冊程序。 UUID長度爲128位。其格式在RFC 4122中有描述,但實際的字段內容對於SMBIOS規範來說是不透明和不重要的,SMBIOS規範只涉及字節順序。表10顯示了字段名稱;這些字段名稱,特別是多路複用字段,遵循歷史慣例。
儘管RFC 4122建議對所有領域的網絡字節順序,PC行業(包括ACPI,UEFI,微軟規格)一貫使用little-endian字節編碼的前三個領域:time_low, time_mid,time_hi_and_version。 UUID的SMBIOS表示也應使用相同的編碼,也稱爲連線格式。
UUID {00112233-4455-6677-8899-AABBCCDDEEFF}將因此表示爲: 33 22 11 00 55 44 77 66 88 99 AA BB CC DD EE FF。
如果該值全是FFh,則該ID當前不在系統中,但可以設置。如果該值全部爲00h,則系統中不存在該ID。
'WIN32_BIOS' class(http://msdn.microsoft.com/en-us/library/windows/desktop/aa394077%28v=vs.85%29.aspx)? – teran 2012-03-30 09:11:23
該類不包含UUID(SerialNumber是不同的)。有趣的是:dmidecode將uuid.bios UUID顯示爲主板UUID,而不是BIOS UUID。 – cytrinox 2012-03-30 09:15:51