mirror of
https://github.com/reactos/reactos.git
synced 2025-02-25 09:50:02 +00:00
Fixed skipped events from keyboard:
- Wait for IO if it would be pending - Don't copy into UserBuffer directly in read because it'll be overwritten. Use Irp->AssociatedIrp.SystemBuffer. svn path=/trunk/; revision=19322
This commit is contained in:
parent
d7b2d1d3c2
commit
82beaf2b2a
2 changed files with 34 additions and 8 deletions
|
@ -369,6 +369,8 @@ ClassCallback(
|
|||
|
||||
ASSERT(ClassDeviceExtension->Common.IsClassDO);
|
||||
|
||||
KeAcquireSpinLock(&ClassDeviceExtension->SpinLock, &OldIrql);
|
||||
|
||||
DPRINT("ClassCallback()\n");
|
||||
/* A filter driver might have consumed all the data already; I'm
|
||||
* not sure if they are supposed to move the packets when they
|
||||
|
@ -382,6 +384,8 @@ ClassCallback(
|
|||
|
||||
/* A read request is waiting for input, so go straight to it */
|
||||
/* FIXME: use SEH */
|
||||
DPRINT("Immediate Completion: %x\n", DataStart->MakeCode);
|
||||
|
||||
RtlCopyMemory(
|
||||
Irp->MdlAddress ? MmGetSystemAddressForMdlSafe(Irp->MdlAddress, NormalPagePriority) : Irp->AssociatedIrp.SystemBuffer,
|
||||
DataStart,
|
||||
|
@ -403,8 +407,6 @@ ClassCallback(
|
|||
/* If we have data from the port driver and a higher service to send the data to */
|
||||
if (InputCount != 0)
|
||||
{
|
||||
KeAcquireSpinLock(&ClassDeviceExtension->SpinLock, &OldIrql);
|
||||
|
||||
if (ClassDeviceExtension->InputCount + InputCount > ClassDeviceExtension->DriverExtension->DataQueueSize)
|
||||
ReadSize = ClassDeviceExtension->DriverExtension->DataQueueSize - ClassDeviceExtension->InputCount;
|
||||
else
|
||||
|
@ -428,7 +430,6 @@ ClassCallback(
|
|||
ClassDeviceExtension->PortData += ReadSize;
|
||||
ClassDeviceExtension->InputCount += ReadSize;
|
||||
|
||||
KeReleaseSpinLock(&ClassDeviceExtension->SpinLock, OldIrql);
|
||||
(*ConsumedCount) += ReadSize;
|
||||
}
|
||||
else
|
||||
|
@ -436,6 +437,8 @@ ClassCallback(
|
|||
DPRINT("ClassCallBack() entered, InputCount = %lu - DOING NOTHING\n", InputCount);
|
||||
}
|
||||
|
||||
KeReleaseSpinLock(&ClassDeviceExtension->SpinLock, OldIrql);
|
||||
|
||||
if (Irp != NULL)
|
||||
{
|
||||
IoStartNextPacket(ClassDeviceObject, FALSE);
|
||||
|
@ -575,11 +578,17 @@ ClassStartIo(
|
|||
|
||||
KeAcquireSpinLock(&DeviceExtension->SpinLock, &oldIrql);
|
||||
|
||||
DPRINT("Mdl: %x, UserBuffer: %x, InputCount: %d, Data: %x\n",
|
||||
Irp->MdlAddress,
|
||||
Irp->UserBuffer,
|
||||
DeviceExtension->InputCount,
|
||||
(DeviceExtension->PortData-DeviceExtension->InputCount)->MakeCode);
|
||||
|
||||
/* FIXME: use SEH */
|
||||
RtlCopyMemory(
|
||||
Irp->MdlAddress ? MmGetSystemAddressForMdlSafe(Irp->MdlAddress, NormalPagePriority) : Irp->UserBuffer,
|
||||
DeviceExtension->PortData - DeviceExtension->InputCount,
|
||||
sizeof(KEYBOARD_INPUT_DATA));
|
||||
Irp->AssociatedIrp.SystemBuffer,
|
||||
DeviceExtension->PortData - DeviceExtension->InputCount,
|
||||
sizeof(KEYBOARD_INPUT_DATA));
|
||||
|
||||
if (DeviceExtension->InputCount > 1)
|
||||
{
|
||||
|
|
|
@ -413,7 +413,6 @@ KeyboardThreadMain(PVOID StartContext)
|
|||
struct _ETHREAD *FocusThread;
|
||||
extern NTSTATUS Win32kInitWin32Thread(PETHREAD Thread);
|
||||
|
||||
|
||||
PKEYBOARD_INDICATOR_TRANSLATION IndicatorTrans = NULL;
|
||||
UINT ModifierState = 0;
|
||||
USHORT LastMakeCode = 0;
|
||||
|
@ -486,8 +485,10 @@ KeyboardThreadMain(PVOID StartContext)
|
|||
HWND hWnd;
|
||||
int id;
|
||||
|
||||
DPRINT("KeyInput @ %08x\n", &KeyInput);
|
||||
|
||||
Status = NtReadFile (KeyboardDeviceHandle,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
&Iosb,
|
||||
|
@ -495,6 +496,22 @@ KeyboardThreadMain(PVOID StartContext)
|
|||
sizeof(KEYBOARD_INPUT_DATA),
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
if(Status == STATUS_ALERTED && !InputThreadsRunning)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if(Status == STATUS_PENDING)
|
||||
{
|
||||
NtWaitForSingleObject(KeyboardDeviceHandle, FALSE, NULL);
|
||||
Status = Iosb.Status;
|
||||
}
|
||||
if(!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT1("Win32K: Failed to read from mouse.\n");
|
||||
return; //(Status);
|
||||
}
|
||||
|
||||
DPRINT("KeyRaw: %s %04x\n",
|
||||
(KeyInput.Flags & KEY_BREAK) ? "up" : "down",
|
||||
KeyInput.MakeCode );
|
||||
|
|
Loading…
Reference in a new issue