Author: gadamopoulos
Date: Thu Jul 14 08:37:55 2011
New Revision: 52675
URL: http://svn.reactos.org/svn/reactos?rev=52675&view=rev
Log:
[win32k]
- Fix a bug that caused ClientLoadLibrary to be called recursively
Modified:
branches/GSoC_2011/ThemesSupport/subsystems/win32/win32k/ntuser/hook.c
Modified: branches/GSoC_2011/ThemesSupport/subsystems/win32/win32k/ntuser/hook.c
URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2011/ThemesSupport/subsyst…
==============================================================================
--- branches/GSoC_2011/ThemesSupport/subsystems/win32/win32k/ntuser/hook.c [iso-8859-1] (original)
+++ branches/GSoC_2011/ThemesSupport/subsystems/win32/win32k/ntuser/hook.c [iso-8859-1] Thu Jul 14 08:37:55 2011
@@ -46,14 +46,22 @@
{
if(!Unload && !(ppi->W32PF_flags & W32PF_APIHOOKLOADED))
{
+ /* A callback in user mode can trigger UserLoadApiHook to be called and
+ as a result IntLoadHookModule will be called recursively.
+ To solve this we set the flag that means that the appliaction has
+ loaded the api hook before the callback and in case of error we remove it */
+ ppi->W32PF_flags |= W32PF_APIHOOKLOADED;
+
/* Call ClientLoadLibrary in user32 */
hmod = co_IntClientLoadLibrary(&strUahModule, &strUahInitFunc, Unload, TRUE);
- if(hmod != 0)
+ DPRINT1("co_IntClientLoadLibrary returned %d\n", hmod );
+ if(hmod == 0)
{
- ppi->W32PF_flags |= W32PF_APIHOOKLOADED;
- return TRUE;
- }
- return FALSE;
+ /* Remove the flag we set before */
+ ppi->W32PF_flags &= ~W32PF_APIHOOKLOADED;
+ return FALSE;
+ }
+ return TRUE;
}
else if(Unload && (ppi->W32PF_flags & W32PF_APIHOOKLOADED))
{
@@ -91,7 +99,7 @@
ULONG_PTR Result;
PPROCESSINFO ppiCsr;
- DPRINT("IntHookModuleUnloaded: iHookID=%d\n", iHookID);
+ DPRINT1("IntHookModuleUnloaded: iHookID=%d\n", iHookID);
ppiCsr = PsGetProcessWin32Process(CsrProcess);
@@ -155,7 +163,7 @@
return FALSE;
}
- DPRINT("UserRegisterUserApiHook. Server PID: %d\n", PsGetProcessId(pti->ppi->peProcess));
+ DPRINT1("UserRegisterUserApiHook. Server PID: %d\n", PsGetProcessId(pti->ppi->peProcess));
/* Register the api hook */
gpsi->dwSRVIFlags |= SRVINFO_APIHOOK;