Rearrange WINPROC_CallWndProc to give clearer tracing

Mike Hearn mh at codeweavers.com
Wed Feb 9 12:23:38 CST 2005


This makes it much clearer what the app is doing inside a window
procedure. Before, there was all kinds of Wine internal tracing being
put *after* the "Call window proc" line, which I found quite confusing
as it looked like the app was doing calls to _EnterSysLevel etc which
would be clearly wrong. Likewise it wasn't clear exactly where the apps
code ended because a call to SPY_GetMsgName was mixed up with it.

ChangeLog:
Rearrange WINPROC_CallWndProc to give clearer tracing
-------------- next part --------------
--- windows/winproc.c  (revision 132)
+++ windows/winproc.c  (local)
@@ -408,20 +408,25 @@ static LRESULT WINPROC_CallWndProc( WNDP
 {
     LRESULT retvalue;
     int iWndsLocks;
+    char msgname[1024];
 
+    /* To avoid any deadlocks, all the locks on the windows structures
+       must be suspended before the control is passed to the application */
+    iWndsLocks = WIN_SuspendWndsLock();    
+    
     hwnd = WIN_GetFullHandle( hwnd );
+    strncpy(msgname, SPY_GetMsgName(msg, hwnd), sizeof(msgname));
+    
     if (TRACE_ON(relay))
         DPRINTF( "%04lx:Call window proc %p (hwnd=%p,msg=%s,wp=%08x,lp=%08lx)\n",
-                 GetCurrentThreadId(), proc, hwnd, SPY_GetMsgName(msg, hwnd), wParam, lParam );
-    /* To avoid any deadlocks, all the locks on the windows structures
-       must be suspended before the control is passed to the application */
-    iWndsLocks = WIN_SuspendWndsLock();
+                 GetCurrentThreadId(), proc, hwnd, msgname, wParam, lParam );
     retvalue = WINPROC_wrapper( proc, hwnd, msg, wParam, lParam );
-    WIN_RestoreWndsLock(iWndsLocks);
-
     if (TRACE_ON(relay))
         DPRINTF( "%04lx:Ret  window proc %p (hwnd=%p,msg=%s,wp=%08x,lp=%08lx) retval=%08lx\n",
-                 GetCurrentThreadId(), proc, hwnd, SPY_GetMsgName(msg, hwnd), wParam, lParam, retvalue );
+                 GetCurrentThreadId(), proc, hwnd, msgname, wParam, lParam, retvalue );
+
+    WIN_RestoreWndsLock(iWndsLocks);
+    
     return retvalue;
 }
 


More information about the wine-patches mailing list