Author: jimtabor
Date: Fri Nov 20 08:22:20 2015
New Revision: 69945
URL: http://svn.reactos.org/svn/reactos?rev=69945&view=rev
Log:
[Win32k]
- Fix crash while closing global hooked application. See CORE-10549.
Modified:
trunk/reactos/win32ss/user/ntuser/callback.c
trunk/reactos/win32ss/user/ntuser/hook.c
Modified: trunk/reactos/win32ss/user/ntuser/callback.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/callba…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/callback.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/callback.c [iso-8859-1] Fri Nov 20 08:22:20 2015
@@ -647,7 +647,13 @@
Common->offPfn = offPfn;
Common->Ansi = Ansi;
RtlZeroMemory(&Common->ModuleName, sizeof(Common->ModuleName));
- RtlCopyMemory(&Common->ModuleName, ModuleName->Buffer, ModuleName->Length);
+ if (ModuleName->Buffer && ModuleName->Length)
+ {
+ RtlCopyMemory(&Common->ModuleName, ModuleName->Buffer, ModuleName->Length);
+ // If ModuleName->Buffer NULL while in destroy,
+ // this will make User32:Hook.c complain about not loading the library module.
+ // Fix symptom for CORE-10549.
+ }
Extra = (PCHAR) Common + sizeof(HOOKPROC_CALLBACK_ARGUMENTS);
switch(HookId)
@@ -738,7 +744,7 @@
if (!NT_SUCCESS(Status))
{
- ERR("Failure to make Callback! Status 0x%x",Status);
+ ERR("Failure to make Callback! Status 0x%x\n",Status);
goto Fault_Exit;
}
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] Fri Nov 20 08:22:20 2015
@@ -342,6 +342,9 @@
case WH_KEYBOARD:
break;
}
+
+ if (!UserObjectInDestroy(UserHMGetHandle(phk))) //// Fix CORE-10549.
+ {
/* The odds are high for this to be a Global call. */
Result = co_IntCallHookProc( HookId,
Code,
@@ -352,7 +355,7 @@
phk->offPfn,
phk->Ansi,
&phk->ModuleName);
-
+ }
/* The odds so high, no one is waiting for the results. */
if (pHP->pHookStructs) ExFreePoolWithTag(pHP->pHookStructs, TAG_HOOK);
ExFreePoolWithTag(pHP, TAG_HOOK);