--- trunk/reactos/drivers/input/kbdclass/kbdclass.c 2005-11-18 06:15:24 UTC (rev 19321)
+++ trunk/reactos/drivers/input/kbdclass/kbdclass.c 2005-11-18 10:53:32 UTC (rev 19322)
@@ -369,6 +369,8 @@
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 @@
/* 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 @@
/* 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 @@
ClassDeviceExtension->PortData += ReadSize;
ClassDeviceExtension->InputCount += ReadSize;
- KeReleaseSpinLock(&ClassDeviceExtension->SpinLock, OldIrql);
(*ConsumedCount) += ReadSize;
}
else
@@ -436,6 +437,8 @@
DPRINT("ClassCallBack() entered, InputCount = %lu - DOING NOTHING\n", InputCount);
}
+ KeReleaseSpinLock(&ClassDeviceExtension->SpinLock, OldIrql);
+
if (Irp != NULL)
{
IoStartNextPacket(ClassDeviceObject, FALSE);
@@ -575,11 +578,17 @@
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)
{
--- trunk/reactos/subsys/win32k/ntuser/input.c 2005-11-18 06:15:24 UTC (rev 19321)
+++ trunk/reactos/subsys/win32k/ntuser/input.c 2005-11-18 10:53:32 UTC (rev 19322)
@@ -413,7 +413,6 @@
struct _ETHREAD *FocusThread;
extern NTSTATUS Win32kInitWin32Thread(PETHREAD Thread);
-
PKEYBOARD_INDICATOR_TRANSLATION IndicatorTrans = NULL;
UINT ModifierState = 0;
USHORT LastMakeCode = 0;
@@ -486,15 +485,33 @@
HWND hWnd;
int id;
+ DPRINT("KeyInput @ %08x\n", &KeyInput);
+
Status = NtReadFile (KeyboardDeviceHandle,
+ NULL,
NULL,
NULL,
- NULL,
&Iosb,
&KeyInput,
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 );