Author: gadamopoulos
Date: Mon Apr 18 09:13:31 2011
New Revision: 51389
URL:
http://svn.reactos.org/svn/reactos?rev=51389&view=rev
Log:
[win32k]
- GetKeyboardState and SetKeyboardState should use the thread key state and not the global
key state
Modified:
trunk/reactos/subsystems/win32/win32k/ntuser/keyboard.c
trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/keyboard.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/keyboard.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/keyboard.c [iso-8859-1] Mon Apr 18
09:13:31 2011
@@ -486,55 +486,6 @@
return Result;
}
-DWORD
-APIENTRY
-NtUserGetKeyboardState(
- LPBYTE lpKeyState)
-{
- BOOL Result = TRUE;
- DECLARE_RETURN(DWORD);
-
- DPRINT("Enter NtUserGetKeyboardState\n");
- UserEnterShared();
-
- if (lpKeyState)
- {
- if(!NT_SUCCESS(MmCopyToCaller(lpKeyState, gQueueKeyStateTable, 256)))
- Result = FALSE;
- }
-
- RETURN(Result);
-
-CLEANUP:
- DPRINT("Leave NtUserGetKeyboardState, ret=%i\n",_ret_);
- UserLeave();
- END_CLEANUP;
-}
-
-BOOL
-APIENTRY
-NtUserSetKeyboardState(LPBYTE lpKeyState)
-{
- BOOL Result = TRUE;
- DECLARE_RETURN(DWORD);
-
- DPRINT("Enter NtUserSetKeyboardState\n");
- UserEnterExclusive();
-
- if (lpKeyState)
- {
- if(! NT_SUCCESS(MmCopyFromCaller(gQueueKeyStateTable, lpKeyState, 256)))
- Result = FALSE;
- }
-
- RETURN(Result);
-
-CLEANUP:
- DPRINT("Leave NtUserSetKeyboardState, ret=%i\n",_ret_);
- UserLeave();
- END_CLEANUP;
-}
-
static UINT VkToScan( UINT Code, BOOL ExtCode, PKBDTABLES pkKT )
{
int i;
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c [iso-8859-1] Mon Apr 18
09:13:31 2011
@@ -1896,4 +1896,66 @@
return Ret;
}
+
+DWORD
+APIENTRY
+NtUserGetKeyboardState(LPBYTE lpKeyState)
+{
+ DWORD ret = TRUE;
+ PTHREADINFO pti;
+ PUSER_MESSAGE_QUEUE MessageQueue;
+
+ UserEnterShared();
+
+ pti = PsGetCurrentThreadWin32Thread();
+ MessageQueue = pti->MessageQueue;
+
+ _SEH2_TRY
+ {
+ ProbeForWrite(lpKeyState,sizeof(MessageQueue->KeyState) ,1);
+
RtlCopyMemory(lpKeyState,MessageQueue->KeyState,sizeof(MessageQueue->KeyState));
+ }
+ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+ {
+ SetLastNtError(_SEH2_GetExceptionCode());
+ ret = FALSE;
+ }
+ _SEH2_END;
+
+ UserLeave();
+
+ return ret;
+}
+
+BOOL
+APIENTRY
+NtUserSetKeyboardState(LPBYTE lpKeyState)
+{
+ DWORD ret = TRUE;
+ PTHREADINFO pti;
+ PUSER_MESSAGE_QUEUE MessageQueue;
+
+ UserEnterExclusive();
+
+ pti = PsGetCurrentThreadWin32Thread();
+ MessageQueue = pti->MessageQueue;
+
+ _SEH2_TRY
+ {
+ ProbeForRead(lpKeyState,sizeof(MessageQueue->KeyState) ,1);
+
RtlCopyMemory(MessageQueue->KeyState,lpKeyState,sizeof(MessageQueue->KeyState));
+ }
+ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+ {
+ SetLastNtError(_SEH2_GetExceptionCode());
+ ret = FALSE;
+ }
+ _SEH2_END;
+
+ UserLeave();
+
+ return ret;
+}
+
+
/* EOF */