Fix a race condition in input packet processing.

svn path=/trunk/; revision=17160
This commit is contained in:
Filip Navara 2005-08-07 11:47:50 +00:00
parent b6bbf4cd23
commit ebd400d82c

View file

@ -6,9 +6,7 @@
** The class driver between win32k and the various mouse port drivers ** The class driver between win32k and the various mouse port drivers
** TODO: Change interface to win32k to a callback instead of ReadFile IO ** FIXME: Support IRP cancellation properly.
Add support for multiple port devices
*/ */
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
@ -26,7 +24,7 @@ BOOLEAN MouseClassCallBack(
PMOUSE_INPUT_DATA MouseDataEnd, PULONG ConsumedCount) PMOUSE_INPUT_DATA MouseDataEnd, PULONG ConsumedCount)
{ {
PDEVICE_EXTENSION ClassDeviceExtension = ClassDeviceObject->DeviceExtension; PDEVICE_EXTENSION ClassDeviceExtension = ClassDeviceObject->DeviceExtension;
PIRP Irp; PIRP Irp = NULL;
KIRQL OldIrql; KIRQL OldIrql;
PIO_STACK_LOCATION Stack; PIO_STACK_LOCATION Stack;
ULONG InputCount = MouseDataEnd - MouseDataStart; ULONG InputCount = MouseDataEnd - MouseDataStart;
@ -53,8 +51,6 @@ BOOLEAN MouseClassCallBack(
Irp->IoStatus.Information = sizeof(MOUSE_INPUT_DATA); Irp->IoStatus.Information = sizeof(MOUSE_INPUT_DATA);
Stack->Parameters.Read.Length = sizeof(MOUSE_INPUT_DATA); Stack->Parameters.Read.Length = sizeof(MOUSE_INPUT_DATA);
IoStartNextPacket(ClassDeviceObject, FALSE);
IoCompleteRequest(Irp, IO_MOUSE_INCREMENT);
ClassDeviceExtension->ReadIsPending = FALSE; ClassDeviceExtension->ReadIsPending = FALSE;
/* Skip the packet we just sent away */ /* Skip the packet we just sent away */
@ -97,6 +93,12 @@ BOOLEAN MouseClassCallBack(
DPRINT("MouseClassCallBack() entered, InputCount = %d - DOING NOTHING\n", InputCount); DPRINT("MouseClassCallBack() entered, InputCount = %d - DOING NOTHING\n", InputCount);
} }
if (Irp != NULL)
{
IoStartNextPacket(ClassDeviceObject, FALSE);
IoCompleteRequest(Irp, IO_MOUSE_INCREMENT);
}
DPRINT("Leaving MouseClassCallBack\n"); DPRINT("Leaving MouseClassCallBack\n");
return TRUE; return TRUE;
} }