Finish implementation of SetupDiGetClassDevPropertySheetsW (not tested)
Modified: trunk/reactos/lib/setupapi/devinst.c
_____
Modified: trunk/reactos/lib/setupapi/devinst.c
--- trunk/reactos/lib/setupapi/devinst.c 2005-11-30 16:54:54 UTC
(rev 19779)
+++ trunk/reactos/lib/setupapi/devinst.c 2005-11-30 17:11:43 UTC
(rev 19780)
@@ -3591,11 +3591,28 @@
return FALSE;
}
+struct ClassDevPropertySheetsData
+{
+ HPROPSHEETPAGE *PropertySheetPages;
+ DWORD MaximumNumberOfPages;
+ DWORD NumberOfPages;
+};
+
static BOOL WINAPI GetClassDevPropertySheetsCallback(
IN HPROPSHEETPAGE hPropSheetPage,
- LPARAM lParam)
+ IN OUT LPARAM lParam)
{
- FIXME("Need to add a property page!\n");
+ struct ClassDevPropertySheetsData *PropPageData;
+
+ PropPageData = (struct ClassDevPropertySheetsData *)lParam;
+
+ if (PropPageData->NumberOfPages <
PropPageData->MaximumNumberOfPages)
+ {
+ *PropPageData->PropertySheetPages = hPropSheetPage;
+ PropPageData->PropertySheetPages++;
+ }
+
+ PropPageData->NumberOfPages++;
return TRUE;
}
@@ -3605,7 +3622,7 @@
BOOL WINAPI SetupDiGetClassDevPropertySheetsW(
IN HDEVINFO DeviceInfoSet,
IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL,
- IN LPPROPSHEETHEADERW PropertySheetHeader,
+ IN OUT LPPROPSHEETHEADERW PropertySheetHeader,
IN DWORD PropertySheetHeaderPageListSize,
OUT PDWORD RequiredSize OPTIONAL,
IN DWORD PropertySheetType)
@@ -3633,8 +3650,8 @@
SetLastError(ERROR_INVALID_PARAMETER);
else if (PropertySheetType != DIGCDP_FLAG_ADVANCED
&& PropertySheetType != DIGCDP_FLAG_BASIC
- /* FIXME: && PropertySheetType != DIGCDP_FLAG_REMOTE_ADVANCED
- && PropertySheetType != DIGCDP_FLAG_REMOTE_BASIC*/)
+ && PropertySheetType != DIGCDP_FLAG_REMOTE_ADVANCED
+ && PropertySheetType != DIGCDP_FLAG_REMOTE_BASIC)
SetLastError(ERROR_INVALID_PARAMETER);
else
{
@@ -3643,6 +3660,7 @@
LPWSTR PropPageProvider = NULL;
HMODULE hModule = NULL;
PROPERTY_PAGE_PROVIDER pPropPageProvider = NULL;
+ struct ClassDevPropertySheetsData PropPageData;
DWORD dwLength, dwRegType;
DWORD rc;
@@ -3696,10 +3714,25 @@
Request.PageRequested = SPPSR_ENUM_ADV_DEVICE_PROPERTIES;
Request.DeviceInfoSet = DeviceInfoSet;
Request.DeviceInfoData = DeviceInfoData;
+ PropPageData.PropertySheetPages =
&PropertySheetHeader->phpage[PropertySheetHeader->nPages];
+ PropPageData.MaximumNumberOfPages =
PropertySheetHeaderPageListSize;
+ PropPageData.NumberOfPages = 0;
+ ret = pPropPageProvider(&Request,
GetClassDevPropertySheetsCallback, (LPARAM)&PropPageData);
+ if (!ret)
+ goto cleanup;
+
if (RequiredSize)
- *RequiredSize = 0; /* FIXME */
- pPropPageProvider(&Request, GetClassDevPropertySheetsCallback,
(LPARAM)0);
- ret = TRUE;
+ *RequiredSize = PropPageData.NumberOfPages;
+ if (PropPageData.NumberOfPages <=
PropPageData.MaximumNumberOfPages)
+ {
+ PropertySheetHeader->nPages += PropPageData.NumberOfPages;
+ ret = TRUE;
+ }
+ else
+ {
+ PropertySheetHeader->nPages +=
PropPageData.MaximumNumberOfPages;
+ SetLastError(ERROR_INSUFFICIENT_BUFFER);
+ }
cleanup:
if (hKey != INVALID_HANDLE_VALUE)