mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 03:15:43 +00:00
[win32k]
-Move checks for active hooks in co_HOOK_CallHooks svn path=/trunk/; revision=49114
This commit is contained in:
parent
71e0a64605
commit
f87e0a7d9e
4 changed files with 46 additions and 64 deletions
|
@ -117,7 +117,6 @@ IntDefWindowProc(
|
|||
case WM_SYSCOMMAND:
|
||||
{
|
||||
DPRINT1("hwnd %p WM_SYSCOMMAND %lx %lx\n", Wnd->head.h, wParam, lParam );
|
||||
if (!ISITHOOKED(WH_CBT)) break;
|
||||
lResult = co_HOOK_CallHooks(WH_CBT, HCBT_SYSCOMMAND, wParam, lParam);
|
||||
break;
|
||||
}
|
||||
|
@ -145,8 +144,6 @@ IntDefWindowProc(
|
|||
|
||||
case WM_CBT:
|
||||
{
|
||||
if (!ISITHOOKED(WH_CBT)) break;
|
||||
|
||||
switch (wParam)
|
||||
{
|
||||
case HCBT_MOVESIZE:
|
||||
|
|
|
@ -332,6 +332,12 @@ co_HOOK_CallHooks(INT HookId, INT Code, WPARAM wParam, LPARAM lParam)
|
|||
|
||||
ASSERT(WH_MINHOOK <= HookId && HookId <= WH_MAXHOOK);
|
||||
|
||||
/* FIXME! Check pDeskInfo->fsHooks for global hooks! */
|
||||
if (!ISITHOOKED(HookId))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
pti = PsGetCurrentThreadWin32Thread();
|
||||
if (!pti)
|
||||
{
|
||||
|
|
|
@ -330,21 +330,17 @@ IntCallWndProc
|
|||
( PWND Window, HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
BOOL SameThread = FALSE;
|
||||
CWPSTRUCT CWP;
|
||||
|
||||
if (Window->head.pti == ((PTHREADINFO)PsGetCurrentThreadWin32Thread()))
|
||||
SameThread = TRUE;
|
||||
|
||||
if ((!SameThread && (Window->head.pti->fsHooks & HOOKID_TO_FLAG(WH_CALLWNDPROC))) ||
|
||||
(SameThread && ISITHOOKED(WH_CALLWNDPROC)) )
|
||||
{
|
||||
CWPSTRUCT CWP;
|
||||
CWP.hwnd = hWnd;
|
||||
CWP.message = Msg;
|
||||
CWP.wParam = wParam;
|
||||
CWP.lParam = lParam;
|
||||
co_HOOK_CallHooks( WH_CALLWNDPROC, HC_ACTION, SameThread, (LPARAM)&CWP );
|
||||
}
|
||||
}
|
||||
|
||||
static
|
||||
VOID
|
||||
|
@ -353,14 +349,11 @@ IntCallWndProcRet
|
|||
( PWND Window, HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, LRESULT *uResult)
|
||||
{
|
||||
BOOL SameThread = FALSE;
|
||||
CWPRETSTRUCT CWPR;
|
||||
|
||||
if (Window->head.pti == ((PTHREADINFO)PsGetCurrentThreadWin32Thread()))
|
||||
SameThread = TRUE;
|
||||
|
||||
if ((!SameThread && (Window->head.pti->fsHooks & HOOKID_TO_FLAG(WH_CALLWNDPROCRET))) ||
|
||||
(SameThread && ISITHOOKED(WH_CALLWNDPROCRET)) )
|
||||
{
|
||||
CWPRETSTRUCT CWPR;
|
||||
CWPR.hwnd = hWnd;
|
||||
CWPR.message = Msg;
|
||||
CWPR.wParam = wParam;
|
||||
|
@ -368,7 +361,6 @@ IntCallWndProcRet
|
|||
CWPR.lResult = *uResult;
|
||||
co_HOOK_CallHooks( WH_CALLWNDPROCRET, HC_ACTION, SameThread, (LPARAM)&CWPR );
|
||||
}
|
||||
}
|
||||
|
||||
LRESULT
|
||||
FASTCALL
|
||||
|
@ -708,8 +700,6 @@ BOOL ProcessMouseMessage(MSG* Msg, USHORT HitTest, UINT RemoveMsg)
|
|||
RemoveMsg ? HC_ACTION : HC_NOREMOVE,
|
||||
Msg->message,
|
||||
(LPARAM)&MHook ))
|
||||
{
|
||||
if (ISITHOOKED(WH_CBT))
|
||||
{
|
||||
MHook.pt = Msg->pt;
|
||||
MHook.hwnd = Msg->hwnd;
|
||||
|
@ -719,7 +709,6 @@ BOOL ProcessMouseMessage(MSG* Msg, USHORT HitTest, UINT RemoveMsg)
|
|||
HCBT_CLICKSKIPPED,
|
||||
Msg->message,
|
||||
(LPARAM)&MHook);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -742,15 +731,12 @@ BOOL ProcessKeyboardMessage(MSG* Msg, UINT RemoveMsg)
|
|||
RemoveMsg ? HC_ACTION : HC_NOREMOVE,
|
||||
LOWORD(Msg->wParam),
|
||||
Msg->lParam))
|
||||
{
|
||||
if (ISITHOOKED(WH_CBT))
|
||||
{
|
||||
/* skip this message */
|
||||
co_HOOK_CallHooks( WH_CBT,
|
||||
HCBT_KEYSKIPPED,
|
||||
LOWORD(Msg->wParam),
|
||||
Msg->lParam );
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
|
@ -965,7 +951,7 @@ MessageFound:
|
|||
MsgExit:
|
||||
pti->rpdesk->htEx = HitTest; /* Now set the capture hit. */
|
||||
|
||||
if ( ISITHOOKED(WH_MOUSE) && IS_MOUSE_MESSAGE(Msg->Msg.message))
|
||||
if ( IS_MOUSE_MESSAGE(Msg->Msg.message))
|
||||
{
|
||||
if (!ProcessMouseMessage(&Msg->Msg, HitTest, RemoveMsg))
|
||||
{
|
||||
|
@ -973,7 +959,7 @@ MsgExit:
|
|||
}
|
||||
}
|
||||
|
||||
if ( ISITHOOKED(WH_KEYBOARD) && IS_KBD_MESSAGE(Msg->Msg.message))
|
||||
if ( IS_KBD_MESSAGE(Msg->Msg.message))
|
||||
{
|
||||
if(!ProcessKeyboardMessage(&Msg->Msg, RemoveMsg))
|
||||
{
|
||||
|
@ -982,11 +968,8 @@ MsgExit:
|
|||
}
|
||||
// The WH_GETMESSAGE hook enables an application to monitor messages about to
|
||||
// be returned by the GetMessage or PeekMessage function.
|
||||
if (ISITHOOKED(WH_GETMESSAGE))
|
||||
{
|
||||
//DPRINT1("Peek WH_GETMESSAGE -> %x\n",&Msg);
|
||||
|
||||
co_HOOK_CallHooks( WH_GETMESSAGE, HC_ACTION, RemoveMsg & PM_REMOVE, (LPARAM)&Msg->Msg);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -2419,18 +2402,14 @@ NtUserCallMsgFilter(
|
|||
|
||||
if (BadChk) RETURN( FALSE);
|
||||
|
||||
if ( ISITHOOKED(WH_SYSMSGFILTER) &&
|
||||
co_HOOK_CallHooks( WH_SYSMSGFILTER, code, 0, (LPARAM)&Msg))
|
||||
if ( co_HOOK_CallHooks( WH_SYSMSGFILTER, code, 0, (LPARAM)&Msg))
|
||||
{
|
||||
Ret = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( ISITHOOKED(WH_MSGFILTER) )
|
||||
{
|
||||
Ret = co_HOOK_CallHooks( WH_MSGFILTER, code, 0, (LPARAM)&Msg);
|
||||
}
|
||||
}
|
||||
|
||||
_SEH2_TRY
|
||||
{
|
||||
|
@ -2620,12 +2599,13 @@ NtUserMessageCall(
|
|||
case FNID_SENDMESSAGECALLBACK:
|
||||
{
|
||||
PCALL_BACK_INFO CallBackInfo = (PCALL_BACK_INFO)ResultInfo;
|
||||
ULONG_PTR uResult;
|
||||
|
||||
if (!CallBackInfo)
|
||||
break;
|
||||
|
||||
if (!co_IntSendMessageWithCallBack(hWnd, Msg, wParam, lParam,
|
||||
CallBackInfo->CallBack, CallBackInfo->Context, NULL))
|
||||
CallBackInfo->CallBack, CallBackInfo->Context, &uResult))
|
||||
{
|
||||
DPRINT1("Callback failure!\n");
|
||||
}
|
||||
|
|
|
@ -1966,14 +1966,13 @@ co_UserCreateWindowEx(CREATESTRUCTW* Cs,
|
|||
Cs->style = Window->style; /* HCBT_CREATEWND needs the real window style */
|
||||
CbtCreate.lpcs = Cs;
|
||||
CbtCreate.hwndInsertAfter = HWND_TOP;
|
||||
if (ISITHOOKED(WH_CBT))
|
||||
{
|
||||
|
||||
if (co_HOOK_CallHooks(WH_CBT, HCBT_CREATEWND, (WPARAM) hWnd, (LPARAM) &CbtCreate))
|
||||
{
|
||||
DPRINT1("HCBT_CREATEWND hook failed!\n");
|
||||
RETURN( (PWND) NULL);
|
||||
}
|
||||
}
|
||||
|
||||
Cs->style = dwStyle; /* NCCREATE and WM_NCCALCSIZE need the original values*/
|
||||
|
||||
/* Send the WM_GETMINMAXINFO message*/
|
||||
|
@ -2342,7 +2341,7 @@ BOOLEAN FASTCALL co_UserDestroyWindow(PWND Window)
|
|||
}
|
||||
|
||||
/* If window was created successfully and it is hooked */
|
||||
if ((Window->state2 & WNDS2_WMCREATEMSGPROCESSED) && (ISITHOOKED(WH_CBT)))
|
||||
if ((Window->state2 & WNDS2_WMCREATEMSGPROCESSED))
|
||||
{
|
||||
if (co_HOOK_CallHooks(WH_CBT, HCBT_DESTROYWND, (WPARAM) hWnd, 0)) return FALSE;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue