Author: jimtabor
Date: Tue Jul 22 18:46:31 2008
New Revision: 34691
URL:
http://svn.reactos.org/svn/reactos?rev=34691&view=rev
Log:
- Fixed CallNextHookEx, now we do make the callback. Q, how to reload it at the end of the
list? Fix for bug 3549.
- Tested with Opera 9.51(still breaks when getting the page see bug 3465), FF, Seamonkey,
Abiword, and the rest of our applications.
Modified:
trunk/reactos/dll/win32/user32/windows/hook.c
trunk/reactos/subsystems/win32/win32k/ntuser/callback.c
trunk/reactos/subsystems/win32/win32k/ntuser/hook.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] Tue Jul 22 18:46:31 2008
@@ -183,30 +183,28 @@
/*
- * @unimplemented
+ * @implemented
*/
LRESULT
STDCALL
CallNextHookEx(
- HHOOK Hook,
+ HHOOK Hook, // Windows NT/XP/2003: Ignored.
int Code,
WPARAM wParam,
LPARAM lParam)
{
PW32CLIENTINFO ClientInfo;
+ DWORD Flags, Save;
PHOOK pHook;
- DWORD Flags, Save;
LRESULT lResult = 0;
GetConnected();
ClientInfo = GetWin32ClientInfo();
- pHook = ValidateHandle(Hook, VALIDATE_TYPE_HOOK);
-
- if (!pHook) return 0;
-
- ClientInfo->phkCurrent = (PHOOK)pHook->Self; // Pass this over to the kernel.
+ if (!ClientInfo->phkCurrent) return 0;
+
+ pHook = SharedPtrToUser(ClientInfo->phkCurrent);
if (pHook->HookId == WH_CALLWNDPROC || pHook->HookId == WH_CALLWNDPROCRET)
{
@@ -508,7 +506,7 @@
case WH_SYSMSGFILTER:
case WH_GETMESSAGE:
Msg = (PMSG)((PCHAR) Common + Common->lParam);
- FIXME("UHOOK Memory: %x: %x\n",Common, Msg);
+// FIXME("UHOOK Memory: %x: %x\n",Common, Msg);
Result = Common->Proc(Common->Code, Common->wParam, (LPARAM) Msg);
break;
default:
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] Tue Jul 22
18:46:31 2008
@@ -449,7 +449,7 @@
case WH_GETMESSAGE:
RtlCopyMemory(Extra, (PVOID) lParam, sizeof(MSG));
Common->lParam = (LPARAM) (Extra - (PCHAR) Common);
- DPRINT1("KHOOK Memory: %x\n",Common);
+// DPRINT1("KHOOK Memory: %x\n",Common);
break;
// case WH_SHELL:
// Extra = lParam;
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] Tue Jul 22 18:46:31
2008
@@ -731,7 +731,6 @@
LPARAM lParam,
BOOL Ansi)
{
- HHOOK Hook;
PHOOK HookObj, NextObj;
PW32CLIENTINFO ClientInfo;
PWINSTATION_OBJECT WinStaObj;
@@ -758,14 +757,7 @@
ClientInfo = GetWin32ClientInfo();
- Hook = (HHOOK)ClientInfo->phkCurrent;
-
- if (!(HookObj = IntGetHookObject(Hook)))
- {
- RETURN(0);
- }
-
- ASSERT(Hook == HookObj->Self);
+ HookObj = ClientInfo->phkCurrent; // Use this one set from SetWindowHook.
HookId = HookObj->HookId;
Ansi = HookObj->Ansi;
@@ -784,9 +776,12 @@
{
lResult = UserCallNextHookEx( HookId, Code, wParam, lParam, Ansi);
+ ClientInfo->phkCurrent = NextObj;
+
if (lResult == 0) RETURN( 0);
RETURN( (LRESULT)NextObj);
}
+ ClientInfo->phkCurrent = NextObj;
RETURN( 0);
@@ -819,6 +814,7 @@
BOOL Ansi)
{
PWINSTATION_OBJECT WinStaObj;
+ PW32CLIENTINFO ClientInfo;
BOOLEAN Global;
PETHREAD Thread;
PHOOK Hook;
@@ -836,6 +832,8 @@
RETURN( NULL);
}
+ ClientInfo = GetWin32ClientInfo();
+
if (ThreadId) /* thread-local hook */
{
if (HookId == WH_JOURNALRECORD ||
@@ -894,9 +892,19 @@
}
/* We only (partially) support local WH_CBT hooks and
- * WH_KEYBOARD_LL/WH_MOUSE_LL hooks for now */
- if ((WH_CBT != HookId || Global)
- && WH_KEYBOARD_LL != HookId && WH_MOUSE_LL != HookId &&
WH_GETMESSAGE != HookId)
+ * WH_KEYBOARD_LL, WH_MOUSE_LL and WH_GETMESSAGE hooks for now
+ */
+ if (WH_CALLWNDPROC == HookId &&
+ WH_CALLWNDPROCRET == HookId &&
+ WH_DEBUG == HookId &&
+ WH_JOURNALPLAYBACK == HookId &&
+ WH_JOURNALRECORD == HookId &&
+ WH_FOREGROUNDIDLE == HookId &&
+ WH_KEYBOARD == HookId &&
+ WH_MOUSE == HookId &&
+ WH_MSGFILTER == HookId &&
+ WH_SYSMSGFILTER == HookId &&
+ WH_SHELL == HookId)
{
#if 0 /* Removed to get winEmbed working again */
UNIMPLEMENTED
@@ -997,6 +1005,9 @@
Hook->Ansi = Ansi;
Handle = Hook->Self;
+// Set the client threads next hook based on the hooks type.
+ ClientInfo->phkCurrent = IntGetNextHook( Hook);
+
UserDereferenceObject(Hook);
ObDereferenceObject(WinStaObj);
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] Tue Jul 22
18:46:31 2008
@@ -818,8 +818,8 @@
// 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);
+ //DPRINT1("Peek WH_GETMESSAGE -> %x\n",&Msg);
+ co_HOOK_CallHooks( WH_GETMESSAGE, HC_ACTION, RemoveMsg & PM_REMOVE,
(LPARAM)&Msg->Msg);
}
return TRUE;
}