|
直接嵌入式就能用
<火山程序 类型 = "通常" 版本 = 1 />
@ struct RawSMBIOSData
@ {
@ BYTE Used20CallingMethod;
@ BYTE SMBIOSMajorVersion;
@ BYTE SMBIOSMinorVersion;
@ BYTE DmiRevision;
@ DWORD Length;
@ BYTE SMBIOSTableData[];
@ };
@ DWORD error = ERROR_SUCCESS;
@ DWORD smBiosDataSize = 0;
@ RawSMBIOSData* smBiosData = NULL; // Defined in this link
@ DWORD bytesWritten = 0;
@
@ // Query size of SMBIOS data.
@ smBiosDataSize = GetSystemFirmwareTable('RSMB', 0, NULL, 0);
@
@ // Allocate memory for SMBIOS data
@ smBiosData = (RawSMBIOSData*) HeapAlloc(GetProcessHeap(), 0, smBiosDataSize);
@ if (!smBiosData) {
@ error = ERROR_OUTOFMEMORY;
调试输出 ("error")
@ }
@
@ // Retrieve the SMBIOS table
@ bytesWritten = GetSystemFirmwareTable('RSMB', 0, smBiosData, smBiosDataSize);
@
@ if (bytesWritten != smBiosDataSize) {
@ error = ERROR_INVALID_DATA;
调试输出 ("error")
@ }
@
@ // Process the SMBIOS data and free the memory under an exit label
变量 指针 <类型 = 变整数>
变量 size <类型 = 整数>
变量 SMBIOSMajorVersion <类型 = 字节>
变量 SMBIOSMinorVersion <类型 = 字节>
变量 DmiRevision <类型 = 字节>
变量 Length <类型 = 整数>
变量 SMBIOSTableData <类型 = 变整数>
@ @<指针> = (INT_P)smBiosData;
@ @<size> = sizeof(RawSMBIOSData);
@ @<SMBIOSMajorVersion> = smBiosData->SMBIOSMajorVersion;
@ @<SMBIOSMinorVersion> = smBiosData->SMBIOSMinorVersion;
@ @<DmiRevision> = smBiosData->DmiRevision;
@ @<Length> = smBiosData->Length;
@ @<SMBIOSTableData> = (INT_P)smBiosData->SMBIOSTableData;
调试输出 (指针到字节集 (指针, size + 8))
调试输出 (SMBIOSMajorVersion, SMBIOSMinorVersion, DmiRevision, Length)
调试输出 (指针到字节集 (SMBIOSTableData, Length))
|
|