Enhance SPY_GetMsgName to translate common control messages.
diff --git a/windows/message.c b/windows/message.c index 2134854..1a68a22 100644 --- a/windows/message.c +++ b/windows/message.c
@@ -830,7 +830,7 @@ if (msg->message >= WM_KEYFIRST && msg->message <= WM_KEYLAST) TRACE_(key)("(%s, %04X, %08lX)\n", - SPY_GetMsgName(msg->message), msg->wParam, msg->lParam ); + SPY_GetMsgName(msg->message, msg->hwnd), msg->wParam, msg->lParam ); if ((msg->message != WM_KEYDOWN) && (msg->message != WM_SYSKEYDOWN)) return FALSE; @@ -864,14 +864,14 @@ } dead_char = 0; } - TRACE_(key)("1 -> PostMessage(%s)\n", SPY_GetMsgName(message)); + TRACE_(key)("1 -> PostMessage(%s)\n", SPY_GetMsgName(message, msg->hwnd)); PostMessageW( msg->hwnd, message, wp[0], msg->lParam ); return TRUE; case -1: message = (msg->message == WM_KEYDOWN) ? WM_DEADCHAR : WM_SYSDEADCHAR; dead_char = wp[0]; - TRACE_(key)("-1 -> PostMessage(%s)\n", SPY_GetMsgName(message)); + TRACE_(key)("-1 -> PostMessage(%s)\n", SPY_GetMsgName(message, msg->hwnd)); PostMessageW( msg->hwnd, message, wp[0], msg->lParam ); return TRUE; }
diff --git a/windows/spy.c b/windows/spy.c index c3c4bbc..1a39607 100644 --- a/windows/spy.c +++ b/windows/spy.c
@@ -1579,11 +1579,14 @@ CHAR wnd_name[16]; /* window name for message */ } SPY_INSTANCE; +/* This is defined so that the external entry point can return the addr */ +static SPY_INSTANCE ext_sp_e; + /*********************************************************************** * SPY_GetMsgInternal */ -static const char *SPY_GetMsgInternal( UINT msg, BOOL support_common_clts ) +static const char *SPY_GetMsgInternal( UINT msg ) { static char msg_buffer[20]; @@ -1673,7 +1676,7 @@ const USER_MSG *p; sp_e->msg_name[sizeof(sp_e->msg_name)-1] = 0; - strncpy (sp_e->msg_name, SPY_GetMsgInternal( sp_e->msgnum, TRUE ), + strncpy (sp_e->msg_name, SPY_GetMsgInternal( sp_e->msgnum ), sizeof(sp_e->msg_name)-1); sp_e->data_len = 0; @@ -1699,18 +1702,6 @@ } /*********************************************************************** - * SPY_GetMsgName - * - * **** External function **** - * - * Get message name - */ -const char *SPY_GetMsgName( UINT msg ) -{ - return SPY_GetMsgInternal( msg, FALSE ); -} - -/*********************************************************************** * SPY_GetWndName * * Sets the value of "wnd_name" and "wnd_class" members of the @@ -1766,6 +1757,24 @@ } /*********************************************************************** + * SPY_GetMsgName + * + * **** External function **** + * + * Get message name + */ +const char *SPY_GetMsgName( UINT msg, HWND hWnd ) +{ + ext_sp_e.msgnum = msg; + ext_sp_e.msg_hwnd = hWnd; + ext_sp_e.lParam = 0; + ext_sp_e.wParam = 0; + SPY_GetWndName(&ext_sp_e); + SPY_GetMsgStuff(&ext_sp_e); + return ext_sp_e.msg_name; +} + +/*********************************************************************** * SPY_GetVKeyName */ const char *SPY_GetVKeyName(WPARAM wParam)
diff --git a/windows/winproc.c b/windows/winproc.c index 21dcca4..0219135 100644 --- a/windows/winproc.c +++ b/windows/winproc.c
@@ -165,7 +165,7 @@ hwnd = WIN_GetFullHandle( hwnd ); if (TRACE_ON(relay)) DPRINTF( "%08lx:Call window proc %p (hwnd=%08x,msg=%s,wp=%08x,lp=%08lx)\n", - GetCurrentThreadId(), proc, hwnd, SPY_GetMsgName(msg), wParam, lParam ); + 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(); @@ -174,7 +174,7 @@ if (TRACE_ON(relay)) DPRINTF( "%08lx:Ret window proc %p (hwnd=%08x,msg=%s,wp=%08x,lp=%08lx) retval=%08lx\n", - GetCurrentThreadId(), proc, hwnd, SPY_GetMsgName(msg), wParam, lParam, retvalue ); + GetCurrentThreadId(), proc, hwnd, SPY_GetMsgName(msg, hwnd), wParam, lParam, retvalue ); return retvalue; } @@ -680,7 +680,7 @@ case WM_PAINTCLIPBOARD: case WM_SIZECLIPBOARD: - FIXME_(msg)("message %s (0x%x) needs translation, please report\n", SPY_GetMsgName(msg), msg ); + FIXME_(msg)("message %s (0x%x) needs translation, please report\n", SPY_GetMsgName(msg, hwnd), msg ); return -1; default: /* No translation needed */ return 0; @@ -936,7 +936,7 @@ case WM_PAINTCLIPBOARD: case WM_SIZECLIPBOARD: - FIXME_(msg)("message %s (%04x) needs translation, please report\n",SPY_GetMsgName(msg),msg ); + FIXME_(msg)("message %s (%04x) needs translation, please report\n",SPY_GetMsgName(msg, hwnd),msg ); return -1; default: /* No translation needed */ return 0; @@ -2405,7 +2405,7 @@ if( (unmap = WINPROC_MapMsg32ATo32W( hwnd, msg, &wParam, &lParam )) == -1) { ERR_(msg)("Message translation failed. (msg=%s,wp=%08x,lp=%08lx)\n", - SPY_GetMsgName(msg), wParam, lParam ); + SPY_GetMsgName(msg, hwnd), wParam, lParam ); return 0; } result = WINPROC_CallWndProc( func, hwnd, msg, wParam, lParam ); @@ -2428,7 +2428,7 @@ if ((unmap = WINPROC_MapMsg32WTo32A( hwnd, msg, &wParam, &lParam )) == -1) { ERR_(msg)("Message translation failed. (msg=%s,wp=%08x,lp=%08lx)\n", - SPY_GetMsgName(msg), wParam, lParam ); + SPY_GetMsgName(msg, hwnd), wParam, lParam ); return 0; } result = WINPROC_CallWndProc( func, hwnd, msg, wParam, lParam );