Author: jimtabor
Date: Mon Oct 29 04:47:55 2012
New Revision: 57645
URL:
http://svn.reactos.org/svn/reactos?rev=57645&view=rev
Log:
[Win32k]
- Move away from thread pointer when using hooks.
Modified:
trunk/reactos/win32ss/include/ntuser.h
trunk/reactos/win32ss/user/ntuser/hook.c
Modified: trunk/reactos/win32ss/include/ntuser.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/include/ntuser.h?r…
==============================================================================
--- trunk/reactos/win32ss/include/ntuser.h [iso-8859-1] (original)
+++ trunk/reactos/win32ss/include/ntuser.h [iso-8859-1] Mon Oct 29 04:47:55 2012
@@ -200,7 +200,6 @@
struct _DESKTOP *rpdesk;
/* ReactOS */
LIST_ENTRY Chain; /* Hook chain entry */
- struct _ETHREAD* Thread; /* Thread owning the hook */
HOOKPROC Proc; /* Hook function */
BOOLEAN Ansi; /* Is it an Ansi hook? */
UNICODE_STRING ModuleName; /* Module name for global hooks */
Modified: trunk/reactos/win32ss/user/ntuser/hook.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/hook.c…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/hook.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/hook.c [iso-8859-1] Mon Oct 29 04:47:55 2012
@@ -250,8 +250,8 @@
BOOL Block = FALSE;
ULONG_PTR uResult = 0;
- if (Hook->Thread)
- pti = Hook->Thread->Tcb.Win32Thread;
+ if (Hook->ptiHooked)
+ pti = Hook->ptiHooked;
else
pti = Hook->head.pti;
@@ -990,9 +990,9 @@
PLIST_ENTRY pLastHead, pElem;
PTHREADINFO pti;
- if (Hook->Thread)
- {
- pti = ((PTHREADINFO)Hook->Thread->Tcb.Win32Thread);
+ if (Hook->ptiHooked)
+ {
+ pti = Hook->ptiHooked;
pLastHead = &pti->aphkStart[HOOKID_TO_INDEX(HookId)];
}
else
@@ -1035,9 +1035,9 @@
HookId = Hook->HookId;
- if (Hook->Thread) // Local
- {
- pti = ((PTHREADINFO)Hook->Thread->Tcb.Win32Thread);
+ if (Hook->ptiHooked) // Local
+ {
+ pti = Hook->ptiHooked;
IntFreeHook( Hook);
@@ -1496,8 +1496,6 @@
ptiHook = Thread->Tcb.Win32Thread;
- ObDereferenceObject(Thread);
-
if ( ptiHook->rpdesk != pti->rpdesk) // gptiCurrent->rpdesk)
{
ERR("Local hook wrong desktop HookId: %d\n",HookId);
@@ -1577,7 +1575,6 @@
}
Hook->ihmod = (INT)Mod; // Module Index from atom table, Do this for now.
- Hook->Thread = Thread; /* Set Thread, Null is Global. */
Hook->HookId = HookId;
Hook->rpdesk = ptiHook->rpdesk;
Hook->phkNext = NULL; /* Dont use as a chain! Use link lists for chaining. */
@@ -1684,6 +1681,7 @@
CLEANUP:
TRACE("Leave NtUserSetWindowsHookEx, ret=%i\n",_ret_);
+ if (Thread) ObDereferenceObject(Thread);
UserLeave();
END_CLEANUP;
}