Author: jimtabor
Date: Thu Jul 24 20:02:17 2008
New Revision: 34766
URL:
http://svn.reactos.org/svn/reactos?rev=34766&view=rev
Log:
- Add call window proc hooks.
Modified:
trunk/reactos/dll/win32/user32/windows/hook.c
trunk/reactos/include/psdk/winuser.h
trunk/reactos/subsystems/win32/win32k/ntuser/callback.c
trunk/reactos/subsystems/win32/win32k/ntuser/message.c
Modified: trunk/reactos/dll/win32/user32/windows/hook.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/h…
==============================================================================
--- trunk/reactos/dll/win32/user32/windows/hook.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/windows/hook.c [iso-8859-1] Thu Jul 24 20:02:17 2008
@@ -423,6 +423,8 @@
PMSLLHOOKSTRUCT MouseLlData;
PMSG Msg;
PMOUSEHOOKSTRUCT MHook;
+ PCWPSTRUCT CWP;
+ PCWPRETSTRUCT CWPR;
Common = (PHOOKPROC_CALLBACK_ARGUMENTS) Arguments;
@@ -507,6 +509,14 @@
MHook = (PMOUSEHOOKSTRUCT)((PCHAR) Common + Common->lParam);
Result = Common->Proc(Common->Code, Common->wParam, (LPARAM) MHook);
break;
+ case WH_CALLWNDPROC:
+ CWP = (PCWPSTRUCT)((PCHAR) Common + Common->lParam);
+ Result = Common->Proc(Common->Code, Common->wParam, (LPARAM) CWP);
+ break;
+ case WH_CALLWNDPROCRET:
+ CWPR = (PCWPRETSTRUCT)((PCHAR) Common + Common->lParam);
+ Result = Common->Proc(Common->Code, Common->wParam, (LPARAM) CWPR);
+ break;
case WH_MSGFILTER:
case WH_SYSMSGFILTER:
case WH_GETMESSAGE:
Modified: trunk/reactos/include/psdk/winuser.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/winuser.h?rev…
==============================================================================
--- trunk/reactos/include/psdk/winuser.h [iso-8859-1] (original)
+++ trunk/reactos/include/psdk/winuser.h [iso-8859-1] Thu Jul 24 20:02:17 2008
@@ -1170,6 +1170,12 @@
#define SMTO_ABORTIFHUNG 2
#define SMTO_BLOCK 1
#define SMTO_NORMAL 0
+#if (WINVER >= 0x0500)
+#define SMTO_NOTIMEOUTIFNOTHUNG 8
+#endif
+#if (WINVER >= 0x0600)
+#define SMTO_ERRORONEXIT 32
+#endif
#define SIF_ALL 23
#define SIF_PAGE 2
#define SIF_POS 4
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/callback.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/callback.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/callback.c [iso-8859-1] Thu Jul 24
20:02:17 2008
@@ -382,6 +382,12 @@
case WH_MOUSE:
ArgumentLength += sizeof(MOUSEHOOKSTRUCT);
break;
+ case WH_CALLWNDPROC:
+ ArgumentLength += sizeof(CWPSTRUCT);
+ break;
+ case WH_CALLWNDPROCRET:
+ ArgumentLength += sizeof(CWPRETSTRUCT);
+ break;
case WH_MSGFILTER:
case WH_SYSMSGFILTER:
case WH_GETMESSAGE:
@@ -452,6 +458,14 @@
RtlCopyMemory(Extra, (PVOID) lParam, sizeof(MOUSEHOOKSTRUCT));
Common->lParam = (LPARAM) (Extra - (PCHAR) Common);
break;
+ case WH_CALLWNDPROC:
+ RtlCopyMemory(Extra, (PVOID) lParam, sizeof(CWPSTRUCT));
+ Common->lParam = (LPARAM) (Extra - (PCHAR) Common);
+ break;
+ case WH_CALLWNDPROCRET:
+ RtlCopyMemory(Extra, (PVOID) lParam, sizeof(CWPRETSTRUCT));
+ Common->lParam = (LPARAM) (Extra - (PCHAR) Common);
+ break;
case WH_MSGFILTER:
case WH_SYSMSGFILTER:
case WH_GETMESSAGE:
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] Thu Jul 24
20:02:17 2008
@@ -1388,6 +1388,7 @@
PW32THREAD Win32Thread;
DECLARE_RETURN(LRESULT);
USER_REFERENCE_ENTRY Ref;
+ BOOL SameThread = FALSE;
/* FIXME: Call hooks. */
if (!(Window = UserGetWindowObject(hWnd)))
@@ -1398,7 +1399,7 @@
UserRefObjectCo(Window, &Ref);
Win32Thread = PsGetCurrentThreadWin32Thread();
-
+
if (NULL != Win32Thread &&
Window->MessageQueue == Win32Thread->MessageQueue)
{
@@ -1425,12 +1426,38 @@
RETURN( FALSE);
}
+ if (Window->ti == Win32Thread->ThreadInfo)
+ SameThread = TRUE;
+
+ if ((!SameThread && (Window->ti->Hooks &
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 );
+ }
+
Result = (ULONG_PTR)co_IntCallWindowProc(Window->Wnd->WndProc,
!Window->Wnd->Unicode, hWnd, Msg, wParam,
lParamPacked,lParamBufferSize);
if(uResult)
{
*uResult = Result;
+ }
+
+ if ((!SameThread && (Window->ti->Hooks &
HOOKID_TO_FLAG(WH_CALLWNDPROC))) ||
+ (SameThread && ISITHOOKED(WH_CALLWNDPROCRET)) )
+ {
+ CWPRETSTRUCT CWPR;
+ CWPR.hwnd = hWnd;
+ CWPR.message = Msg;
+ CWPR.wParam = wParam;
+ CWPR.lParam = lParam;
+ CWPR.lResult = Result;
+ co_HOOK_CallHooks( WH_CALLWNDPROCRET, HC_ACTION, SameThread, (LPARAM)&CWPR
);
}
if (! NT_SUCCESS(UnpackParam(lParamPacked, Msg, wParam, lParam)))
@@ -1957,7 +1984,6 @@
}
else if (parm->flags & BSF_NOTIMEOUTIFNOTHUNG)
{
-#define SMTO_NOTIMEOUTIFNOTHUNG 0x0008
co_IntSendMessageTimeout( HWND_BROADCAST,
Msg,
wParam,