|
void BL_ReadRegistry(BLStruct *pBLInfo)
{
HKEY hKey;
LONG lResult;
DWORD dwType;
DWORD dwVal;
DWORD dwLen;
lResult = RegOpenKeyEx(HKEY_CURRENT_USER, szregRootKey, 0, KEY_ALL_ACCESS, &hKey);
if(ERROR_SUCCESS == lResult) {
dwType = REG_DWORD;
dwLen = sizeof(DWORD);
lResult = RegQueryValueEx(hKey, szregBatteryTimeout, NULL, &dwType,
(LPBYTE)&dwVal, &dwLen);
if(ERROR_SUCCESS == lResult) {
pBLInfo->m_dwBatteryTimeout = dwVal;
}
lResult = RegQueryValueEx(hKey, szregACTimeout, NULL, &dwType, (LPBYTE)&dwVal,
&dwLen);
if(ERROR_SUCCESS == lResult) {
pBLInfo->m_dwACTimeout = dwVal;
}
lResult = RegQueryValueEx(hKey, szregBatteryAuto, NULL, &dwType, (LPBYTE)&dwVal,
&dwLen);
if(ERROR_SUCCESS == lResult) {
pBLInfo->m_bBatteryAuto = (BOOL) dwVal;
}
lResult = RegQueryValueEx(hKey, szregACAuto, NULL, &dwType, (LPBYTE)&dwVal,
&dwLen);
if(ERROR_SUCCESS == lResult) {
pBLInfo->m_bACAuto = (BOOL) dwVal;
}
RegCloseKey(hKey);
}
else {
RETAILMSG(1, (TEXT("BAK : HKEY_CURRENT_USER\\%s key doesn't exist!\r\n"), szregRootKey));
}
}
|
|