- 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 */
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 @@ IntTranslateKbdMessage(LPMSG lpMsg,
WCHAR wch[3] = { 0 };
MSG NewMsg = { 0 };
PKBDTABLES pKbdTbl;
PWND pWnd;
LARGE_INTEGER LargeTickCount;
BOOL bResult = FALSE;
@ -1077,14 +1077,7 @@ IntTranslateKbdMessage(LPMSG lpMsg,
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)
{

View file

@ -2116,12 +2116,12 @@ NtUserDispatchMessage(PMSG UnsafeMsgInfo)
return Res;
}
BOOL APIENTRY
NtUserTranslateMessage(LPMSG lpMsg, UINT flags)
{
MSG SafeMsg;
BOOL Ret;
PWND pWnd;
_SEH2_TRY
{
@ -2136,9 +2136,16 @@ NtUserTranslateMessage(LPMSG lpMsg, UINT flags)
_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;