setupapi: Save device description to registry when creating a device.

This commit is contained in:
Juan Lang 2007-09-20 09:13:00 -07:00 committed by Alexandre Julliard
parent e144979697
commit 8985a62a34
1 changed files with 13 additions and 6 deletions

View File

@ -997,15 +997,22 @@ BOOL WINAPI SetupDiCreateDeviceInfoW(
ret = SETUPDI_AddDeviceToSet(set, ClassGuid, 0 /* FIXME: DevInst */,
instanceId, &dev);
if (ret && DeviceInfoData)
if (ret)
{
if (DeviceInfoData->cbSize != sizeof(SP_DEVINFO_DATA))
if (DeviceDescription)
SetupDiSetDeviceRegistryPropertyW(DeviceInfoSet,
dev, SPDRP_DEVICEDESC, (const BYTE *)DeviceDescription,
lstrlenW(DeviceDescription) * sizeof(WCHAR));
if (DeviceInfoData)
{
SetLastError(ERROR_INVALID_USER_BUFFER);
ret = FALSE;
if (DeviceInfoData->cbSize != sizeof(SP_DEVINFO_DATA))
{
SetLastError(ERROR_INVALID_USER_BUFFER);
ret = FALSE;
}
else
memcpy(DeviceInfoData, dev, sizeof(SP_DEVINFO_DATA));
}
else
memcpy(DeviceInfoData, dev, sizeof(SP_DEVINFO_DATA));
}
}
if (allocatedInstanceId)