From bf79d6e9425b1587aaa542c31912f5f6a574cd64 Mon Sep 17 00:00:00 2001 From: Dmitry Fleytman Date: Thu, 1 Sep 2016 10:36:48 +0300 Subject: [PATCH] ControlDevice: Fix removal of redirection on hub unplug On unplug of USB hub that contains a redirected device, removal of redirection is started when redirected device PDO is still present in UsbDk device lists. In this case UsbDk will try to send reset IOCTL to this device and system will return STATUS_NO_SUCH_DEVICE error code. This commit changes behavior of redirection removal logic in a way that it will not interrupt removal process when such an error is returned by reset. Signed-off-by: Dmitry Fleytman --- UsbDk/ControlDevice.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/UsbDk/ControlDevice.cpp b/UsbDk/ControlDevice.cpp index e86bea4..a7c4d73 100644 --- a/UsbDk/ControlDevice.cpp +++ b/UsbDk/ControlDevice.cpp @@ -373,7 +373,7 @@ NTSTATUS CUsbDkControlDevice::ResetUsbDevice(const USB_DK_DEVICE_ID &DeviceID) PDEVICE_OBJECT PDO = GetPDOByDeviceID(DeviceID); if (PDO == nullptr) { - return STATUS_NOT_FOUND; + return STATUS_NO_SUCH_DEVICE; } CWdmUsbDeviceAccess pdoAccess(PDO); @@ -941,7 +941,7 @@ NTSTATUS CUsbDkControlDevice::RemoveRedirect(const USB_DK_DEVICE_ID &DeviceId) return STATUS_DEVICE_NOT_CONNECTED; } } - else if (res != STATUS_NOT_FOUND) + else if (res != STATUS_NO_SUCH_DEVICE) { TraceEvents(TRACE_LEVEL_ERROR, TRACE_CONTROLDEVICE, "%!FUNC! Usb device reset failed."); return res;