[DEVMGR] Get rid of the unknown device class hack

Treat the unknown device class like any other device class.

CORE-17527
This commit is contained in:
Eric Kohl 2021-04-16 23:45:08 +02:00
parent 7d77ec28f7
commit 9e947e2b2b

View file

@ -351,23 +351,11 @@ CDeviceView::GetNextClass(
if (cr != CR_SUCCESS)
return false;
// Check if this is the unknown class
if (IsEqualGUID(*ClassGuid, GUID_DEVCLASS_UNKNOWN))
{
// Get device info for all devices
*hDevInfo = SetupDiGetClassDevsW(NULL,
NULL,
NULL,
DIGCF_ALLCLASSES);
}
else
{
// We only want the devices for this class
*hDevInfo = SetupDiGetClassDevsW(ClassGuid,
NULL,
NULL,
DIGCF_PRESENT);
}
// We only want the devices for this class
*hDevInfo = SetupDiGetClassDevsW(ClassGuid,
NULL,
NULL,
DIGCF_PRESENT);
return (hDevInfo != INVALID_HANDLE_VALUE);
}
@ -449,7 +437,6 @@ CDeviceView::ListDevicesByType()
bClassSuccess = GetNextClass(ClassIndex, &ClassGuid, &hDevInfo);
if (bClassSuccess)
{
bool bClassUnknown = false;
bool AddedParent = false;
INT DeviceIndex = 0;
bool MoreItems = false;
@ -462,10 +449,6 @@ CDeviceView::ListDevicesByType()
continue;
}
// Set a flag is this is the (special case) unknown class
if (IsEqualGUID(ClassGuid, GUID_DEVCLASS_UNKNOWN))
bClassUnknown = true;
// Check if this is a hidden class
if (IsEqualGUID(ClassGuid, GUID_DEVCLASS_LEGACYDRIVER) ||
IsEqualGUID(ClassGuid, GUID_DEVCLASS_VOLUME))
@ -494,18 +477,6 @@ CDeviceView::ListDevicesByType()
{
MoreItems = true;
// The unknown class handle contains all devices on the system,
// and we're just looking for the ones with a null GUID
if (bClassUnknown)
{
if (IsEqualGUID(DeviceInfoData.ClassGuid, GUID_NULL) == FALSE)
{
// This is a known device, we aren't interested in it
DeviceIndex++;
continue;
}
}
// Get the cached device node
DeviceNode = GetDeviceNode(DeviceInfoData.DevInst);
if (DeviceNode == nullptr)