setupapi: Don't require caller to pass a SP_DEVINFO_DATA pointer to SETUPDI_AddDeviceToSet.
This commit is contained in:
parent
22724c2c8b
commit
0d39a07eca
|
@ -518,16 +518,18 @@ static BOOL SETUPDI_AddDeviceToSet(struct DeviceInfoSet *set,
|
||||||
if (set->devices)
|
if (set->devices)
|
||||||
{
|
{
|
||||||
WCHAR classGuidStr[39];
|
WCHAR classGuidStr[39];
|
||||||
|
SP_DEVINFO_DATA *DeviceInfoData = &set->devices[set->cDevices++];
|
||||||
|
|
||||||
*dev = &set->devices[set->cDevices++];
|
DeviceInfoData->cbSize = sizeof(SP_DEVINFO_DATA);
|
||||||
(*dev)->cbSize = sizeof(SP_DEVINFO_DATA);
|
memcpy(&DeviceInfoData->ClassGuid, guid, sizeof(GUID));
|
||||||
memcpy(&(*dev)->ClassGuid, guid, sizeof(GUID));
|
DeviceInfoData->DevInst = devInst;
|
||||||
(*dev)->DevInst = devInst;
|
DeviceInfoData->Reserved = (ULONG_PTR)devInfo;
|
||||||
(*dev)->Reserved = (ULONG_PTR)devInfo;
|
|
||||||
SETUPDI_GuidToString(guid, classGuidStr);
|
SETUPDI_GuidToString(guid, classGuidStr);
|
||||||
SetupDiSetDeviceRegistryPropertyW((HDEVINFO)set,
|
SetupDiSetDeviceRegistryPropertyW((HDEVINFO)set,
|
||||||
*dev, SPDRP_CLASSGUID, (const BYTE *)classGuidStr,
|
DeviceInfoData, SPDRP_CLASSGUID, (const BYTE *)classGuidStr,
|
||||||
lstrlenW(classGuidStr) * sizeof(WCHAR));
|
lstrlenW(classGuidStr) * sizeof(WCHAR));
|
||||||
|
if (dev)
|
||||||
|
*dev = DeviceInfoData;
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2090,12 +2092,10 @@ static void SETUPDI_EnumerateMatchingDevices(HDEVINFO DeviceInfoSet,
|
||||||
* sizeof(WCHAR));
|
* sizeof(WCHAR));
|
||||||
if (instanceId)
|
if (instanceId)
|
||||||
{
|
{
|
||||||
SP_DEVINFO_DATA *dev;
|
|
||||||
|
|
||||||
sprintfW(instanceId, fmt, parent, subKeyName);
|
sprintfW(instanceId, fmt, parent, subKeyName);
|
||||||
SETUPDI_AddDeviceToSet(set, &deviceClass,
|
SETUPDI_AddDeviceToSet(set, &deviceClass,
|
||||||
0 /* FIXME: DevInst */, instanceId,
|
0 /* FIXME: DevInst */, instanceId,
|
||||||
FALSE, &dev);
|
FALSE, NULL);
|
||||||
HeapFree(GetProcessHeap(), 0, instanceId);
|
HeapFree(GetProcessHeap(), 0, instanceId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue