From 7d152715ef69ba2dd9945466f04cc5e93c2e86b2 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Thu, 7 Nov 2019 23:37:53 -0600 Subject: [PATCH] setupapi: Set the device class in SetupDiBuildDriverInfoList(). This matches Windows XP behaviour. In Vista and later this appears to be done by UpdateDriverForPlugAndPlayDevices(). Signed-off-by: Zebediah Figura Signed-off-by: Alexandre Julliard --- 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; }