vs条件下:
HKEY hKey;
DWORD KeyType = REG_BINARY;
DWORD DataSize;
LPCTSTR data_set = TEXT("System//CurrentControlSet//Services//mssmbios//Data");
long ret0=(::RegOpenKeyEx(HKEY_LOCAL_MACHINE,data_set,0,KEY_READ,&hKey));
if(ret0==ERROR_SUCCESS)
{
RegQueryValueEx(hKey,L"SMBiosData",NULL,&KeyType,NULL,&DataSize);
BYTE *pbuf = new BYTE[DataSize];
long ret1= RegQueryValueEx(hKey,L"SMBiosData",0,&KeyType,(LPBYTE)pbuf,&DataSize);
if(ret1 == ERROR_SUCCESS)
{
//Add your code
}
}
RegCloseKey(hKey);