mirror of
https://github.com/reactos/reactos.git
synced 2026-05-23 15:50:29 +08:00
[DEVMGR] Fix reading the device resource lists
For each device we must first try to read its AllocConfig resource list. If its AllocConfig resource list is not available, try to read its BootConfig resource list.
This commit is contained in:
@@ -209,9 +209,9 @@ ResourcesProcDriverDlgProc(IN HWND hwndDlg,
|
||||
return Ret;
|
||||
}
|
||||
|
||||
|
||||
PVOID
|
||||
GetResourceList(
|
||||
static
|
||||
PCM_RESOURCE_LIST
|
||||
GetAllocatedResourceList(
|
||||
LPWSTR pszDeviceID)
|
||||
{
|
||||
PCM_RESOURCE_LIST pResourceList = NULL;
|
||||
@@ -249,5 +249,61 @@ done:
|
||||
if (hKey != NULL)
|
||||
RegCloseKey(hKey);
|
||||
|
||||
return pResourceList;
|
||||
}
|
||||
|
||||
static
|
||||
PCM_RESOURCE_LIST
|
||||
GetBootResourceList(
|
||||
LPWSTR pszDeviceID)
|
||||
{
|
||||
PCM_RESOURCE_LIST pResourceList = NULL;
|
||||
HKEY hKey = NULL;
|
||||
DWORD dwError, dwSize;
|
||||
|
||||
CStringW keyName = L"SYSTEM\\CurrentControlSet\\Enum\\";
|
||||
keyName += pszDeviceID;
|
||||
keyName += L"\\LogConf";
|
||||
|
||||
dwError = RegOpenKeyExW(HKEY_LOCAL_MACHINE, keyName, 0, KEY_READ, &hKey);
|
||||
if (dwError != ERROR_SUCCESS)
|
||||
{
|
||||
/* failed to open device instance log conf dir */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
dwSize = 0;
|
||||
RegQueryValueExW(hKey, L"BootConfig", NULL, NULL, NULL, &dwSize);
|
||||
if (dwSize == 0)
|
||||
goto done;
|
||||
|
||||
pResourceList = static_cast<PCM_RESOURCE_LIST>(HeapAlloc(GetProcessHeap(), 0, dwSize));
|
||||
if (pResourceList == NULL)
|
||||
goto done;
|
||||
|
||||
dwError = RegQueryValueExW(hKey, L"BootConfig", NULL, NULL, (LPBYTE)pResourceList, &dwSize);
|
||||
if (dwError != ERROR_SUCCESS)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, pResourceList);
|
||||
pResourceList = NULL;
|
||||
}
|
||||
|
||||
done:
|
||||
if (hKey != NULL)
|
||||
RegCloseKey(hKey);
|
||||
|
||||
return pResourceList;
|
||||
}
|
||||
|
||||
PVOID
|
||||
GetResourceList(
|
||||
LPWSTR pszDeviceID)
|
||||
{
|
||||
PCM_RESOURCE_LIST pResourceList = NULL;
|
||||
|
||||
pResourceList = GetAllocatedResourceList(pszDeviceID);
|
||||
if (pResourceList == NULL)
|
||||
pResourceList = GetBootResourceList(pszDeviceID);
|
||||
|
||||
return (PVOID)pResourceList;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user