winebus.sys: Stop device report threads to avoid crash on driver unload.
Signed-off-by: Piotr Caban <piotr@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
90fa9967bc
commit
4b3437907b
|
@ -1478,6 +1478,12 @@ static DWORD CALLBACK deviceloop_thread(void *args)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int device_unload(DEVICE_OBJECT *device, void *context)
|
||||
{
|
||||
try_remove_device(impl_from_DEVICE_OBJECT(device)->udev_device);
|
||||
return 1;
|
||||
}
|
||||
|
||||
void udev_driver_unload( void )
|
||||
{
|
||||
TRACE("Unload Driver\n");
|
||||
|
@ -1487,6 +1493,9 @@ void udev_driver_unload( void )
|
|||
close(deviceloop_control[0]);
|
||||
close(deviceloop_control[1]);
|
||||
CloseHandle(deviceloop_handle);
|
||||
|
||||
bus_enumerate_hid_devices(&hidraw_vtbl, device_unload, NULL);
|
||||
bus_enumerate_hid_devices(&lnxev_vtbl, device_unload, NULL);
|
||||
}
|
||||
|
||||
NTSTATUS udev_driver_init(void)
|
||||
|
|
|
@ -329,17 +329,21 @@ DEVICE_OBJECT *bus_find_hid_device(const platform_vtbl *vtbl, void *platform_dev
|
|||
|
||||
DEVICE_OBJECT* bus_enumerate_hid_devices(const platform_vtbl *vtbl, enum_func function, void* context)
|
||||
{
|
||||
struct pnp_device *dev;
|
||||
struct pnp_device *dev, *dev_next;
|
||||
DEVICE_OBJECT *ret = NULL;
|
||||
int cont;
|
||||
|
||||
TRACE("(%p)\n", vtbl);
|
||||
|
||||
EnterCriticalSection(&device_list_cs);
|
||||
LIST_FOR_EACH_ENTRY(dev, &pnp_devset, struct pnp_device, entry)
|
||||
LIST_FOR_EACH_ENTRY_SAFE(dev, dev_next, &pnp_devset, struct pnp_device, entry)
|
||||
{
|
||||
struct device_extension *ext = (struct device_extension *)dev->device->DeviceExtension;
|
||||
if (ext->vtbl != vtbl) continue;
|
||||
if (function(dev->device, context) == 0)
|
||||
LeaveCriticalSection(&device_list_cs);
|
||||
cont = function(dev->device, context);
|
||||
EnterCriticalSection(&device_list_cs);
|
||||
if (!cont)
|
||||
{
|
||||
ret = dev->device;
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue