mirror of
https://github.com/reactos/reactos.git
synced 2025-07-23 17:43:52 +00:00
[SETUPAPI] Correctly enumerate non-installed devices in SetupDiGetClassDevsExW
Always try to read the correct device GUID from registry, even if GUID filter is disabled. CORE-17527
This commit is contained in:
parent
f9df7af28a
commit
e044df8736
1 changed files with 24 additions and 27 deletions
|
@ -179,38 +179,35 @@ SETUP_CreateDevicesList(
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Retrieve GUID of this device */
|
/* Retrieve GUID of this device */
|
||||||
if (Class)
|
ClassGuidBufferSize = sizeof(ClassGuidBuffer);
|
||||||
|
cr = CM_Get_DevNode_Registry_Property_ExW(dnDevInst,
|
||||||
|
CM_DRP_CLASSGUID,
|
||||||
|
NULL,
|
||||||
|
ClassGuidBuffer,
|
||||||
|
&ClassGuidBufferSize,
|
||||||
|
0,
|
||||||
|
list->hMachine);
|
||||||
|
if (cr == CR_SUCCESS)
|
||||||
{
|
{
|
||||||
ClassGuidBufferSize = sizeof(ClassGuidBuffer);
|
ClassGuidBuffer[MAX_GUID_STRING_LEN - 2] = '\0'; /* Replace the } by a NULL character */
|
||||||
cr = CM_Get_DevNode_Registry_Property_ExW(dnDevInst,
|
if (UuidFromStringW(&ClassGuidBuffer[1], &ClassGuid) != RPC_S_OK)
|
||||||
CM_DRP_CLASSGUID,
|
|
||||||
NULL,
|
|
||||||
ClassGuidBuffer,
|
|
||||||
&ClassGuidBufferSize,
|
|
||||||
0,
|
|
||||||
list->hMachine);
|
|
||||||
if (cr == CR_SUCCESS)
|
|
||||||
{
|
{
|
||||||
ClassGuidBuffer[MAX_GUID_STRING_LEN - 2] = '\0'; /* Replace the } by a NULL character */
|
/* Bad GUID, skip the entry */
|
||||||
if (UuidFromStringW(&ClassGuidBuffer[1], &ClassGuid) != RPC_S_OK)
|
ERR("Invalid ClassGUID '%S' for device %S\n", ClassGuidBuffer, InstancePath);
|
||||||
{
|
|
||||||
/* Bad GUID, skip the entry */
|
|
||||||
ERR("Invalid ClassGUID '%S' for device %S\n", ClassGuidBuffer, InstancePath);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TRACE("Using default class GUID_NULL for device %S\n", InstancePath);
|
|
||||||
memcpy(&ClassGuid, &GUID_NULL, sizeof(GUID));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!IsEqualIID(&ClassGuid, Class))
|
|
||||||
{
|
|
||||||
TRACE("Skipping %S due to wrong class GUID\n", InstancePath);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TRACE("Using default class GUID_NULL for device %S\n", InstancePath);
|
||||||
|
memcpy(&ClassGuid, &GUID_NULL, sizeof(GUID));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Class && !IsEqualIID(&ClassGuid, Class))
|
||||||
|
{
|
||||||
|
TRACE("Skipping %S due to wrong class GUID\n", InstancePath);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
/* Good! Create a device info element */
|
/* Good! Create a device info element */
|
||||||
if (!CreateDeviceInfo(list, InstancePath, &ClassGuid, &deviceInfo))
|
if (!CreateDeviceInfo(list, InstancePath, &ClassGuid, &deviceInfo))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue