winebus: Fix DEVICE_RELATIONS content on device removal.
Signed-off-by: Piotr Caban <piotr@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
cc395391ed
commit
c3bfc1b726
|
@ -45,6 +45,7 @@ DEVICE_OBJECT *bus_create_hid_device(const WCHAR *busidW, WORD vid, WORD pid,
|
|||
WORD input, DWORD version, DWORD uid, const WCHAR *serialW, BOOL is_gamepad,
|
||||
const platform_vtbl *vtbl, DWORD platform_data_size) DECLSPEC_HIDDEN;
|
||||
DEVICE_OBJECT *bus_find_hid_device(const platform_vtbl *vtbl, void *platform_dev) DECLSPEC_HIDDEN;
|
||||
void bus_unlink_hid_device(DEVICE_OBJECT *device) DECLSPEC_HIDDEN;
|
||||
void bus_remove_hid_device(DEVICE_OBJECT *device) DECLSPEC_HIDDEN;
|
||||
void process_hid_report(DEVICE_OBJECT *device, BYTE *report, DWORD length) DECLSPEC_HIDDEN;
|
||||
DEVICE_OBJECT* bus_enumerate_hid_devices(const platform_vtbl *vtbl, enum_func function, void* context) DECLSPEC_HIDDEN;
|
||||
|
|
|
@ -368,6 +368,7 @@ static void handle_RemovalCallback(void *context, IOReturn result, void *sender,
|
|||
device = bus_find_hid_device(&iohid_vtbl, IOHIDDevice);
|
||||
if (device)
|
||||
{
|
||||
bus_unlink_hid_device(device);
|
||||
IoInvalidateDeviceRelations(bus_pdo, BusRelations);
|
||||
bus_remove_hid_device(device);
|
||||
}
|
||||
|
|
|
@ -899,6 +899,7 @@ static void try_remove_device(SDL_JoystickID id)
|
|||
sdl_controller = private->sdl_controller;
|
||||
sdl_haptic = private->sdl_haptic;
|
||||
|
||||
bus_unlink_hid_device(device);
|
||||
IoInvalidateDeviceRelations(bus_pdo, BusRelations);
|
||||
|
||||
bus_remove_hid_device(device);
|
||||
|
@ -988,6 +989,7 @@ static void try_add_device(unsigned int index)
|
|||
if (!rc)
|
||||
{
|
||||
ERR("Building report descriptor failed, removing device\n");
|
||||
bus_unlink_hid_device(device);
|
||||
bus_remove_hid_device(device);
|
||||
HeapFree(GetProcessHeap(), 0, serial);
|
||||
return;
|
||||
|
|
|
@ -1259,6 +1259,7 @@ static void try_add_device(struct udev_device *dev)
|
|||
ERR("Building report descriptor failed, removing device\n");
|
||||
close(fd);
|
||||
udev_device_unref(dev);
|
||||
bus_unlink_hid_device(device);
|
||||
bus_remove_hid_device(device);
|
||||
HeapFree(GetProcessHeap(), 0, serial);
|
||||
return;
|
||||
|
@ -1293,6 +1294,7 @@ static void try_remove_device(struct udev_device *dev)
|
|||
#endif
|
||||
if (!device) return;
|
||||
|
||||
bus_unlink_hid_device(device);
|
||||
IoInvalidateDeviceRelations(bus_pdo, BusRelations);
|
||||
|
||||
private = impl_from_DEVICE_OBJECT(device);
|
||||
|
|
|
@ -346,6 +346,16 @@ DEVICE_OBJECT* bus_enumerate_hid_devices(const platform_vtbl *vtbl, enum_func fu
|
|||
return ret;
|
||||
}
|
||||
|
||||
void bus_unlink_hid_device(DEVICE_OBJECT *device)
|
||||
{
|
||||
struct device_extension *ext = (struct device_extension *)device->DeviceExtension;
|
||||
struct pnp_device *pnp_device = ext->pnp_device;
|
||||
|
||||
EnterCriticalSection(&device_list_cs);
|
||||
list_remove(&pnp_device->entry);
|
||||
LeaveCriticalSection(&device_list_cs);
|
||||
}
|
||||
|
||||
void bus_remove_hid_device(DEVICE_OBJECT *device)
|
||||
{
|
||||
struct device_extension *ext = (struct device_extension *)device->DeviceExtension;
|
||||
|
@ -355,10 +365,6 @@ void bus_remove_hid_device(DEVICE_OBJECT *device)
|
|||
|
||||
TRACE("(%p)\n", device);
|
||||
|
||||
EnterCriticalSection(&device_list_cs);
|
||||
list_remove(&pnp_device->entry);
|
||||
LeaveCriticalSection(&device_list_cs);
|
||||
|
||||
/* Cancel pending IRPs */
|
||||
EnterCriticalSection(&ext->report_cs);
|
||||
while ((entry = RemoveHeadList(&ext->irp_queue)) != &ext->irp_queue)
|
||||
|
|
Loading…
Reference in New Issue