[user32]
authorGiannis Adamopoulos <gadamopoulos@reactos.org>
Sun, 7 Aug 2011 20:10:07 +0000 (20:10 +0000)
committerGiannis Adamopoulos <gadamopoulos@reactos.org>
Sun, 7 Aug 2011 20:10:07 +0000 (20:10 +0000)
- Store ghmodUserApiHook before calling ClearUserApiHook because it will be zeroed during this call
- Fix a typo in ClearUserApiHook

svn path=/branches/GSoC_2011/ThemesSupport/; revision=53123

dll/win32/user32/misc/usrapihk.c
dll/win32/user32/windows/hook.c

index 3eadd8a..960549d 100644 (file)
@@ -199,7 +199,7 @@ ClearUserApiHook(HINSTANCE hInstance)
   if ( ghmodUserApiHook == hInstance )
   {
      pfn1 = gpfnInitUserApi;
-     if ( --gcLoadUserApiHook == 1 )
+     if ( --gcLoadUserApiHook == 0 )
      {
         gfUserApiHook = 0;
         ResetUserApiHook(&guah);
@@ -227,7 +227,7 @@ ClearUserApiHook(HINSTANCE hInstance)
      RtlEnterCriticalSection(&gcsUserApiHook);
      pfn1 = gpfnInitUserApi;
 
-     if ( --gcLoadUserApiHook == 1 )
+     if ( --gcLoadUserApiHook == 0 )
      {
         if ( gcCallUserApiHook )
         {
index 49bfb8d..08dfbbb 100644 (file)
@@ -492,8 +492,8 @@ HINSTANCE ClientLoadLibrary(PUNICODE_STRING pstrLibName,
         /* Cleanup user api hook before unloading */
         if(ApiHook == TRUE)
         {
-            Result = ClearUserApiHook(ghmodUserApiHook);
             hLibrary = ghmodUserApiHook;
+            Result = ClearUserApiHook(ghmodUserApiHook);
             /* Check if we can we unload it now */
             if(Result == FALSE)
             {