mirror of
https://github.com/reactos/reactos.git
synced 2025-05-29 22:18:13 +00:00
[DEVMGR] Do not add the 'Resources' page to the device properties if the device does not have any resources
This commit is contained in:
parent
1ca7d5d948
commit
16a4fc76de
3 changed files with 53 additions and 25 deletions
|
@ -2517,6 +2517,8 @@ GetParentNode:
|
||||||
nDriverPages = 0;
|
nDriverPages = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dap->pResourceList = GetResourceList(dap->szDeviceID);
|
||||||
|
|
||||||
/* include the driver page */
|
/* include the driver page */
|
||||||
if (dap->HasDriverPage)
|
if (dap->HasDriverPage)
|
||||||
dap->nDevPropSheets++;
|
dap->nDevPropSheets++;
|
||||||
|
@ -2525,7 +2527,7 @@ GetParentNode:
|
||||||
if (dap->Extended)
|
if (dap->Extended)
|
||||||
dap->nDevPropSheets++;
|
dap->nDevPropSheets++;
|
||||||
|
|
||||||
if (dap->HasResourcePage)
|
if (dap->HasResourcePage && dap->pResourceList != NULL)
|
||||||
dap->nDevPropSheets++;
|
dap->nDevPropSheets++;
|
||||||
|
|
||||||
/* add the device property sheets */
|
/* add the device property sheets */
|
||||||
|
@ -2627,7 +2629,7 @@ GetParentNode:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dap->HasResourcePage)
|
if (dap->HasResourcePage && dap->pResourceList)
|
||||||
{
|
{
|
||||||
PROPSHEETPAGE pspDriver = {0};
|
PROPSHEETPAGE pspDriver = {0};
|
||||||
pspDriver.dwSize = sizeof(PROPSHEETPAGE);
|
pspDriver.dwSize = sizeof(PROPSHEETPAGE);
|
||||||
|
@ -3060,6 +3062,9 @@ Cleanup:
|
||||||
DestroyIcon(DevAdvPropInfo->hDevIcon);
|
DestroyIcon(DevAdvPropInfo->hDevIcon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (DevAdvPropInfo->pResourceList != NULL)
|
||||||
|
HeapFree(GetProcessHeap(), 0, DevAdvPropInfo->pResourceList);
|
||||||
|
|
||||||
HeapFree(GetProcessHeap(),
|
HeapFree(GetProcessHeap(),
|
||||||
0,
|
0,
|
||||||
DevAdvPropInfo);
|
DevAdvPropInfo);
|
||||||
|
|
|
@ -244,34 +244,12 @@ AddResourceItems(
|
||||||
IN PDEVADVPROP_INFO dap,
|
IN PDEVADVPROP_INFO dap,
|
||||||
IN HWND hWndDevList)
|
IN HWND hWndDevList)
|
||||||
{
|
{
|
||||||
HKEY hKey;
|
|
||||||
WCHAR szBuffer[100];
|
WCHAR szBuffer[100];
|
||||||
WCHAR szDetail[100];
|
WCHAR szDetail[100];
|
||||||
BYTE szData[512];
|
|
||||||
DWORD dwSize;
|
|
||||||
PCM_RESOURCE_LIST ResourceList;
|
PCM_RESOURCE_LIST ResourceList;
|
||||||
LONG Result;
|
|
||||||
ULONG ItemCount = 0, Index;
|
ULONG ItemCount = 0, Index;
|
||||||
|
|
||||||
wsprintf(szBuffer, L"SYSTEM\\CurrentControlSet\\Enum\\%s\\LogConf", dap->szDeviceID);
|
ResourceList = (PCM_RESOURCE_LIST)dap->pResourceList;
|
||||||
Result = RegOpenKeyExW(HKEY_LOCAL_MACHINE, szBuffer, 0, KEY_READ, &hKey);
|
|
||||||
if (Result != ERROR_SUCCESS)
|
|
||||||
{
|
|
||||||
/* failed to open device instance log conf dir */
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
dwSize = sizeof(szData);
|
|
||||||
Result = RegQueryValueExW(hKey, L"BootConfig", NULL, NULL, szData, &dwSize);
|
|
||||||
|
|
||||||
RegCloseKey(hKey);
|
|
||||||
if (Result != ERROR_SUCCESS)
|
|
||||||
{
|
|
||||||
/* failed to query resources */
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ResourceList = (PCM_RESOURCE_LIST)szData;
|
|
||||||
|
|
||||||
for (Index = 0; Index < ResourceList->List[0].PartialResourceList.Count; Index++)
|
for (Index = 0; Index < ResourceList->List[0].PartialResourceList.Count; Index++)
|
||||||
{
|
{
|
||||||
|
@ -374,3 +352,43 @@ ResourcesProcDriverDlgProc(IN HWND hwndDlg,
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PVOID
|
||||||
|
GetResourceList(
|
||||||
|
LPWSTR pszDeviceID)
|
||||||
|
{
|
||||||
|
WCHAR szBuffer[100];
|
||||||
|
PCM_RESOURCE_LIST pResourceList = NULL;
|
||||||
|
HKEY hKey = NULL;
|
||||||
|
DWORD dwError, dwSize;
|
||||||
|
|
||||||
|
wsprintf(szBuffer, L"SYSTEM\\CurrentControlSet\\Enum\\%s\\LogConf", pszDeviceID);
|
||||||
|
dwError = RegOpenKeyExW(HKEY_LOCAL_MACHINE, szBuffer, 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 (PVOID)pResourceList;
|
||||||
|
}
|
||||||
|
|
|
@ -53,6 +53,7 @@ typedef struct _DEVADVPROP_INFO
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
PVOID pResourceList;
|
||||||
WCHAR szDevName[255];
|
WCHAR szDevName[255];
|
||||||
WCHAR szTemp[255];
|
WCHAR szTemp[255];
|
||||||
WCHAR szDeviceID[1];
|
WCHAR szDeviceID[1];
|
||||||
|
@ -79,6 +80,10 @@ ResourcesProcDriverDlgProc(IN HWND hwndDlg,
|
||||||
IN WPARAM wParam,
|
IN WPARAM wParam,
|
||||||
IN LPARAM lParam);
|
IN LPARAM lParam);
|
||||||
|
|
||||||
|
PVOID
|
||||||
|
GetResourceList(
|
||||||
|
_In_ LPWSTR pszDeviceID);
|
||||||
|
|
||||||
/* ADVPROP.C */
|
/* ADVPROP.C */
|
||||||
|
|
||||||
INT_PTR
|
INT_PTR
|
||||||
|
|
Loading…
Reference in a new issue