hidclass.sys: Handle create existent device failure.
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com> Signed-off-by: Aric Stewart <aric@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
682292f0f7
commit
56b509a84a
|
@ -90,26 +90,24 @@ NTSTATUS HID_LinkDevice(DEVICE_OBJECT *device)
|
||||||
|
|
||||||
RtlInitUnicodeString( &nameW, ext->device_name);
|
RtlInitUnicodeString( &nameW, ext->device_name);
|
||||||
|
|
||||||
devinfo = SetupDiGetClassDevsW(&GUID_DEVCLASS_HIDCLASS, NULL, NULL, DIGCF_DEVICEINTERFACE);
|
devinfo = SetupDiCreateDeviceInfoList(&GUID_DEVCLASS_HIDCLASS, NULL);
|
||||||
if (!devinfo)
|
if (devinfo == INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
FIXME( "failed to get ClassDevs %x\n", GetLastError());
|
FIXME( "failed to get ClassDevs %x\n", GetLastError());
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
Data.cbSize = sizeof(Data);
|
Data.cbSize = sizeof(Data);
|
||||||
if (!SetupDiCreateDeviceInfoW(devinfo, ext->instance_id, &GUID_DEVCLASS_HIDCLASS, NULL, NULL, DICD_INHERIT_CLASSDRVS, &Data))
|
if (SetupDiCreateDeviceInfoW(devinfo, ext->instance_id, &GUID_DEVCLASS_HIDCLASS, NULL, NULL, DICD_INHERIT_CLASSDRVS, &Data))
|
||||||
{
|
{
|
||||||
if (GetLastError() == ERROR_DEVINST_ALREADY_EXISTS)
|
if (!SetupDiRegisterDeviceInfo(devinfo, &Data, 0, NULL, NULL, NULL))
|
||||||
{
|
{
|
||||||
SetupDiDestroyDeviceInfoList(devinfo);
|
FIXME( "failed to register device info %x\n", GetLastError());
|
||||||
return STATUS_SUCCESS;
|
goto error;
|
||||||
}
|
}
|
||||||
FIXME( "failed to Create Device Info %x\n", GetLastError());
|
|
||||||
goto error;
|
|
||||||
}
|
}
|
||||||
if (!SetupDiRegisterDeviceInfo( devinfo, &Data, 0, NULL, NULL, NULL ))
|
else if (GetLastError() != ERROR_DEVINST_ALREADY_EXISTS)
|
||||||
{
|
{
|
||||||
FIXME( "failed to Register Device Info %x\n", GetLastError());
|
FIXME( "failed to create device info %x\n", GetLastError());
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
SetupDiDestroyDeviceInfoList(devinfo);
|
SetupDiDestroyDeviceInfoList(devinfo);
|
||||||
|
|
Loading…
Reference in New Issue