[ros-diffs] [jimtabor] 41777: - Discontinue the use of thread information for the hook check and use client information. - Moved code around to make it readable.

jimtabor at svn.reactos.org jimtabor at svn.reactos.org
Sun Jul 5 06:01:00 CEST 2009


Author: jimtabor
Date: Sun Jul  5 08:00:59 2009
New Revision: 41777

URL: http://svn.reactos.org/svn/reactos?rev=41777&view=rev
Log:
- Discontinue the use of thread information for the hook check and use client information.
- Moved code around to make it readable.

Modified:
    trunk/reactos/dll/win32/user32/include/user32.h
    trunk/reactos/dll/win32/user32/windows/message.c

Modified: trunk/reactos/dll/win32/user32/include/user32.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/include/user32.h?rev=41777&r1=41776&r2=41777&view=diff
==============================================================================
--- trunk/reactos/dll/win32/user32/include/user32.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/include/user32.h [iso-8859-1] Sun Jul  5 08:00:59 2009
@@ -90,9 +90,9 @@
 }
 
 static __inline BOOL
-IsThreadHooked(PW32THREADINFO ti)
+IsThreadHooked(PCLIENTINFO pci)
 {
-    return ti->fsHooks != 0;
+    return pci->fsHooks != 0;
 }
 
 static __inline PDESKTOPINFO

Modified: trunk/reactos/dll/win32/user32/windows/message.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/message.c?rev=41777&r1=41776&r2=41777&view=diff
==============================================================================
--- trunk/reactos/dll/win32/user32/windows/message.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/windows/message.c [iso-8859-1] Sun Jul  5 08:00:59 2009
@@ -1801,7 +1801,7 @@
       PW32THREADINFO ti = GetW32ThreadInfo();
 
       Window = ValidateHwnd(Wnd);
-      if (Window != NULL && SharedPtrToUser(Window->ti) == ti && !IsThreadHooked(ti))
+      if (Window != NULL && SharedPtrToUser(Window->ti) == ti && !IsThreadHooked(GetWin32ClientInfo()))
       {
           /* NOTE: We can directly send messages to the window procedure
                    if *all* the following conditions are met:
@@ -1819,23 +1819,30 @@
   UMMsg.wParam = wParam;
   UMMsg.lParam = lParam;
   if (! MsgiUMToKMMessage(&UMMsg, &KMMsg, FALSE))
-    {
-      return FALSE;
-    }
+  {
+     return FALSE;
+  }
   Info.Ansi = FALSE;
-  Result = NtUserSendMessage(KMMsg.hwnd, KMMsg.message,
-                             KMMsg.wParam, KMMsg.lParam, &Info);
+  Result = NtUserSendMessage( KMMsg.hwnd,
+                              KMMsg.message,
+                              KMMsg.wParam,
+                              KMMsg.lParam,
+                              &Info);
   if (! Info.HandledByKernel)
-    {
-      MsgiUMToKMCleanup(&UMMsg, &KMMsg);
-      /* We need to send the message ourselves */
-      Result = IntCallWindowProcW(Info.Ansi, Info.Proc, UMMsg.hwnd, UMMsg.message,
-                                  UMMsg.wParam, UMMsg.lParam);
-    }
+  {
+     MsgiUMToKMCleanup(&UMMsg, &KMMsg);
+     /* We need to send the message ourselves */
+     Result = IntCallWindowProcW( Info.Ansi,
+                                  Info.Proc,
+                                  UMMsg.hwnd,
+                                  UMMsg.message,
+                                  UMMsg.wParam,
+                                  UMMsg.lParam);
+  }
   else if (! MsgiUMToKMReply(&UMMsg, &KMMsg, &Result))
-    {
-      return FALSE;
-    }
+  {
+     return FALSE;
+  }
 
   return Result;
 }
@@ -1858,7 +1865,7 @@
       PW32THREADINFO ti = GetW32ThreadInfo();
 
       Window = ValidateHwnd(Wnd);
-      if (Window != NULL && SharedPtrToUser(Window->ti) == ti && !IsThreadHooked(ti))
+      if (Window != NULL && SharedPtrToUser(Window->ti) == ti && !IsThreadHooked(GetWin32ClientInfo()))
       {
           /* NOTE: We can directly send messages to the window procedure
                    if *all* the following conditions are met:
@@ -1886,8 +1893,11 @@
       return FALSE;
     }
   Info.Ansi = TRUE;
-  Result = NtUserSendMessage(KMMsg.hwnd, KMMsg.message,
-                             KMMsg.wParam, KMMsg.lParam, &Info);
+  Result = NtUserSendMessage( KMMsg.hwnd,
+                              KMMsg.message,
+                              KMMsg.wParam,
+                              KMMsg.lParam,
+                              &Info);
   if (! Info.HandledByKernel)
     {
       /* We need to send the message ourselves */
@@ -1904,8 +1914,12 @@
           /* Unicode winproc. Although we started out with an Ansi message we
              already converted it to Unicode for the kernel call. Reuse that
              message to avoid another conversion */
-          Result = IntCallWindowProcW(Info.Ansi, Info.Proc, UcMsg.hwnd,
-                                      UcMsg.message, UcMsg.wParam, UcMsg.lParam);
+          Result = IntCallWindowProcW( Info.Ansi,
+                                       Info.Proc,
+                                       UcMsg.hwnd,
+                                       UcMsg.message,
+                                       UcMsg.wParam,
+                                       UcMsg.lParam);
           if (! MsgiAnsiToUnicodeReply(&UcMsg, &AnsiMsg, &Result))
             {
               return FALSE;



More information about the Ros-diffs mailing list