[I8042PRT]
authorKamil Hornicek <kamil.hornicek@reactos.org>
Wed, 22 Oct 2014 20:05:32 +0000 (20:05 +0000)
committerKamil Hornicek <kamil.hornicek@reactos.org>
Wed, 22 Oct 2014 20:05:32 +0000 (20:05 +0000)
- 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
reactos/win32ss/user/ntuser/keyboard.c

index 0827a2f..275aeb6 100644 (file)
@@ -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;
                        }
index 28ac361..705f4ff 100644 (file)
@@ -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 */