From 77421fd4965dcabc7e5c25fce80e19c0065e6d81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Poussineau?= Date: Tue, 15 Nov 2005 14:29:46 +0000 Subject: [PATCH] Try to transform the ClassGUID string to a GUID only when the string exists in registry. Otherwise, set it to GUID_NULL svn path=/trunk/; revision=19246 --- reactos/lib/setupapi/devinst.c | 15 +++++++++------ reactos/lib/setupapi/setupapi_private.h | 3 ++- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/reactos/lib/setupapi/devinst.c b/reactos/lib/setupapi/devinst.c index 87decd322b4..3c081ca77bc 100644 --- a/reactos/lib/setupapi/devinst.c +++ b/reactos/lib/setupapi/devinst.c @@ -1185,6 +1185,8 @@ static LONG SETUP_CreateDevListFromEnumerator( if (pClassGuid) /* Skip this bad entry as we can't verify it */ continue; + /* Set a default GUID for this device */ + memcpy(&KeyGuid, &GUID_NULL, sizeof(GUID)); } else if (rc != ERROR_SUCCESS) { @@ -1196,13 +1198,14 @@ static LONG SETUP_CreateDevListFromEnumerator( RegCloseKey(hDeviceIdKey); return ERROR_GEN_FAILURE; } - - KeyBuffer[37] = '\0'; /* Replace the } by a NULL character */ - if (UuidFromStringW(&KeyBuffer[1], &KeyGuid) != RPC_S_OK) + else { - RegCloseKey(hDeviceIdKey); - return GetLastError(); + KeyBuffer[37] = '\0'; /* Replace the } by a NULL character */ + if (UuidFromStringW(&KeyBuffer[1], &KeyGuid) != RPC_S_OK) + /* Bad GUID, skip the entry */ + continue; } + if (pClassGuid && !IsEqualIID(&KeyGuid, pClassGuid)) { /* Skip this entry as it is not the right device class */ @@ -1259,7 +1262,7 @@ static LONG SETUP_CreateDevList( return rc; /* If enumerator is provided, call directly SETUP_CreateDevListFromEnumerator. - * Else, enumerate all enumerators all call SETUP_CreateDevListFromEnumerator + * Else, enumerate all enumerators and call SETUP_CreateDevListFromEnumerator * for each one. */ if (Enumerator) diff --git a/reactos/lib/setupapi/setupapi_private.h b/reactos/lib/setupapi/setupapi_private.h index 960cf6ca76d..dc8edf2c281 100644 --- a/reactos/lib/setupapi/setupapi_private.h +++ b/reactos/lib/setupapi/setupapi_private.h @@ -103,7 +103,8 @@ struct DeviceInfoElement /* Element of DeviceInfoSet.ListHead */ * String which identifies the device. Can be NULL. If not NULL, * points into the Data field at the end of the structure * - ClassGuid - * Identifies the class of this device. FIXME: can it be GUID_NULL? + * Identifies the class of this device. It is GUID_NULL if the + * device has not been installed * - CreationFlags * Is a combination of: * - DICD_GENERATE_ID