[USBSTOR] Register dumb IRP_MJ_SYSTEM_CONTROL handler.
authorVictor Perevertkin <victor@perevertkin.ru>
Mon, 10 Jun 2019 22:42:28 +0000 (01:42 +0300)
committerVictor Perevertkin <victor@perevertkin.ru>
Tue, 11 Jun 2019 01:39:43 +0000 (04:39 +0300)
This satisfies Driver Verifier

drivers/usb/usbstor/usbstor.c

index 99392f7..75dee31 100644 (file)
@@ -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;