Author: jimtabor Date: Wed Oct 27 01:56:56 2010 New Revision: 49301
URL: http://svn.reactos.org/svn/reactos?rev=49301&view=rev Log: [Win32k|User32] - Fix for DosBOX. See bug 5670 for more details. Added more data copies in user32 hook.c.
Modified: trunk/reactos/dll/win32/user32/windows/hook.c trunk/reactos/subsystems/win32/win32k/ntuser/hook.c trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c
Modified: trunk/reactos/dll/win32/user32/windows/hook.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/ho... ============================================================================== --- trunk/reactos/dll/win32/user32/windows/hook.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/windows/hook.c [iso-8859-1] Wed Oct 27 01:56:56 2010 @@ -452,12 +452,12 @@ CREATESTRUCTW Csw; CBT_CREATEWNDW CbtCreatewndw; PHOOKPROC_CBT_CREATEWND_EXTRA_ARGUMENTS CbtCreatewndExtra = NULL; - PKBDLLHOOKSTRUCT pKeyboardLlData; - PMSLLHOOKSTRUCT pMouseLlData; - PMSG pMsg; + KBDLLHOOKSTRUCT KeyboardLlData, *pKeyboardLlData; + MSLLHOOKSTRUCT MouseLlData, *pMouseLlData; + MSG Msg, *pMsg; PMOUSEHOOKSTRUCT pMHook; - PCWPSTRUCT pCWP; - PCWPRETSTRUCT pCWPR; + CWPSTRUCT CWP, *pCWP; + CWPRETSTRUCT CWPR, *pCWPR; PRECTL prl; LPCBTACTIVATESTRUCT pcbtas; WPARAM wParam = 0; @@ -541,11 +541,13 @@ case WH_KEYBOARD_LL: ERR("WH_KEYBOARD_LL: Code %d, wParam %d\n",Common->Code,Common->wParam); pKeyboardLlData = (PKBDLLHOOKSTRUCT)((PCHAR) Common + Common->lParam); - Result = Common->Proc(Common->Code, Common->wParam, (LPARAM) pKeyboardLlData); + RtlCopyMemory(&KeyboardLlData, pKeyboardLlData, sizeof(KBDLLHOOKSTRUCT)); + Result = Common->Proc(Common->Code, Common->wParam, (LPARAM) &KeyboardLlData); break; case WH_MOUSE_LL: pMouseLlData = (PMSLLHOOKSTRUCT)((PCHAR) Common + Common->lParam); - Result = Common->Proc(Common->Code, Common->wParam, (LPARAM) pMouseLlData); + RtlCopyMemory(&MouseLlData, pMouseLlData, sizeof(MSLLHOOKSTRUCT)); + Result = Common->Proc(Common->Code, Common->wParam, (LPARAM) &MouseLlData); break; case WH_MOUSE: /* SEH support */ pMHook = (PMOUSEHOOKSTRUCT)((PCHAR) Common + Common->lParam); @@ -560,26 +562,33 @@ _SEH2_END; break; case WH_CALLWNDPROC: + ERR("WH_CALLWNDPROC: Code %d, wParam %d\n",Common->Code,Common->wParam); pCWP = (PCWPSTRUCT)((PCHAR) Common + Common->lParam); - Result = Common->Proc(Common->Code, Common->wParam, (LPARAM) pCWP); + RtlCopyMemory(&CWP, pCWP, sizeof(CWPSTRUCT)); + Result = Common->Proc(Common->Code, Common->wParam, (LPARAM) &CWP); break; case WH_CALLWNDPROCRET: pCWPR = (PCWPRETSTRUCT)((PCHAR) Common + Common->lParam); - Result = Common->Proc(Common->Code, Common->wParam, (LPARAM) pCWPR); + RtlCopyMemory(&CWPR, pCWPR, sizeof(CWPRETSTRUCT)); + Result = Common->Proc(Common->Code, Common->wParam, (LPARAM) &CWPR); break; case WH_MSGFILTER: /* All SEH support */ + ERR("WH_MSGFILTER: Code %d, wParam %d\n",Common->Code,Common->wParam); case WH_SYSMSGFILTER: case WH_GETMESSAGE: pMsg = (PMSG)((PCHAR) Common + Common->lParam); + RtlCopyMemory(&Msg, pMsg, sizeof(MSG)); _SEH2_TRY { - Result = Common->Proc(Common->Code, Common->wParam, (LPARAM) pMsg); + Result = Common->Proc(Common->Code, Common->wParam, (LPARAM) &Msg); } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { Hit = TRUE; } _SEH2_END; + if (!Hit && Common->HookId == WH_GETMESSAGE) + RtlCopyMemory(pMsg, &Msg, sizeof(MSG)); break; case WH_FOREGROUNDIDLE: /* <-- SEH support */ case WH_KEYBOARD:
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/hook.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/hook.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/hook.c [iso-8859-1] Wed Oct 27 01:56:56 2010 @@ -726,7 +726,7 @@ pti = PsGetCurrentThreadWin32Thread();
Elem = Hook->Chain.Flink; - if (Elem != &pti->pDeskInfo->aphkStart[HOOKID_TO_INDEX(HookId)]) + if (Elem != &pti->rpdesk->pDeskInfo->aphkStart[HOOKID_TO_INDEX(HookId)]) return CONTAINING_RECORD(Elem, HOOK, Chain); } return NULL; @@ -785,10 +785,11 @@
pti = PsGetCurrentThreadWin32Thread();
- if ( pti->pDeskInfo && - IsListEmpty(&pti->pDeskInfo->aphkStart[HOOKID_TO_INDEX(HookId)]) ) - { - pti->pDeskInfo->fsHooks &= ~HOOKID_TO_FLAG(HookId); + if ( pti->rpdesk && + pti->rpdesk->pDeskInfo && + IsListEmpty(&pti->rpdesk->pDeskInfo->aphkStart[HOOKID_TO_INDEX(HookId)]) ) + { + pti->rpdesk->pDeskInfo->fsHooks &= ~HOOKID_TO_FLAG(HookId); return TRUE; } } @@ -830,7 +831,7 @@ pti->fsHooks = 0; } // Global search based on Thread and cleanup. - if (pti->pDeskInfo->fsHooks) + if (pti->rpdesk->pDeskInfo->fsHooks) { for (HookId = WH_MINHOOK; HookId <= WH_MAXHOOK; HookId++) { @@ -876,7 +877,7 @@ ASSERT(WH_MINHOOK <= HookId && HookId <= WH_MAXHOOK);
pti = PsGetCurrentThreadWin32Thread(); - if (!pti || !pti->pDeskInfo) + if (!pti || !pti->rpdesk || !pti->rpdesk->pDeskInfo) goto Exit; // Must have a desktop running for hooks.
if ( pti->TIF_flags & TIF_INCLEANUP) @@ -888,7 +889,7 @@ Local = TRUE; }
- if ( pti->pDeskInfo->fsHooks & HOOKID_TO_FLAG(HookId) ) + if ( pti->rpdesk->pDeskInfo->fsHooks & HOOKID_TO_FLAG(HookId) ) { DPRINT("Global Hooker %d\n", HookId); Global = TRUE; @@ -897,7 +898,7 @@ if ( !Local && !Global ) goto Exit; // No work!
pLLE = &pti->aphkStart[HOOKID_TO_INDEX(HookId)]; - pGLE = &pti->pDeskInfo->aphkStart[HOOKID_TO_INDEX(HookId)]; + pGLE = &pti->rpdesk->pDeskInfo->aphkStart[HOOKID_TO_INDEX(HookId)]; Hook = NULL;
/* SetWindowHookEx sorts out the Thread issue by placing the Hook to @@ -987,14 +988,12 @@ ObReferenceObject(ptiHook->pEThread); if (ptiHook != pti ) { - if (HookId == WH_KEYBOARD_LL){ - DPRINT1("\nGlobal Hook posting to another Thread! %d\n",HookId );} + DPRINT("\nGlobal Hook posting to another Thread! %d\n",HookId ); Result = IntCallLowLevelHook(Hook, Code, wParam, lParam); } else { /* Make the direct call. */ - if (HookId == WH_KEYBOARD_LL){ - DPRINT1("\nLocal Hook calling to Thread! %d\n",HookId );} + DPRINT("\nLocal Hook calling to Thread! %d\n",HookId ); Result = co_IntCallHookProc( HookId, Code, wParam,
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c [iso-8859-1] Wed Oct 27 01:56:56 2010 @@ -798,7 +798,7 @@ KbdHookData.dwExtraInfo = 0; if (co_HOOK_CallHooks(WH_KEYBOARD_LL, HC_ACTION, Msg.message, (LPARAM) &KbdHookData)) { - DPRINT("Kbd msg %d wParam %d lParam 0x%08x dropped by WH_KEYBOARD_LL hook\n", + DPRINT1("Kbd msg %d wParam %d lParam 0x%08x dropped by WH_KEYBOARD_LL hook\n", Msg.message, Msg.wParam, Msg.lParam); if (Entered) UserLeave(); return;