From 37faec1dc16b3bcb58052d9dc75e7f9b8c9380fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Poussineau?= Date: Wed, 28 Dec 2005 14:21:05 +0000 Subject: [PATCH] - Add a minimal implementation of SetupScanFileQueueW - In SetupDiBuildDriverInfoList, add found drivers in the right driver list - In SetupDiEnumDriverInfoW, enumerate the right driver list if DeviceInfoData is not NULL svn path=/trunk/; revision=20394 --- reactos/lib/setupapi/devinst.c | 19 ++++++++++------- reactos/lib/setupapi/queue.c | 38 +++++++++++++++++++++++++++++++--- 2 files changed, 47 insertions(+), 10 deletions(-) diff --git a/reactos/lib/setupapi/devinst.c b/reactos/lib/setupapi/devinst.c index ac9f41689f1..3003d474899 100644 --- a/reactos/lib/setupapi/devinst.c +++ b/reactos/lib/setupapi/devinst.c @@ -5389,6 +5389,7 @@ SetupDiBuildDriverInfoList( SetLastError(ERROR_INVALID_USER_BUFFER); else { + PLIST_ENTRY pDriverListHead = &list->DriverListHead; BOOL Result; InstallParams.cbSize = sizeof(SP_DEVINSTALL_PARAMS_W); @@ -5396,6 +5397,13 @@ SetupDiBuildDriverInfoList( if (!Result) goto done; + if (DeviceInfoData) + { + struct DeviceInfoElement *devInfo = (struct DeviceInfoElement *)DeviceInfoData->Reserved; + if (!(devInfo->CreationFlags & DICD_INHERIT_CLASSDRVS)) + pDriverListHead = &devInfo->DriverListHead; + } + if (DriverType == SPDIT_COMPATDRIVER) { /* Get hardware IDs list */ @@ -5633,7 +5641,7 @@ SetupDiBuildDriverInfoList( { /* FIXME: read [ControlFlags] / ExcludeFromSelect */ if (!AddDriverToList( - &list->DriverListHead, + pDriverListHead, DriverType, &ClassGuid, ContextDevice, @@ -5689,7 +5697,7 @@ SetupDiBuildDriverInfoList( if (wcsicmp(DeviceId, currentId) == 0) { AddDriverToList( - &((struct DeviceInfoElement *)DeviceInfoData->Reserved)->DriverListHead, + pDriverListHead, DriverType, &ClassGuid, ContextDevice, @@ -5710,7 +5718,7 @@ SetupDiBuildDriverInfoList( if (wcsicmp(DeviceId, currentId) == 0) { AddDriverToList( - &((struct DeviceInfoElement *)DeviceInfoData->Reserved)->DriverListHead, + pDriverListHead, DriverType, &ClassGuid, ContextDevice, @@ -6106,8 +6114,6 @@ SetupDiEnumDriverInfoW( SetLastError(ERROR_INVALID_HANDLE); else if (DriverType != SPDIT_CLASSDRIVER && DriverType != SPDIT_COMPATDRIVER) SetLastError(ERROR_INVALID_PARAMETER); - else if (DriverType == SPDIT_CLASSDRIVER && DeviceInfoData) - SetLastError(ERROR_INVALID_PARAMETER); else if (DriverType == SPDIT_COMPATDRIVER && !DeviceInfoData) SetLastError(ERROR_INVALID_PARAMETER); else if (DriverInfoData->cbSize != sizeof(SP_DRVINFO_DATA_V1_W) && DriverInfoData->cbSize != sizeof(SP_DRVINFO_DATA_V2_W)) @@ -6118,8 +6124,7 @@ SetupDiEnumDriverInfoW( PLIST_ENTRY ItemList; if (DeviceInfoData) devInfo = (struct DeviceInfoElement *)DeviceInfoData->Reserved; - if (DriverType == SPDIT_CLASSDRIVER || - (devInfo && devInfo->CreationFlags & DICD_INHERIT_CLASSDRVS)) + if (!devInfo || (devInfo->CreationFlags & DICD_INHERIT_CLASSDRVS)) { ListHead = &((struct DeviceInfoSet *)DeviceInfoSet)->DriverListHead; } diff --git a/reactos/lib/setupapi/queue.c b/reactos/lib/setupapi/queue.c index 6a66aa265e0..6c183ad22f0 100644 --- a/reactos/lib/setupapi/queue.c +++ b/reactos/lib/setupapi/queue.c @@ -1200,11 +1200,43 @@ BOOL WINAPI SetupScanFileQueueA( HSPFILEQ queue, DWORD flags, HWND window, /*********************************************************************** * SetupScanFileQueueW (SETUPAPI.@) */ -BOOL WINAPI SetupScanFileQueueW( HSPFILEQ queue, DWORD flags, HWND window, +BOOL WINAPI SetupScanFileQueueW( HSPFILEQ handle, DWORD flags, HWND window, PSP_FILE_CALLBACK_W callback, PVOID context, PDWORD result ) { - FIXME("stub\n"); - return FALSE; + struct file_queue *queue = handle; + struct file_op *op; + BOOL allnodesprocessed = FALSE; + FILEPATHS_W paths; + + paths.Source = paths.Target = NULL; + *result = FALSE; + + if ( flags & (SPQ_SCAN_FILE_PRESENCE | SPQ_SCAN_FILE_VALIDITY | SPQ_SCAN_USE_CALLBACKEX | SPQ_SCAN_INFORM_USER | SPQ_SCAN_PRUNE_COPY_QUEUE /*| SPQ_SCAN_USE_CALLBACK_SIGNERINFO | SPQ_SCAN_PRUNE_DELREN*/) ) + { + FIXME( "flags ignored 0x%lx\n", flags & (SPQ_SCAN_FILE_PRESENCE | SPQ_SCAN_FILE_VALIDITY | SPQ_SCAN_USE_CALLBACKEX | SPQ_SCAN_INFORM_USER | SPQ_SCAN_PRUNE_COPY_QUEUE /*| SPQ_SCAN_USE_CALLBACK_SIGNERINFO | SPQ_SCAN_PRUNE_DELREN*/) ); + } + + if (queue->copy_queue.count) + { + for (op = queue->copy_queue.head; op; op = op->next) + { + build_filepathsW( op, &paths ); + if (flags & SPQ_SCAN_USE_CALLBACK) + { + /* FIXME: sometimes set param 2 to SPQ_DELAYED_COPY */ + if (NO_ERROR != callback( context, SPFILENOTIFY_QUEUESCAN, (UINT)paths.Target, 0 )) + goto done; + } + } + } + + *result = TRUE; + allnodesprocessed = TRUE; + + done: + HeapFree( GetProcessHeap(), 0, (void *)paths.Source ); + HeapFree( GetProcessHeap(), 0, (void *)paths.Target ); + return allnodesprocessed; }