From 0b9d1d9ffbec57fa0642d33c06a4ff6a5bf54f8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 1 Jul 2021 09:51:24 +0200 Subject: [PATCH] wineusb.sys: Return STATUS_DELETE_PENDING when device is removed. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: RĂ©mi Bernon Signed-off-by: Zebediah Figura Signed-off-by: Alexandre Julliard --- dlls/wineusb.sys/wineusb.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/dlls/wineusb.sys/wineusb.c b/dlls/wineusb.sys/wineusb.c index a72095409ff..fae297915fc 100644 --- a/dlls/wineusb.sys/wineusb.c +++ b/dlls/wineusb.sys/wineusb.c @@ -726,9 +726,21 @@ static NTSTATUS WINAPI driver_internal_ioctl(DEVICE_OBJECT *device_obj, IRP *irp ULONG code = stack->Parameters.DeviceIoControl.IoControlCode; struct usb_device *device = device_obj->DeviceExtension; NTSTATUS status = STATUS_NOT_IMPLEMENTED; + BOOL removed; TRACE("device_obj %p, irp %p, code %#x.\n", device_obj, irp, code); + EnterCriticalSection(&wineusb_cs); + removed = device->removed; + LeaveCriticalSection(&wineusb_cs); + + if (removed) + { + irp->IoStatus.Status = STATUS_DELETE_PENDING; + IoCompleteRequest(irp, IO_NO_INCREMENT); + return STATUS_DELETE_PENDING; + } + switch (code) { case IOCTL_INTERNAL_USB_SUBMIT_URB: