https://git.reactos.org/?p=reactos.git;a=commitdiff;h=04409942d6d787357e7453193f8f93ba4694aac7

commit 04409942d6d787357e7453193f8f93ba4694aac7
Author:     Victor Perevertkin <[email protected]>
AuthorDate: Tue Jun 11 01:42:28 2019 +0300
Commit:     Victor Perevertkin <[email protected]>
CommitDate: Tue Jun 11 04:39:43 2019 +0300

    [USBSTOR] Register dumb IRP_MJ_SYSTEM_CONTROL handler.
    This satisfies Driver Verifier
---
 drivers/usb/usbstor/usbstor.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/drivers/usb/usbstor/usbstor.c b/drivers/usb/usbstor/usbstor.c
index 99392f7e092..75dee316052 100644
--- a/drivers/usb/usbstor/usbstor.c
+++ b/drivers/usb/usbstor/usbstor.c
@@ -138,6 +138,25 @@ USBSTOR_DispatchPnp(
     }
 }
 
+NTSTATUS
+NTAPI
+USBSTOR_DispatchSystemControl(
+    IN PDEVICE_OBJECT DeviceObject,
+    IN PIRP Irp)
+{
+    PUSBSTOR_COMMON_DEVICE_EXTENSION DeviceExtension = 
(PUSBSTOR_COMMON_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
+    IoSkipCurrentIrpStackLocation(Irp);
+
+    if (DeviceExtension->IsFDO)
+    {
+        return 
IoCallDriver(((PFDO_DEVICE_EXTENSION)DeviceExtension)->LowerDeviceObject, Irp);
+    }
+    else
+    {
+        return 
IoCallDriver(((PPDO_DEVICE_EXTENSION)DeviceExtension)->LowerDeviceObject, Irp);
+    }
+}
+
 NTSTATUS
 NTAPI
 USBSTOR_DispatchPower(
@@ -183,6 +202,7 @@ DriverEntry(
     DriverObject->MajorFunction[IRP_MJ_WRITE] = USBSTOR_DispatchReadWrite;
     DriverObject->MajorFunction[IRP_MJ_SCSI] = USBSTOR_DispatchScsi;
     DriverObject->MajorFunction[IRP_MJ_PNP] = USBSTOR_DispatchPnp;
+    DriverObject->MajorFunction[IRP_MJ_SYSTEM_CONTROL] = 
USBSTOR_DispatchSystemControl;
     DriverObject->MajorFunction[IRP_MJ_POWER] = USBSTOR_DispatchPower;
 
     return STATUS_SUCCESS;

Reply via email to