From 0f21d941ce0923c010092d68a3cbfb522db4af8f Mon Sep 17 00:00:00 2001 From: Kamil Hornicek Date: Wed, 22 Oct 2014 20:05:32 +0000 Subject: [PATCH] [I8042PRT] - check the right buffer's length [WIN32K] - simplify IntKeyboardUpdateLeds a bit and mind previous mode - fixes keyboard indicators CORE-8547 svn path=/trunk/; revision=64908 --- reactos/drivers/input/i8042prt/keyboard.c | 2 +- reactos/win32ss/user/ntuser/keyboard.c | 23 +++++++++-------------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/reactos/drivers/input/i8042prt/keyboard.c b/reactos/drivers/input/i8042prt/keyboard.c index 0827a2f5b56..275aeb643ee 100644 --- a/reactos/drivers/input/i8042prt/keyboard.c +++ b/reactos/drivers/input/i8042prt/keyboard.c @@ -694,7 +694,7 @@ cleanup: { TRACE_(I8042PRT, "IRP_MJ_INTERNAL_DEVICE_CONTROL / IOCTL_KEYBOARD_QUERY_INDICATORS\n"); - if (Stack->Parameters.DeviceIoControl.InputBufferLength < sizeof(KEYBOARD_INDICATOR_PARAMETERS)) + if (Stack->Parameters.DeviceIoControl.OutputBufferLength < sizeof(KEYBOARD_INDICATOR_PARAMETERS)) { Status = STATUS_BUFFER_TOO_SMALL; } diff --git a/reactos/win32ss/user/ntuser/keyboard.c b/reactos/win32ss/user/ntuser/keyboard.c index 28ac361b63d..705f4ff6434 100644 --- a/reactos/win32ss/user/ntuser/keyboard.c +++ b/reactos/win32ss/user/ntuser/keyboard.c @@ -61,7 +61,7 @@ IntKeyboardGetIndicatorTrans(HANDLE hKeyboardDevice, while (pRet) { - Status = NtDeviceIoControlFile(hKeyboardDevice, + Status = ZwDeviceIoControlFile(hKeyboardDevice, NULL, NULL, NULL, @@ -104,8 +104,7 @@ static NTSTATUS APIENTRY IntKeyboardUpdateLeds(HANDLE hKeyboardDevice, WORD wVk, - WORD wScanCode, - BOOL bEnabled) + WORD wScanCode) { NTSTATUS Status; UINT i; @@ -133,13 +132,10 @@ IntKeyboardUpdateLeds(HANDLE hKeyboardDevice, if (LedFlag) { - if (bEnabled) - gIndicators.LedFlags |= LedFlag; - else - gIndicators.LedFlags = ~LedFlag; + gIndicators.LedFlags ^= LedFlag; /* Update the lights on the hardware */ - Status = NtDeviceIoControlFile(hKeyboardDevice, + Status = ZwDeviceIoControlFile(hKeyboardDevice, NULL, NULL, NULL, @@ -164,10 +160,10 @@ UserInitKeyboard(HANDLE hKeyboardDevice) { NTSTATUS Status; IO_STATUS_BLOCK Block; -/* + IntKeyboardGetIndicatorTrans(hKeyboardDevice, &gpKeyboardIndicatorTrans); - Status = NtDeviceIoControlFile(hKeyboardDevice, + Status = ZwDeviceIoControlFile(hKeyboardDevice, NULL, NULL, NULL, @@ -186,9 +182,9 @@ UserInitKeyboard(HANDLE hKeyboardDevice) gIndicators.LedFlags & KEYBOARD_NUM_LOCK_ON); SET_KEY_LOCKED(gafAsyncKeyState, VK_SCROLL, gIndicators.LedFlags & KEYBOARD_SCROLL_LOCK_ON); -*/ + // FIXME: Need device driver to work! HID support more than one!!!! - Status = NtDeviceIoControlFile(hKeyboardDevice, + Status = ZwDeviceIoControlFile(hKeyboardDevice, NULL, NULL, NULL, @@ -808,8 +804,7 @@ ProcessKeyEvent(WORD wVk, WORD wScanCode, DWORD dwFlags, BOOL bInjected, DWORD d /* Update keyboard LEDs */ IntKeyboardUpdateLeds(ghKeyboardDevice, wSimpleVk, - wScanCode, - IS_KEY_LOCKED(gafAsyncKeyState, wSimpleVk)); + wScanCode); } /* Call WH_KEYBOARD_LL hook */ -- 2.17.1