[MOUCLASS] Support IRP_MJ_READ on Port device objects

This commit is contained in:
Hervé Poussineau
2026-08-08 11:58:24 +02:00
parent 582b56ef1d
commit 40ae94de6a

View File

@@ -92,15 +92,11 @@ ClassRead(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
PCLASS_DEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension;
PCOMMON_DEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension;
PREAD_DATA ReadData;
TRACE_(CLASS_NAME, "IRP_MJ_READ\n");
ASSERT(DeviceExtension->Common.IsClassDO);
if (!((PCOMMON_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->IsClassDO)
return ForwardIrpAndForget(DeviceObject, Irp);
if (IoGetCurrentIrpStackLocation(Irp)->Parameters.Read.Length < sizeof(MOUSE_INPUT_DATA))
{
Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL;
@@ -110,7 +106,18 @@ ClassRead(
return STATUS_BUFFER_TOO_SMALL;
}
return HandleReadIrp(DeviceObject, DeviceExtension->ReadData, Irp);
if (DeviceExtension->IsClassDO)
{
ReadData = ((PCLASS_DEVICE_EXTENSION)DeviceExtension)->ReadData;
}
else
{
PPORT_DEVICE_EXTENSION Port = (PPORT_DEVICE_EXTENSION)DeviceExtension;
PCLASS_DEVICE_EXTENSION Class = (PCLASS_DEVICE_EXTENSION)Port->ClassDO->DeviceExtension;
ReadData = Class->ReadData;
}
return HandleReadIrp(DeviceObject, ReadData, Irp);
}
static NTSTATUS NTAPI