From 40ae94de6a4f926e3abf4637c77822aec1e3b5ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Poussineau?= Date: Sat, 8 Aug 2026 11:58:24 +0200 Subject: [PATCH] [MOUCLASS] Support IRP_MJ_READ on Port device objects --- drivers/input/mouclass/mouclass.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/drivers/input/mouclass/mouclass.c b/drivers/input/mouclass/mouclass.c index 0c24cfbd190..746e00eb299 100644 --- a/drivers/input/mouclass/mouclass.c +++ b/drivers/input/mouclass/mouclass.c @@ -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