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);
|
ASSERT(ClassDeviceExtension->Common.IsClassDO);
|
||||||
|
|
||||||
|
KeAcquireSpinLock(&ClassDeviceExtension->SpinLock, &OldIrql);
|
||||||
|
|
||||||
DPRINT("ClassCallback()\n");
|
DPRINT("ClassCallback()\n");
|
||||||
/* A filter driver might have consumed all the data already; I'm
|
/* A filter driver might have consumed all the data already; I'm
|
||||||
* not sure if they are supposed to move the packets when they
|
* 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 */
|
/* A read request is waiting for input, so go straight to it */
|
||||||
/* FIXME: use SEH */
|
/* FIXME: use SEH */
|
||||||
|
DPRINT("Immediate Completion: %x\n", DataStart->MakeCode);
|
||||||
|
|
||||||
RtlCopyMemory(
|
RtlCopyMemory(
|
||||||
Irp->MdlAddress ? MmGetSystemAddressForMdlSafe(Irp->MdlAddress, NormalPagePriority) : Irp->AssociatedIrp.SystemBuffer,
|
Irp->MdlAddress ? MmGetSystemAddressForMdlSafe(Irp->MdlAddress, NormalPagePriority) : Irp->AssociatedIrp.SystemBuffer,
|
||||||
DataStart,
|
DataStart,
|
||||||
|
@ -403,8 +407,6 @@ ClassCallback(
|
||||||
/* If we have data from the port driver and a higher service to send the data to */
|
/* If we have data from the port driver and a higher service to send the data to */
|
||||||
if (InputCount != 0)
|
if (InputCount != 0)
|
||||||
{
|
{
|
||||||
KeAcquireSpinLock(&ClassDeviceExtension->SpinLock, &OldIrql);
|
|
||||||
|
|
||||||
if (ClassDeviceExtension->InputCount + InputCount > ClassDeviceExtension->DriverExtension->DataQueueSize)
|
if (ClassDeviceExtension->InputCount + InputCount > ClassDeviceExtension->DriverExtension->DataQueueSize)
|
||||||
ReadSize = ClassDeviceExtension->DriverExtension->DataQueueSize - ClassDeviceExtension->InputCount;
|
ReadSize = ClassDeviceExtension->DriverExtension->DataQueueSize - ClassDeviceExtension->InputCount;
|
||||||
else
|
else
|
||||||
|
@ -428,7 +430,6 @@ ClassCallback(
|
||||||
ClassDeviceExtension->PortData += ReadSize;
|
ClassDeviceExtension->PortData += ReadSize;
|
||||||
ClassDeviceExtension->InputCount += ReadSize;
|
ClassDeviceExtension->InputCount += ReadSize;
|
||||||
|
|
||||||
KeReleaseSpinLock(&ClassDeviceExtension->SpinLock, OldIrql);
|
|
||||||
(*ConsumedCount) += ReadSize;
|
(*ConsumedCount) += ReadSize;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -436,6 +437,8 @@ ClassCallback(
|
||||||
DPRINT("ClassCallBack() entered, InputCount = %lu - DOING NOTHING\n", InputCount);
|
DPRINT("ClassCallBack() entered, InputCount = %lu - DOING NOTHING\n", InputCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
KeReleaseSpinLock(&ClassDeviceExtension->SpinLock, OldIrql);
|
||||||
|
|
||||||
if (Irp != NULL)
|
if (Irp != NULL)
|
||||||
{
|
{
|
||||||
IoStartNextPacket(ClassDeviceObject, FALSE);
|
IoStartNextPacket(ClassDeviceObject, FALSE);
|
||||||
|
@ -575,11 +578,17 @@ ClassStartIo(
|
||||||
|
|
||||||
KeAcquireSpinLock(&DeviceExtension->SpinLock, &oldIrql);
|
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 */
|
/* FIXME: use SEH */
|
||||||
RtlCopyMemory(
|
RtlCopyMemory(
|
||||||
Irp->MdlAddress ? MmGetSystemAddressForMdlSafe(Irp->MdlAddress, NormalPagePriority) : Irp->UserBuffer,
|
Irp->AssociatedIrp.SystemBuffer,
|
||||||
DeviceExtension->PortData - DeviceExtension->InputCount,
|
DeviceExtension->PortData - DeviceExtension->InputCount,
|
||||||
sizeof(KEYBOARD_INPUT_DATA));
|
sizeof(KEYBOARD_INPUT_DATA));
|
||||||
|
|
||||||
if (DeviceExtension->InputCount > 1)
|
if (DeviceExtension->InputCount > 1)
|
||||||
{
|
{
|
||||||
|
|
|
@ -413,7 +413,6 @@ KeyboardThreadMain(PVOID StartContext)
|
||||||
struct _ETHREAD *FocusThread;
|
struct _ETHREAD *FocusThread;
|
||||||
extern NTSTATUS Win32kInitWin32Thread(PETHREAD Thread);
|
extern NTSTATUS Win32kInitWin32Thread(PETHREAD Thread);
|
||||||
|
|
||||||
|
|
||||||
PKEYBOARD_INDICATOR_TRANSLATION IndicatorTrans = NULL;
|
PKEYBOARD_INDICATOR_TRANSLATION IndicatorTrans = NULL;
|
||||||
UINT ModifierState = 0;
|
UINT ModifierState = 0;
|
||||||
USHORT LastMakeCode = 0;
|
USHORT LastMakeCode = 0;
|
||||||
|
@ -486,8 +485,10 @@ KeyboardThreadMain(PVOID StartContext)
|
||||||
HWND hWnd;
|
HWND hWnd;
|
||||||
int id;
|
int id;
|
||||||
|
|
||||||
|
DPRINT("KeyInput @ %08x\n", &KeyInput);
|
||||||
|
|
||||||
Status = NtReadFile (KeyboardDeviceHandle,
|
Status = NtReadFile (KeyboardDeviceHandle,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
&Iosb,
|
&Iosb,
|
||||||
|
@ -495,6 +496,22 @@ KeyboardThreadMain(PVOID StartContext)
|
||||||
sizeof(KEYBOARD_INPUT_DATA),
|
sizeof(KEYBOARD_INPUT_DATA),
|
||||||
NULL,
|
NULL,
|
||||||
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",
|
DPRINT("KeyRaw: %s %04x\n",
|
||||||
(KeyInput.Flags & KEY_BREAK) ? "up" : "down",
|
(KeyInput.Flags & KEY_BREAK) ? "up" : "down",
|
||||||
KeyInput.MakeCode );
|
KeyInput.MakeCode );
|
||||||
|
|
Loading…
Reference in a new issue