Commit db9b5492 authored by Guy L. Albertelli's avatar Guy L. Albertelli Committed by Alexandre Julliard

Enhance SPY_GetMsgName to translate common control messages.

parent 6a3ae04c
...@@ -1859,7 +1859,7 @@ static LRESULT ComboWndProc_common( HWND hwnd, UINT message, ...@@ -1859,7 +1859,7 @@ static LRESULT ComboWndProc_common( HWND hwnd, UINT message,
LPHEADCOMBO lphc = (LPHEADCOMBO)GetWindowLongA( hwnd, 0 ); LPHEADCOMBO lphc = (LPHEADCOMBO)GetWindowLongA( hwnd, 0 );
TRACE("[%04x]: msg %s wp %08x lp %08lx\n", TRACE("[%04x]: msg %s wp %08x lp %08lx\n",
hwnd, SPY_GetMsgName(message), wParam, lParam ); hwnd, SPY_GetMsgName(message, hwnd), wParam, lParam );
if( lphc || message == WM_NCCREATE ) if( lphc || message == WM_NCCREATE )
switch(message) switch(message)
......
...@@ -2478,7 +2478,7 @@ static LRESULT WINAPI ListBoxWndProc_common( HWND hwnd, UINT msg, ...@@ -2478,7 +2478,7 @@ static LRESULT WINAPI ListBoxWndProc_common( HWND hwnd, UINT msg,
} }
TRACE("[%04x]: msg %s wp %08x lp %08lx\n", TRACE("[%04x]: msg %s wp %08x lp %08lx\n",
hwnd, SPY_GetMsgName(msg), wParam, lParam ); hwnd, SPY_GetMsgName(msg, hwnd), wParam, lParam );
switch(msg) switch(msg)
{ {
case LB_RESETCONTENT16: case LB_RESETCONTENT16:
...@@ -3041,7 +3041,7 @@ static LRESULT WINAPI ComboLBWndProc_common( HWND hwnd, UINT msg, ...@@ -3041,7 +3041,7 @@ static LRESULT WINAPI ComboLBWndProc_common( HWND hwnd, UINT msg,
LB_DESCR *descr = (LB_DESCR *)GetWindowLongA( hwnd, 0 ); LB_DESCR *descr = (LB_DESCR *)GetWindowLongA( hwnd, 0 );
TRACE_(combo)("[%04x]: msg %s wp %08x lp %08lx\n", TRACE_(combo)("[%04x]: msg %s wp %08x lp %08lx\n",
hwnd, SPY_GetMsgName(msg), wParam, lParam ); hwnd, SPY_GetMsgName(msg, hwnd), wParam, lParam );
if( descr || msg == WM_CREATE ) if( descr || msg == WM_CREATE )
{ {
......
...@@ -567,7 +567,7 @@ static size_t pack_message( HWND hwnd, UINT message, WPARAM wparam, LPARAM lpara ...@@ -567,7 +567,7 @@ static size_t pack_message( HWND hwnd, UINT message, WPARAM wparam, LPARAM lpara
case WM_DRAGSELECT: case WM_DRAGSELECT:
case WM_DRAGMOVE: case WM_DRAGMOVE:
case WM_DEVICECHANGE: case WM_DEVICECHANGE:
FIXME( "msg %x (%s) not supported yet\n", message, SPY_GetMsgName(message) ); FIXME( "msg %x (%s) not supported yet\n", message, SPY_GetMsgName(message, hwnd) );
data->count = -1; data->count = -1;
return 0; return 0;
} }
...@@ -813,7 +813,7 @@ static BOOL unpack_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lpa ...@@ -813,7 +813,7 @@ static BOOL unpack_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lpa
case WM_DRAGSELECT: case WM_DRAGSELECT:
case WM_DRAGMOVE: case WM_DRAGMOVE:
case WM_DEVICECHANGE: case WM_DEVICECHANGE:
FIXME( "msg %x (%s) not supported yet\n", message, SPY_GetMsgName(message) ); FIXME( "msg %x (%s) not supported yet\n", message, SPY_GetMsgName(message, hwnd) );
return FALSE; return FALSE;
default: default:
...@@ -1203,7 +1203,7 @@ BOOL MSG_peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, int flags ) ...@@ -1203,7 +1203,7 @@ BOOL MSG_peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, int flags )
&info.msg.lParam, &buffer, size )) &info.msg.lParam, &buffer, size ))
{ {
ERR( "invalid packed message %x (%s) hwnd %x wp %x lp %lx size %d\n", ERR( "invalid packed message %x (%s) hwnd %x wp %x lp %lx size %d\n",
info.msg.message, SPY_GetMsgName(info.msg.message), info.msg.hwnd, info.msg.message, SPY_GetMsgName(info.msg.message, info.msg.hwnd), info.msg.hwnd,
info.msg.wParam, info.msg.lParam, size ); info.msg.wParam, info.msg.lParam, size );
/* ignore it */ /* ignore it */
reply_message( &info, 0, TRUE ); reply_message( &info, 0, TRUE );
...@@ -1424,7 +1424,7 @@ static LRESULT retrieve_reply( const struct send_message_info *info, ...@@ -1424,7 +1424,7 @@ static LRESULT retrieve_reply( const struct send_message_info *info,
} }
TRACE( "hwnd %x msg %x (%s) wp %x lp %lx got reply %lx (err=%ld)\n", TRACE( "hwnd %x msg %x (%s) wp %x lp %lx got reply %lx (err=%ld)\n",
info->hwnd, info->msg, SPY_GetMsgName(info->msg), info->wparam, info->hwnd, info->msg, SPY_GetMsgName(info->msg, info->hwnd), info->wparam,
info->lparam, *result, status ); info->lparam, *result, status );
if (!status) return 1; if (!status) return 1;
...@@ -1445,7 +1445,7 @@ static LRESULT send_inter_thread_message( DWORD dest_tid, const struct send_mess ...@@ -1445,7 +1445,7 @@ static LRESULT send_inter_thread_message( DWORD dest_tid, const struct send_mess
size_t reply_size = 0; size_t reply_size = 0;
TRACE( "hwnd %x msg %x (%s) wp %x lp %lx\n", TRACE( "hwnd %x msg %x (%s) wp %x lp %lx\n",
info->hwnd, info->msg, SPY_GetMsgName(info->msg), info->wparam, info->lparam ); info->hwnd, info->msg, SPY_GetMsgName(info->msg, info->hwnd), info->wparam, info->lparam );
if (!put_message_in_queue( dest_tid, info, &reply_size )) return 0; if (!put_message_in_queue( dest_tid, info, &reply_size )) return 0;
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#define SPY_RESULT_DEFWND 0x0005 #define SPY_RESULT_DEFWND 0x0005
extern const char *SPY_GetMsgName( UINT msg ); extern const char *SPY_GetMsgName( UINT msg, HWND hWnd );
extern const char *SPY_GetVKeyName(WPARAM wParam); extern const char *SPY_GetVKeyName(WPARAM wParam);
extern void SPY_EnterMessage( INT iFlag, HWND hwnd, UINT msg, extern void SPY_EnterMessage( INT iFlag, HWND hwnd, UINT msg,
WPARAM wParam, LPARAM lParam ); WPARAM wParam, LPARAM lParam );
......
...@@ -830,7 +830,7 @@ BOOL WINAPI TranslateMessage( const MSG *msg ) ...@@ -830,7 +830,7 @@ BOOL WINAPI TranslateMessage( const MSG *msg )
if (msg->message >= WM_KEYFIRST && msg->message <= WM_KEYLAST) if (msg->message >= WM_KEYFIRST && msg->message <= WM_KEYLAST)
TRACE_(key)("(%s, %04X, %08lX)\n", 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; if ((msg->message != WM_KEYDOWN) && (msg->message != WM_SYSKEYDOWN)) return FALSE;
...@@ -864,14 +864,14 @@ BOOL WINAPI TranslateMessage( const MSG *msg ) ...@@ -864,14 +864,14 @@ BOOL WINAPI TranslateMessage( const MSG *msg )
} }
dead_char = 0; 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 ); PostMessageW( msg->hwnd, message, wp[0], msg->lParam );
return TRUE; return TRUE;
case -1: case -1:
message = (msg->message == WM_KEYDOWN) ? WM_DEADCHAR : WM_SYSDEADCHAR; message = (msg->message == WM_KEYDOWN) ? WM_DEADCHAR : WM_SYSDEADCHAR;
dead_char = wp[0]; 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 ); PostMessageW( msg->hwnd, message, wp[0], msg->lParam );
return TRUE; return TRUE;
} }
......
...@@ -1579,11 +1579,14 @@ typedef struct ...@@ -1579,11 +1579,14 @@ typedef struct
CHAR wnd_name[16]; /* window name for message */ CHAR wnd_name[16]; /* window name for message */
} SPY_INSTANCE; } SPY_INSTANCE;
/* This is defined so that the external entry point can return the addr */
static SPY_INSTANCE ext_sp_e;
/*********************************************************************** /***********************************************************************
* SPY_GetMsgInternal * 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]; static char msg_buffer[20];
...@@ -1673,7 +1676,7 @@ static void SPY_GetMsgStuff( SPY_INSTANCE *sp_e ) ...@@ -1673,7 +1676,7 @@ static void SPY_GetMsgStuff( SPY_INSTANCE *sp_e )
const USER_MSG *p; const USER_MSG *p;
sp_e->msg_name[sizeof(sp_e->msg_name)-1] = 0; 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); sizeof(sp_e->msg_name)-1);
sp_e->data_len = 0; sp_e->data_len = 0;
...@@ -1699,18 +1702,6 @@ static void SPY_GetMsgStuff( SPY_INSTANCE *sp_e ) ...@@ -1699,18 +1702,6 @@ static void SPY_GetMsgStuff( SPY_INSTANCE *sp_e )
} }
/*********************************************************************** /***********************************************************************
* SPY_GetMsgName
*
* **** External function ****
*
* Get message name
*/
const char *SPY_GetMsgName( UINT msg )
{
return SPY_GetMsgInternal( msg, FALSE );
}
/***********************************************************************
* SPY_GetWndName * SPY_GetWndName
* *
* Sets the value of "wnd_name" and "wnd_class" members of the * Sets the value of "wnd_name" and "wnd_class" members of the
...@@ -1766,6 +1757,24 @@ void SPY_GetWndName( SPY_INSTANCE *sp_e ) ...@@ -1766,6 +1757,24 @@ void SPY_GetWndName( SPY_INSTANCE *sp_e )
} }
/*********************************************************************** /***********************************************************************
* 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 * SPY_GetVKeyName
*/ */
const char *SPY_GetVKeyName(WPARAM wParam) const char *SPY_GetVKeyName(WPARAM wParam)
......
...@@ -165,7 +165,7 @@ static LRESULT WINPROC_CallWndProc( WNDPROC proc, HWND hwnd, UINT msg, ...@@ -165,7 +165,7 @@ static LRESULT WINPROC_CallWndProc( WNDPROC proc, HWND hwnd, UINT msg,
hwnd = WIN_GetFullHandle( hwnd ); hwnd = WIN_GetFullHandle( hwnd );
if (TRACE_ON(relay)) if (TRACE_ON(relay))
DPRINTF( "%08lx:Call window proc %p (hwnd=%08x,msg=%s,wp=%08x,lp=%08lx)\n", 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 /* To avoid any deadlocks, all the locks on the windows structures
must be suspended before the control is passed to the application */ must be suspended before the control is passed to the application */
iWndsLocks = WIN_SuspendWndsLock(); iWndsLocks = WIN_SuspendWndsLock();
...@@ -174,7 +174,7 @@ static LRESULT WINPROC_CallWndProc( WNDPROC proc, HWND hwnd, UINT msg, ...@@ -174,7 +174,7 @@ static LRESULT WINPROC_CallWndProc( WNDPROC proc, HWND hwnd, UINT msg,
if (TRACE_ON(relay)) if (TRACE_ON(relay))
DPRINTF( "%08lx:Ret window proc %p (hwnd=%08x,msg=%s,wp=%08x,lp=%08lx) retval=%08lx\n", 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; return retvalue;
} }
...@@ -680,7 +680,7 @@ INT WINPROC_MapMsg32ATo32W( HWND hwnd, UINT msg, WPARAM *pwparam, LPARAM *plpara ...@@ -680,7 +680,7 @@ INT WINPROC_MapMsg32ATo32W( HWND hwnd, UINT msg, WPARAM *pwparam, LPARAM *plpara
case WM_PAINTCLIPBOARD: case WM_PAINTCLIPBOARD:
case WM_SIZECLIPBOARD: 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; return -1;
default: /* No translation needed */ default: /* No translation needed */
return 0; return 0;
...@@ -936,7 +936,7 @@ INT WINPROC_MapMsg32WTo32A( HWND hwnd, UINT msg, WPARAM *pwparam, LPARAM *plpara ...@@ -936,7 +936,7 @@ INT WINPROC_MapMsg32WTo32A( HWND hwnd, UINT msg, WPARAM *pwparam, LPARAM *plpara
case WM_PAINTCLIPBOARD: case WM_PAINTCLIPBOARD:
case WM_SIZECLIPBOARD: 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; return -1;
default: /* No translation needed */ default: /* No translation needed */
return 0; return 0;
...@@ -2405,7 +2405,7 @@ static LRESULT WINPROC_CallProc32ATo32W( WNDPROC func, HWND hwnd, ...@@ -2405,7 +2405,7 @@ static LRESULT WINPROC_CallProc32ATo32W( WNDPROC func, HWND hwnd,
if( (unmap = WINPROC_MapMsg32ATo32W( hwnd, msg, &wParam, &lParam )) == -1) { if( (unmap = WINPROC_MapMsg32ATo32W( hwnd, msg, &wParam, &lParam )) == -1) {
ERR_(msg)("Message translation failed. (msg=%s,wp=%08x,lp=%08lx)\n", 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; return 0;
} }
result = WINPROC_CallWndProc( func, hwnd, msg, wParam, lParam ); result = WINPROC_CallWndProc( func, hwnd, msg, wParam, lParam );
...@@ -2428,7 +2428,7 @@ static LRESULT WINPROC_CallProc32WTo32A( WNDPROC func, HWND hwnd, ...@@ -2428,7 +2428,7 @@ static LRESULT WINPROC_CallProc32WTo32A( WNDPROC func, HWND hwnd,
if ((unmap = WINPROC_MapMsg32WTo32A( hwnd, msg, &wParam, &lParam )) == -1) { if ((unmap = WINPROC_MapMsg32WTo32A( hwnd, msg, &wParam, &lParam )) == -1) {
ERR_(msg)("Message translation failed. (msg=%s,wp=%08x,lp=%08lx)\n", 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; return 0;
} }
result = WINPROC_CallWndProc( func, hwnd, msg, wParam, lParam ); result = WINPROC_CallWndProc( func, hwnd, msg, wParam, lParam );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment