- Move window check to the API interface.

svn path=/trunk/; revision=56836
This commit is contained in:
James Tabor 2012-07-05 21:30:23 +00:00
parent 473a15261d
commit 1cf37c2465
2 changed files with 13 additions and 13 deletions

View file

@ -845,6 +845,7 @@ ProcessKeyEvent(WORD wVk, WORD wScanCode, DWORD dwFlags, BOOL bInjected, DWORD d
/* If we have a focus queue, post a keyboard message */ /* If we have a focus queue, post a keyboard message */
pFocusQueue = IntGetFocusMessageQueue(); pFocusQueue = IntGetFocusMessageQueue();
TRACE("ProcessKeyEvent Q 0x%p Focus pWnd 0x%p\n",pFocusQueue, pFocusQueue ? pFocusQueue->spwndFocus : 0);
if (bIsDown && wVk == VK_SNAPSHOT) if (bIsDown && wVk == VK_SNAPSHOT)
{ {
if (pFocusQueue && if (pFocusQueue &&
@ -1062,7 +1063,6 @@ IntTranslateKbdMessage(LPMSG lpMsg,
WCHAR wch[3] = { 0 }; WCHAR wch[3] = { 0 };
MSG NewMsg = { 0 }; MSG NewMsg = { 0 };
PKBDTABLES pKbdTbl; PKBDTABLES pKbdTbl;
PWND pWnd;
LARGE_INTEGER LargeTickCount; LARGE_INTEGER LargeTickCount;
BOOL bResult = FALSE; BOOL bResult = FALSE;
@ -1077,14 +1077,7 @@ IntTranslateKbdMessage(LPMSG lpMsg,
return FALSE; return FALSE;
} }
pWnd = UserGetWindowObject(lpMsg->hwnd); pti = PsGetCurrentThreadWin32Thread();
if (!pWnd) // Must have a window!
{
ERR("No Window for Translate.\n");
return FALSE;
}
pti = pWnd->head.pti;
if (!pti->KeyboardLayout) if (!pti->KeyboardLayout)
{ {

View file

@ -2116,12 +2116,12 @@ NtUserDispatchMessage(PMSG UnsafeMsgInfo)
return Res; return Res;
} }
BOOL APIENTRY BOOL APIENTRY
NtUserTranslateMessage(LPMSG lpMsg, UINT flags) NtUserTranslateMessage(LPMSG lpMsg, UINT flags)
{ {
MSG SafeMsg; MSG SafeMsg;
BOOL Ret; BOOL Ret;
PWND pWnd;
_SEH2_TRY _SEH2_TRY
{ {
@ -2136,9 +2136,16 @@ NtUserTranslateMessage(LPMSG lpMsg, UINT flags)
_SEH2_END; _SEH2_END;
UserEnterExclusive(); UserEnterExclusive();
pWnd = UserGetWindowObject(SafeMsg.hwnd);
Ret = IntTranslateKbdMessage(&SafeMsg, flags); 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(); UserLeave();
return Ret; return Ret;