[I8042PRT]
authorThomas Faber <thomas.faber@reactos.org>
Sat, 3 May 2014 11:17:57 +0000 (11:17 +0000)
committerThomas Faber <thomas.faber@reactos.org>
Sat, 3 May 2014 11:17:57 +0000 (11:17 +0000)
- Do not prematurely complete IRP_MN_FILTER_RESOURCE_REQUIREMENTS or IRP_MN_QUERY_PNP_DEVICE_STATE
- Do not handle IRP_MN_QUERY_DEVICE_RELATIONS.BusRelations. We're not the bus driver!
- Correctly stub the (mandatory!) dispatch functions for IRP_MJ_POWER and IRP_MJ_SYSTEM_CONTROL
CORE-8142 #resolve

svn path=/trunk/; revision=63127

reactos/drivers/input/i8042prt/i8042prt.c
reactos/drivers/input/i8042prt/mouse.c
reactos/drivers/input/i8042prt/pnp.c

index 1fc55e8..e3b0bf7 100644 (file)
@@ -23,6 +23,10 @@ _Dispatch_type_(IRP_MJ_DEVICE_CONTROL)
 static DRIVER_DISPATCH i8042DeviceControl;
 _Dispatch_type_(IRP_MJ_INTERNAL_DEVICE_CONTROL)
 static DRIVER_DISPATCH i8042InternalDeviceControl;
 static DRIVER_DISPATCH i8042DeviceControl;
 _Dispatch_type_(IRP_MJ_INTERNAL_DEVICE_CONTROL)
 static DRIVER_DISPATCH i8042InternalDeviceControl;
+_Dispatch_type_(IRP_MJ_SYSTEM_CONTROL)
+static DRIVER_DISPATCH i8042SystemControl;
+_Dispatch_type_(IRP_MJ_POWER)
+static DRIVER_DISPATCH i8042Power;
 DRIVER_INITIALIZE DriverEntry;
 
 NTSTATUS NTAPI
 DRIVER_INITIALIZE DriverEntry;
 
 NTSTATUS NTAPI
@@ -468,6 +472,27 @@ i8042InternalDeviceControl(
        return Status;
 }
 
        return Status;
 }
 
+static NTSTATUS NTAPI
+i8042Power(
+       IN PDEVICE_OBJECT DeviceObject,
+       IN PIRP Irp)
+{
+       PFDO_DEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension;
+       PDEVICE_OBJECT LowerDevice = DeviceExtension->LowerDevice;
+
+       PoStartNextPowerIrp(Irp);
+       IoSkipCurrentIrpStackLocation(Irp);
+       return PoCallDriver(LowerDevice, Irp);
+}
+
+static NTSTATUS NTAPI
+i8042SystemControl(
+       IN PDEVICE_OBJECT DeviceObject,
+       IN PIRP Irp)
+{
+       return ForwardIrpAndForget(DeviceObject, Irp);
+}
+
 NTSTATUS NTAPI
 DriverEntry(
        IN PDRIVER_OBJECT DriverObject,
 NTSTATUS NTAPI
 DriverEntry(
        IN PDRIVER_OBJECT DriverObject,
@@ -531,6 +556,8 @@ DriverEntry(
        DriverObject->MajorFunction[IRP_MJ_CLOSE]   = i8042Close;
        DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = i8042DeviceControl;
        DriverObject->MajorFunction[IRP_MJ_INTERNAL_DEVICE_CONTROL] = i8042InternalDeviceControl;
        DriverObject->MajorFunction[IRP_MJ_CLOSE]   = i8042Close;
        DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = i8042DeviceControl;
        DriverObject->MajorFunction[IRP_MJ_INTERNAL_DEVICE_CONTROL] = i8042InternalDeviceControl;
+       DriverObject->MajorFunction[IRP_MJ_POWER]   = i8042Power;
+       DriverObject->MajorFunction[IRP_MJ_SYSTEM_CONTROL] = i8042SystemControl;
        DriverObject->MajorFunction[IRP_MJ_PNP]     = i8042Pnp;
 
        return STATUS_SUCCESS;
        DriverObject->MajorFunction[IRP_MJ_PNP]     = i8042Pnp;
 
        return STATUS_SUCCESS;
index c12a0e9..966b080 100644 (file)
@@ -19,6 +19,7 @@
 /* FUNCTIONS *****************************************************************/
 
 static KDEFERRED_ROUTINE i8042MouDpcRoutine;
 /* FUNCTIONS *****************************************************************/
 
 static KDEFERRED_ROUTINE i8042MouDpcRoutine;
+static KDEFERRED_ROUTINE i8042DpcRoutineMouseTimeout;
 
 /*
  * These functions are callbacks for filter driver custom interrupt
 
 /*
  * These functions are callbacks for filter driver custom interrupt
@@ -346,7 +347,6 @@ i8042MouDpcRoutine(
  * I'll just send the 'disable mouse port' command to the controller
  * and say the mouse doesn't exist.
  */
  * I'll just send the 'disable mouse port' command to the controller
  * and say the mouse doesn't exist.
  */
-static KDEFERRED_ROUTINE i8042DpcRoutineMouseTimeout;
 static VOID NTAPI
 i8042DpcRoutineMouseTimeout(
        IN PKDPC Dpc,
 static VOID NTAPI
 i8042DpcRoutineMouseTimeout(
        IN PKDPC Dpc,
index f1132ba..b0c67ec 100644 (file)
@@ -685,21 +685,8 @@ i8042Pnp(
             {
                 case BusRelations:
                 {
             {
                 case BusRelations:
                 {
-                    PDEVICE_RELATIONS DeviceRelations;
-
                     TRACE_(I8042PRT, "IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / BusRelations\n");
                     TRACE_(I8042PRT, "IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / BusRelations\n");
-                    DeviceRelations = ExAllocatePoolWithTag(PagedPool,
-                                                            sizeof(DEVICE_RELATIONS),
-                                                            I8042PRT_TAG);
-                    if (DeviceRelations)
-                    {
-                        DeviceRelations->Count = 0;
-                        Information = (ULONG_PTR)DeviceRelations;
-                        Status = STATUS_SUCCESS;
-                    }
-                    else
-                        Status = STATUS_INSUFFICIENT_RESOURCES;
-                    break;
+                    return ForwardIrpAndForget(DeviceObject, Irp);
                 }
                 case RemovalRelations:
                 {
                 }
                 case RemovalRelations:
                 {
@@ -709,7 +696,6 @@ i8042Pnp(
                 default:
                     ERR_(I8042PRT, "IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / Unknown type 0x%lx\n",
                         Stack->Parameters.QueryDeviceRelations.Type);
                 default:
                     ERR_(I8042PRT, "IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / Unknown type 0x%lx\n",
                         Stack->Parameters.QueryDeviceRelations.Type);
-                    ASSERT(FALSE);
                     return ForwardIrpAndForget(DeviceObject, Irp);
             }
             break;
                     return ForwardIrpAndForget(DeviceObject, Irp);
             }
             break;
@@ -717,17 +703,12 @@ i8042Pnp(
         case IRP_MN_FILTER_RESOURCE_REQUIREMENTS: /* (optional) 0x0d */
         {
             TRACE_(I8042PRT, "IRP_MJ_PNP / IRP_MN_FILTER_RESOURCE_REQUIREMENTS\n");
         case IRP_MN_FILTER_RESOURCE_REQUIREMENTS: /* (optional) 0x0d */
         {
             TRACE_(I8042PRT, "IRP_MJ_PNP / IRP_MN_FILTER_RESOURCE_REQUIREMENTS\n");
-            /* Nothing to do */
-            Status = Irp->IoStatus.Status;
-            break;
+            return ForwardIrpAndForget(DeviceObject, Irp);
         }
         case IRP_MN_QUERY_PNP_DEVICE_STATE: /* 0x14 */
         {
             TRACE_(I8042PRT, "IRP_MJ_PNP / IRP_MN_QUERY_PNP_DEVICE_STATE\n");
         }
         case IRP_MN_QUERY_PNP_DEVICE_STATE: /* 0x14 */
         {
             TRACE_(I8042PRT, "IRP_MJ_PNP / IRP_MN_QUERY_PNP_DEVICE_STATE\n");
-            /* Nothing much to tell */
-            Information = 0;
-            Status = STATUS_SUCCESS;
-            break;
+            return ForwardIrpAndForget(DeviceObject, Irp);
         }
         default:
         {
         }
         default:
         {