user: Use a winproc callback instead of a message map/unmap in SendMessageTimeoutA.

This commit is contained in:
Alexandre Julliard 2006-05-18 19:47:40 +02:00
parent 521ea482aa
commit 396ff0007c
3 changed files with 20 additions and 17 deletions

View File

@ -2383,6 +2383,16 @@ LRESULT WINAPI SendMessageTimeoutW( HWND hwnd, UINT msg, WPARAM wparam, LPARAM l
return ret; return ret;
} }
static LRESULT send_inter_thread_callback( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp,
LRESULT *result, void *arg )
{
struct send_message_info *info = arg;
info->hwnd = hwnd;
info->msg = msg;
info->wparam = wp;
info->lparam = lp;
return send_inter_thread_message( info, result );
}
/*********************************************************************** /***********************************************************************
* SendMessageTimeoutA (USER32.@) * SendMessageTimeoutA (USER32.@)
@ -2429,13 +2439,8 @@ LRESULT WINAPI SendMessageTimeoutA( HWND hwnd, UINT msg, WPARAM wparam, LPARAM l
/* inter-process message: need to map to Unicode */ /* inter-process message: need to map to Unicode */
info.type = MSG_OTHER_PROCESS; info.type = MSG_OTHER_PROCESS;
if (is_unicode_message( info.msg )) if (is_unicode_message( info.msg ))
{ ret = WINPROC_CallProcAtoW( send_inter_thread_callback, info.hwnd, info.msg,
if (WINPROC_MapMsg32ATo32W( info.hwnd, info.msg, &info.wparam, &info.lparam ) == -1) info.wparam, info.lparam, &result, &info );
return 0;
ret = send_inter_thread_message( &info, &result );
result = WINPROC_UnmapMsg32ATo32W( info.hwnd, info.msg, info.wparam,
info.lparam, result, NULL );
}
else ret = send_inter_thread_message( &info, &result ); else ret = send_inter_thread_message( &info, &result );
} }
SPY_ExitMessage( SPY_RESULT_OK, hwnd, msg, result, wparam, lparam ); SPY_ExitMessage( SPY_RESULT_OK, hwnd, msg, result, wparam, lparam );

View File

@ -688,7 +688,7 @@ inline static BOOL WINPROC_TestLBForStr( HWND hwnd, UINT msg )
* the first four bytes are the handle of the icon * the first four bytes are the handle of the icon
* when the WM_SETTEXT message has been used to set the icon * when the WM_SETTEXT message has been used to set the icon
*/ */
INT WINPROC_MapMsg32ATo32W( HWND hwnd, UINT msg, WPARAM *pwparam, LPARAM *plparam ) static INT WINPROC_MapMsg32ATo32W( HWND hwnd, UINT msg, WPARAM *pwparam, LPARAM *plparam )
{ {
switch(msg) switch(msg)
{ {
@ -859,8 +859,8 @@ INT WINPROC_MapMsg32ATo32W( HWND hwnd, UINT msg, WPARAM *pwparam, LPARAM *plpara
* *
* Unmap a message that was mapped from Ansi to Unicode. * Unmap a message that was mapped from Ansi to Unicode.
*/ */
LRESULT WINPROC_UnmapMsg32ATo32W( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, static LRESULT WINPROC_UnmapMsg32ATo32W( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam,
LRESULT result, WNDPROC dispatch ) LRESULT result, WNDPROC dispatch )
{ {
switch(msg) switch(msg)
{ {
@ -2642,8 +2642,8 @@ void WINPROC_UnmapMsg32WTo16( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam,
* *
* Call a window procedure, translating args from Ansi to Unicode. * Call a window procedure, translating args from Ansi to Unicode.
*/ */
static LRESULT WINPROC_CallProcAtoW( winproc_callback_t callback, HWND hwnd, UINT msg, WPARAM wParam, LRESULT WINPROC_CallProcAtoW( winproc_callback_t callback, HWND hwnd, UINT msg, WPARAM wParam,
LPARAM lParam, LRESULT *result, void *arg ) LPARAM lParam, LRESULT *result, void *arg )
{ {
LRESULT ret; LRESULT ret;
int unmap; int unmap;

View File

@ -55,8 +55,9 @@ extern WNDPROC WINPROC_GetProc( WNDPROC proc, BOOL unicode );
extern WNDPROC WINPROC_AllocProc( WNDPROC funcA, WNDPROC funcW ); extern WNDPROC WINPROC_AllocProc( WNDPROC funcA, WNDPROC funcW );
extern BOOL WINPROC_IsUnicode( WNDPROC proc, BOOL def_val ); extern BOOL WINPROC_IsUnicode( WNDPROC proc, BOOL def_val );
extern INT WINPROC_MapMsg32ATo32W( HWND hwnd, UINT msg, WPARAM *pwparam, extern LRESULT WINPROC_CallProcAtoW( winproc_callback_t callback, HWND hwnd, UINT msg,
LPARAM *plparam ); WPARAM wParam, LPARAM lParam, LRESULT *result, void *arg );
extern INT WINPROC_MapMsg16To32A( HWND hwnd, UINT16 msg16, WPARAM16 wParam16, extern INT WINPROC_MapMsg16To32A( HWND hwnd, UINT16 msg16, WPARAM16 wParam16,
UINT *pmsg32, WPARAM *pwparam32, UINT *pmsg32, WPARAM *pwparam32,
LPARAM *plparam ); LPARAM *plparam );
@ -69,9 +70,6 @@ extern INT WINPROC_MapMsg32ATo16( HWND hwnd, UINT msg32,
extern INT WINPROC_MapMsg32WTo16( HWND hwnd, UINT msg32, extern INT WINPROC_MapMsg32WTo16( HWND hwnd, UINT msg32,
WPARAM wParam32, UINT16 *pmsg16, WPARAM wParam32, UINT16 *pmsg16,
WPARAM16 *pwparam16, LPARAM *plparam ); WPARAM16 *pwparam16, LPARAM *plparam );
extern LRESULT WINPROC_UnmapMsg32ATo32W( HWND hwnd, UINT msg, WPARAM wParam,
LPARAM lParam, LRESULT result,
WNDPROC dispatch );
extern LRESULT WINPROC_UnmapMsg16To32A( HWND hwnd, UINT msg, WPARAM wParam, extern LRESULT WINPROC_UnmapMsg16To32A( HWND hwnd, UINT msg, WPARAM wParam,
LPARAM lParam, LRESULT result ); LPARAM lParam, LRESULT result );
extern LRESULT WINPROC_UnmapMsg16To32W( HWND hwnd, UINT msg, WPARAM wParam, extern LRESULT WINPROC_UnmapMsg16To32W( HWND hwnd, UINT msg, WPARAM wParam,