winebus.sys: Handle IRP_MN_SURPRISE_REMOVAL and set removed flag.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Rémi Bernon 2021-06-30 10:19:09 +02:00 committed by Alexandre Julliard
parent 25155186c6
commit 0f48202335
1 changed files with 7 additions and 6 deletions

View File

@ -372,10 +372,6 @@ void bus_unlink_hid_device(DEVICE_OBJECT *device)
EnterCriticalSection(&device_list_cs);
list_remove(&pnp_device->entry);
LeaveCriticalSection(&device_list_cs);
EnterCriticalSection(&ext->cs);
ext->removed = TRUE;
LeaveCriticalSection(&ext->cs);
}
void bus_remove_hid_device(DEVICE_OBJECT *device)
@ -698,13 +694,18 @@ static NTSTATUS pdo_pnp_dispatch(DEVICE_OBJECT *device, IRP *irp)
status = STATUS_SUCCESS;
break;
case IRP_MN_SURPRISE_REMOVAL:
EnterCriticalSection(&ext->cs);
remove_pending_irps(device);
ext->removed = TRUE;
LeaveCriticalSection(&ext->cs);
break;
case IRP_MN_REMOVE_DEVICE:
{
struct pnp_device *pnp_device = ext->pnp_device;
EnterCriticalSection(&ext->cs);
remove_pending_irps(device);
LeaveCriticalSection(&ext->cs);
ext->vtbl->free_device(device);