VOID STDCALL
MouseThreadMain(PVOID StartContext)
{
- UNICODE_STRING MouseDeviceName = RTL_CONSTANT_STRING(L"\\??\\Mouse");
+ UNICODE_STRING MouseDeviceName = RTL_CONSTANT_STRING(L"\\Device\\PointerClass0");
OBJECT_ATTRIBUTES MouseObjectAttributes;
IO_STATUS_BLOCK Iosb;
NTSTATUS Status;
0,
NULL,
NULL);
- Status = NtOpenFile(&MouseDeviceHandle,
+ do
+ {
+ LARGE_INTEGER DueTime;
+ KEVENT Event;
+ DueTime.QuadPart = (LONGLONG)(-10000000);
+ KeInitializeEvent(&Event, NotificationEvent, FALSE);
+ Status = KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, &DueTime);
+ Status = NtOpenFile(&MouseDeviceHandle,
FILE_ALL_ACCESS,
&MouseObjectAttributes,
&Iosb,
0,
FILE_SYNCHRONOUS_IO_ALERT);
- if(!NT_SUCCESS(Status))
- {
- DPRINT1("Win32K: Failed to open mouse.\n");
- return; //(Status);
- }
+ } while (!NT_SUCCESS(Status));
for(;;)
{
STATIC VOID STDCALL
KeyboardThreadMain(PVOID StartContext)
{
- UNICODE_STRING KeyboardDeviceName = RTL_CONSTANT_STRING(L"\\??\\Keyboard");
+ UNICODE_STRING KeyboardDeviceName = RTL_CONSTANT_STRING(L"\\Device\\KeyboardClass0");
OBJECT_ATTRIBUTES KeyboardObjectAttributes;
IO_STATUS_BLOCK Iosb;
NTSTATUS Status;
struct _ETHREAD *FocusThread;
extern NTSTATUS Win32kInitWin32Thread(PETHREAD Thread);
-
PKEYBOARD_INDICATOR_TRANSLATION IndicatorTrans = NULL;
UINT ModifierState = 0;
USHORT LastMakeCode = 0;
0,
NULL,
NULL);
- Status = NtOpenFile(&KeyboardDeviceHandle,
+ do
+ {
+ LARGE_INTEGER DueTime;
+ KEVENT Event;
+ DueTime.QuadPart = (LONGLONG)(-10000000);
+ KeInitializeEvent(&Event, NotificationEvent, FALSE);
+ Status = KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, &DueTime);
+ Status = NtOpenFile(&KeyboardDeviceHandle,
FILE_ALL_ACCESS,
&KeyboardObjectAttributes,
&Iosb,
0,
FILE_SYNCHRONOUS_IO_ALERT);
- if (!NT_SUCCESS(Status))
- {
- DPRINT1("Win32K: Failed to open keyboard.\n");
- return; //(Status);
- }
+ } while (!NT_SUCCESS(Status));
/* Not sure if converting this thread to a win32 thread is such
a great idea. Since we're posting keyboard messages to the focus
HWND hWnd;
int id;
+ DPRINT("KeyInput @ %08x\n", &KeyInput);
+
Status = NtReadFile (KeyboardDeviceHandle,
- NULL,
+ NULL,
NULL,
NULL,
&Iosb,
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 );
ModifierState |= fsModifiers;
if (ModifierState == fsModifiers &&
- (fsModifiers == MOD_ALT || fsModifiers == MOD_WIN || fsModifiers == MOD_CONTROL))
+ (fsModifiers == MOD_ALT || fsModifiers == MOD_WIN))
{
/* First send out special notifications
* (For alt, the message that turns on accelerator
else
msg.message = WM_SYSKEYUP;
}
- else if (ModifierState & MOD_CONTROL)
- {
- if(NextKeyInput.MakeCode == 0x2E)/* Ctrl-C */
- {
- DPRINT1("Ctrl-C pressed\n");
- /* FIXME: this seems wrong! this bypass hotkeys and all and the winhellos CRTL+C hotkey test
- dont work (anymore) */
- co_MsqPostKeyboardMessage(WM_COPY,0,0);
- continue;
- }
- else if(NextKeyInput.MakeCode == 0x2F) /* Ctrl-V */
- {
- DPRINT1("Ctrl-V pressed\n");
- co_MsqPostKeyboardMessage(WM_PASTE,0,0);
- continue;
- }
- else
- {
- DPRINT1("Ctrl with unknown combination %04x\n",NextKeyInput.MakeCode);
- if (!(KeyInput.Flags & KEY_BREAK))
- msg.message = WM_KEYDOWN;
- else
- msg.message = WM_KEYUP;
- }
- }else
+ else
{
if (!(KeyInput.Flags & KEY_BREAK))
msg.message = WM_KEYDOWN;
FocusThread = FocusQueue->Thread;
if (!(FocusThread && FocusThread->Tcb.Win32Thread &&
- FocusThread->Tcb.Win32Thread->KeyboardLayout))
+ ((PW32THREAD)FocusThread->Tcb.Win32Thread)->KeyboardLayout))
continue;
/* This function uses lParam to fill wParam according to the
* keyboard layout in use.
*/
W32kKeyProcessMessage(&msg,
- FocusThread->Tcb.Win32Thread->KeyboardLayout,
+ ((PW32THREAD)FocusThread->Tcb.Win32Thread)->KeyboardLayout,
KeyInput.Flags & KEY_E0 ? 0xE0 :
(KeyInput.Flags & KEY_E1 ? 0xE1 : 0));
InputThreadsRunning = FALSE;
NtAlertThread(KeyboardThreadHandle);
+ NtAlertThread(MouseThreadHandle);
}
else if (!Release && !InputThreadsRunning)
{