Author: jimtabor
Date: Thu Jul 5 21:30:23 2012
New Revision: 56836
URL:
http://svn.reactos.org/svn/reactos?rev=56836&view=rev
Log:
[Win32k]
- Move window check to the API interface.
Modified:
trunk/reactos/win32ss/user/ntuser/keyboard.c
trunk/reactos/win32ss/user/ntuser/message.c
Modified: trunk/reactos/win32ss/user/ntuser/keyboard.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/keyboa…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/keyboard.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/keyboard.c [iso-8859-1] Thu Jul 5 21:30:23 2012
@@ -845,6 +845,7 @@
/* If we have a focus queue, post a keyboard message */
pFocusQueue = IntGetFocusMessageQueue();
+ TRACE("ProcessKeyEvent Q 0x%p Focus pWnd 0x%p\n",pFocusQueue, pFocusQueue ?
pFocusQueue->spwndFocus : 0);
if (bIsDown && wVk == VK_SNAPSHOT)
{
if (pFocusQueue &&
@@ -1062,7 +1063,6 @@
WCHAR wch[3] = { 0 };
MSG NewMsg = { 0 };
PKBDTABLES pKbdTbl;
- PWND pWnd;
LARGE_INTEGER LargeTickCount;
BOOL bResult = FALSE;
@@ -1077,14 +1077,7 @@
return FALSE;
}
- pWnd = UserGetWindowObject(lpMsg->hwnd);
- if (!pWnd) // Must have a window!
- {
- ERR("No Window for Translate.\n");
- return FALSE;
- }
-
- pti = pWnd->head.pti;
+ pti = PsGetCurrentThreadWin32Thread();
if (!pti->KeyboardLayout)
{
Modified: trunk/reactos/win32ss/user/ntuser/message.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/messag…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/message.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/message.c [iso-8859-1] Thu Jul 5 21:30:23 2012
@@ -2116,12 +2116,12 @@
return Res;
}
-
BOOL APIENTRY
NtUserTranslateMessage(LPMSG lpMsg, UINT flags)
{
MSG SafeMsg;
BOOL Ret;
+ PWND pWnd;
_SEH2_TRY
{
@@ -2136,9 +2136,16 @@
_SEH2_END;
UserEnterExclusive();
-
- Ret = IntTranslateKbdMessage(&SafeMsg, flags);
-
+ pWnd = UserGetWindowObject(SafeMsg.hwnd);
+ if (pWnd) // Must have a window!
+ {
+ Ret = IntTranslateKbdMessage(&SafeMsg, flags);
+ }
+ else
+ {
+ ERR("No Window for Translate. hwnd 0x%p Msg
%d\n",SafeMsg.hwnd,SafeMsg.message);
+ Ret = FALSE;
+ }
UserLeave();
return Ret;