From 0d39a07ecaa35f06689cd658b852562621f708ee Mon Sep 17 00:00:00 2001 From: Juan Lang Date: Thu, 11 Oct 2007 13:25:08 -0700 Subject: [PATCH] setupapi: Don't require caller to pass a SP_DEVINFO_DATA pointer to SETUPDI_AddDeviceToSet. --- dlls/setupapi/devinst.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c index d549562e98a..a25bc29626b 100644 --- a/dlls/setupapi/devinst.c +++ b/dlls/setupapi/devinst.c @@ -518,16 +518,18 @@ static BOOL SETUPDI_AddDeviceToSet(struct DeviceInfoSet *set, if (set->devices) { WCHAR classGuidStr[39]; + SP_DEVINFO_DATA *DeviceInfoData = &set->devices[set->cDevices++]; - *dev = &set->devices[set->cDevices++]; - (*dev)->cbSize = sizeof(SP_DEVINFO_DATA); - memcpy(&(*dev)->ClassGuid, guid, sizeof(GUID)); - (*dev)->DevInst = devInst; - (*dev)->Reserved = (ULONG_PTR)devInfo; + DeviceInfoData->cbSize = sizeof(SP_DEVINFO_DATA); + memcpy(&DeviceInfoData->ClassGuid, guid, sizeof(GUID)); + DeviceInfoData->DevInst = devInst; + DeviceInfoData->Reserved = (ULONG_PTR)devInfo; SETUPDI_GuidToString(guid, classGuidStr); SetupDiSetDeviceRegistryPropertyW((HDEVINFO)set, - *dev, SPDRP_CLASSGUID, (const BYTE *)classGuidStr, + DeviceInfoData, SPDRP_CLASSGUID, (const BYTE *)classGuidStr, lstrlenW(classGuidStr) * sizeof(WCHAR)); + if (dev) + *dev = DeviceInfoData; ret = TRUE; } else @@ -2090,12 +2092,10 @@ static void SETUPDI_EnumerateMatchingDevices(HDEVINFO DeviceInfoSet, * sizeof(WCHAR)); if (instanceId) { - SP_DEVINFO_DATA *dev; - sprintfW(instanceId, fmt, parent, subKeyName); SETUPDI_AddDeviceToSet(set, &deviceClass, 0 /* FIXME: DevInst */, instanceId, - FALSE, &dev); + FALSE, NULL); HeapFree(GetProcessHeap(), 0, instanceId); } }