[I8042PRT]

- 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
This commit is contained in:
Thomas Faber 2014-05-03 11:17:57 +00:00
parent 8eff9cd26a
commit 0896926c21
3 changed files with 31 additions and 23 deletions

View file

@ -23,6 +23,10 @@ _Dispatch_type_(IRP_MJ_DEVICE_CONTROL)
static DRIVER_DISPATCH i8042DeviceControl; static DRIVER_DISPATCH i8042DeviceControl;
_Dispatch_type_(IRP_MJ_INTERNAL_DEVICE_CONTROL) _Dispatch_type_(IRP_MJ_INTERNAL_DEVICE_CONTROL)
static DRIVER_DISPATCH i8042InternalDeviceControl; 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; DRIVER_INITIALIZE DriverEntry;
NTSTATUS NTAPI 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 NTSTATUS NTAPI
DriverEntry( DriverEntry(
IN PDRIVER_OBJECT DriverObject, IN PDRIVER_OBJECT DriverObject,
@ -531,6 +556,8 @@ DriverEntry(
DriverObject->MajorFunction[IRP_MJ_CLOSE] = i8042Close; DriverObject->MajorFunction[IRP_MJ_CLOSE] = i8042Close;
DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = i8042DeviceControl; DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = i8042DeviceControl;
DriverObject->MajorFunction[IRP_MJ_INTERNAL_DEVICE_CONTROL] = i8042InternalDeviceControl; 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; DriverObject->MajorFunction[IRP_MJ_PNP] = i8042Pnp;
return STATUS_SUCCESS; return STATUS_SUCCESS;

View file

@ -19,6 +19,7 @@
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
static KDEFERRED_ROUTINE i8042MouDpcRoutine; 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 * I'll just send the 'disable mouse port' command to the controller
* and say the mouse doesn't exist. * and say the mouse doesn't exist.
*/ */
static KDEFERRED_ROUTINE i8042DpcRoutineMouseTimeout;
static VOID NTAPI static VOID NTAPI
i8042DpcRoutineMouseTimeout( i8042DpcRoutineMouseTimeout(
IN PKDPC Dpc, IN PKDPC Dpc,

View 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, return ForwardIrpAndForget(DeviceObject, Irp);
sizeof(DEVICE_RELATIONS),
I8042PRT_TAG);
if (DeviceRelations)
{
DeviceRelations->Count = 0;
Information = (ULONG_PTR)DeviceRelations;
Status = STATUS_SUCCESS;
}
else
Status = STATUS_INSUFFICIENT_RESOURCES;
break;
} }
case RemovalRelations: case RemovalRelations:
{ {
@ -709,7 +696,6 @@ i8042Pnp(
default: default:
ERR_(I8042PRT, "IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / Unknown type 0x%lx\n", ERR_(I8042PRT, "IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / Unknown type 0x%lx\n",
Stack->Parameters.QueryDeviceRelations.Type); Stack->Parameters.QueryDeviceRelations.Type);
ASSERT(FALSE);
return ForwardIrpAndForget(DeviceObject, Irp); return ForwardIrpAndForget(DeviceObject, Irp);
} }
break; break;
@ -717,17 +703,12 @@ i8042Pnp(
case IRP_MN_FILTER_RESOURCE_REQUIREMENTS: /* (optional) 0x0d */ case IRP_MN_FILTER_RESOURCE_REQUIREMENTS: /* (optional) 0x0d */
{ {
TRACE_(I8042PRT, "IRP_MJ_PNP / IRP_MN_FILTER_RESOURCE_REQUIREMENTS\n"); TRACE_(I8042PRT, "IRP_MJ_PNP / IRP_MN_FILTER_RESOURCE_REQUIREMENTS\n");
/* Nothing to do */ return ForwardIrpAndForget(DeviceObject, Irp);
Status = Irp->IoStatus.Status;
break;
} }
case IRP_MN_QUERY_PNP_DEVICE_STATE: /* 0x14 */ case IRP_MN_QUERY_PNP_DEVICE_STATE: /* 0x14 */
{ {
TRACE_(I8042PRT, "IRP_MJ_PNP / IRP_MN_QUERY_PNP_DEVICE_STATE\n"); TRACE_(I8042PRT, "IRP_MJ_PNP / IRP_MN_QUERY_PNP_DEVICE_STATE\n");
/* Nothing much to tell */ return ForwardIrpAndForget(DeviceObject, Irp);
Information = 0;
Status = STATUS_SUCCESS;
break;
} }
default: default:
{ {