[PATCH 3/4] setupapi: Set the device class in SetupDiBuildDriverInfoList().

Zebediah Figura z.figura12 at gmail.com
Thu Nov 7 23:37:53 CST 2019


This matches Windows XP behaviour. In Vista and later this appears to be done
by UpdateDriverForPlugAndPlayDevices().

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 dlls/setupapi/devinst.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c
index f0d75f90b81..6de26b943f2 100644
--- a/dlls/setupapi/devinst.c
+++ b/dlls/setupapi/devinst.c
@@ -4545,6 +4545,20 @@ BOOL WINAPI SetupDiBuildDriverInfoList(HDEVINFO devinfo, SP_DEVINFO_DATA *device
         }
     }
 
+    if (device->driver_count)
+    {
+        WCHAR classname[MAX_CLASS_NAME_LEN], guidstr[39];
+        GUID class;
+
+        if (SetupDiGetINFClassW(device->drivers[0].inf_path, &class, classname, ARRAY_SIZE(classname), NULL))
+        {
+            device_data->ClassGuid = device->class = class;
+            SETUPDI_GuidToString(&class, guidstr);
+            RegSetValueExW(device->key, L"ClassGUID", 0, REG_SZ, (BYTE *)guidstr, sizeof(guidstr));
+            RegSetValueExW(device->key, L"Class", 0, REG_SZ, (BYTE *)classname, wcslen(classname) * sizeof(WCHAR));
+        }
+    }
+
     return TRUE;
 }
 
-- 
2.23.0




More information about the wine-devel mailing list