- InitializeObjectAttributes(&KeyboardObjectAttributes,
- &KeyboardDeviceName,
- 0,
- NULL,
- NULL);
- do
- {
- LARGE_INTEGER DueTime;
- KEVENT Event;
- DueTime.QuadPart = (LONGLONG)(-100000000);
- KeInitializeEvent(&Event, NotificationEvent, FALSE);
- Status = KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, &DueTime);
- Status = ZwOpenFile(&ghKeyboardDevice,
- FILE_READ_ACCESS,//FILE_ALL_ACCESS,
- &KeyboardObjectAttributes,
- &Iosb,
- 0,
- FILE_SYNCHRONOUS_IO_ALERT);
- } while (!NT_SUCCESS(Status));
-
- UserInitKeyboard(ghKeyboardDevice);
-
- ptiKeyboard = PsGetCurrentThreadWin32Thread();
- ptiKeyboard->TIF_flags |= TIF_SYSTEMTHREAD;
- TRACE("Keyboard Thread 0x%x \n", ptiKeyboard);
-
- KeSetPriorityThread(&PsGetCurrentThread()->Tcb,
- LOW_REALTIME_PRIORITY + 3);
-
- for (;;)
- {
- /*
- * Wait to start input.
- */
- TRACE("Keyboard Input Thread Waiting for start event\n");
- Status = KeWaitForSingleObject(&InputThreadsStart,
- 0,
- KernelMode,
- TRUE,
- NULL);
-
- TRACE("Keyboard Input Thread Starting...\n");
- /*
- * Receive and process keyboard input.
- */
- while (InputThreadsRunning)