Author: gadamopoulos
Date: Mon Oct 11 10:58:33 2010
New Revision: 49114
URL:
http://svn.reactos.org/svn/reactos?rev=49114&view=rev
Log:
[win32k]
-Move checks for active hooks in co_HOOK_CallHooks
Modified:
trunk/reactos/subsystems/win32/win32k/ntuser/defwnd.c
trunk/reactos/subsystems/win32/win32k/ntuser/hook.c
trunk/reactos/subsystems/win32/win32k/ntuser/message.c
trunk/reactos/subsystems/win32/win32k/ntuser/window.c
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/defwnd.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/defwnd.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/defwnd.c [iso-8859-1] Mon Oct 11 10:58:33
2010
@@ -117,7 +117,6 @@
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 @@
case WM_CBT:
{
- if (!ISITHOOKED(WH_CBT)) break;
-
switch (wParam)
{
case HCBT_MOVESIZE:
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/hook.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/hook.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/hook.c [iso-8859-1] Mon Oct 11 10:58:33
2010
@@ -331,6 +331,12 @@
NTSTATUS Status;
ASSERT(WH_MINHOOK <= HookId && HookId <= WH_MAXHOOK);
+
+ /* FIXME! Check pDeskInfo->fsHooks for global hooks! */
+ if (!ISITHOOKED(HookId))
+ {
+ return 0;
+ }
pti = PsGetCurrentThreadWin32Thread();
if (!pti)
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/message.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/message.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/message.c [iso-8859-1] Mon Oct 11
10:58:33 2010
@@ -330,20 +330,16 @@
( 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 );
- }
+ CWP.hwnd = hWnd;
+ CWP.message = Msg;
+ CWP.wParam = wParam;
+ CWP.lParam = lParam;
+ co_HOOK_CallHooks( WH_CALLWNDPROC, HC_ACTION, SameThread, (LPARAM)&CWP );
}
static
@@ -353,21 +349,17 @@
( 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;
- CWPR.lParam = lParam;
- CWPR.lResult = *uResult;
- co_HOOK_CallHooks( WH_CALLWNDPROCRET, HC_ACTION, SameThread, (LPARAM)&CWPR );
- }
+ CWPR.hwnd = hWnd;
+ CWPR.message = Msg;
+ CWPR.wParam = wParam;
+ CWPR.lParam = lParam;
+ CWPR.lResult = *uResult;
+ co_HOOK_CallHooks( WH_CALLWNDPROCRET, HC_ACTION, SameThread, (LPARAM)&CWPR );
}
LRESULT
@@ -709,17 +701,14 @@
Msg->message,
(LPARAM)&MHook ))
{
- if (ISITHOOKED(WH_CBT))
- {
- MHook.pt = Msg->pt;
- MHook.hwnd = Msg->hwnd;
- MHook.wHitTestCode = HitTest;
- MHook.dwExtraInfo = 0;
- co_HOOK_CallHooks( WH_CBT,
- HCBT_CLICKSKIPPED,
- Msg->message,
- (LPARAM)&MHook);
- }
+ MHook.pt = Msg->pt;
+ MHook.hwnd = Msg->hwnd;
+ MHook.wHitTestCode = HitTest;
+ MHook.dwExtraInfo = 0;
+ co_HOOK_CallHooks( WH_CBT,
+ HCBT_CLICKSKIPPED,
+ Msg->message,
+ (LPARAM)&MHook);
return FALSE;
}
@@ -743,14 +732,11 @@
LOWORD(Msg->wParam),
Msg->lParam))
{
- if (ISITHOOKED(WH_CBT))
- {
- /* skip this message */
- co_HOOK_CallHooks( WH_CBT,
- HCBT_KEYSKIPPED,
- LOWORD(Msg->wParam),
- Msg->lParam );
- }
+ /* skip this message */
+ co_HOOK_CallHooks( WH_CBT,
+ HCBT_KEYSKIPPED,
+ LOWORD(Msg->wParam),
+ Msg->lParam );
return FALSE;
}
return TRUE;
@@ -965,7 +951,7 @@
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 @@
}
}
- 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 @@
}
// 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);
- }
+
+ co_HOOK_CallHooks( WH_GETMESSAGE, HC_ACTION, RemoveMsg & PM_REMOVE,
(LPARAM)&Msg->Msg);
return TRUE;
}
@@ -2419,17 +2402,13 @@
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);
- }
+ Ret = co_HOOK_CallHooks( WH_MSGFILTER, code, 0, (LPARAM)&Msg);
}
_SEH2_TRY
@@ -2620,12 +2599,13 @@
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");
}
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/window.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/window.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/window.c [iso-8859-1] Mon Oct 11 10:58:33
2010
@@ -1966,14 +1966,13 @@
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);
- }
- }
+
+ 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 @@
}
/* 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;
}