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

Alexandre Julliard julliard at wine.codeweavers.com
Sat May 20 11:22:34 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: 396ff0007c01937c4718fd9c65b5279c9117592e
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=396ff0007c01937c4718fd9c65b5279c9117592e

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Thu May 18 19:47:40 2006 +0200

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

---

 dlls/user/message.c |   19 ++++++++++++-------
 dlls/user/winproc.c |   10 +++++-----
 dlls/user/winproc.h |    8 +++-----
 3 files changed, 20 insertions(+), 17 deletions(-)

diff --git a/dlls/user/message.c b/dlls/user/message.c
index 1b86200..be50bfc 100644
--- a/dlls/user/message.c
+++ b/dlls/user/message.c
@@ -2383,6 +2383,16 @@ LRESULT WINAPI SendMessageTimeoutW( HWND
     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.@)
@@ -2429,13 +2439,8 @@ LRESULT WINAPI SendMessageTimeoutA( HWND
         /* inter-process message: need to map to Unicode */
         info.type = MSG_OTHER_PROCESS;
         if (is_unicode_message( info.msg ))
-        {
-            if (WINPROC_MapMsg32ATo32W( info.hwnd, info.msg, &info.wparam, &info.lparam ) == -1)
-                return 0;
-            ret = send_inter_thread_message( &info, &result );
-            result = WINPROC_UnmapMsg32ATo32W( info.hwnd, info.msg, info.wparam,
-                                               info.lparam, result, NULL );
-        }
+            ret = WINPROC_CallProcAtoW( send_inter_thread_callback, info.hwnd, info.msg,
+                                        info.wparam, info.lparam, &result, &info );
         else ret = send_inter_thread_message( &info, &result );
     }
     SPY_ExitMessage( SPY_RESULT_OK, hwnd, msg, result, wparam, lparam );
diff --git a/dlls/user/winproc.c b/dlls/user/winproc.c
index db8b5ae..c278451 100644
--- a/dlls/user/winproc.c
+++ b/dlls/user/winproc.c
@@ -688,7 +688,7 @@ inline static BOOL WINPROC_TestLBForStr(
  *  the first four bytes are the handle of 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)
     {
@@ -859,8 +859,8 @@ INT WINPROC_MapMsg32ATo32W( HWND hwnd, U
  *
  * Unmap a message that was mapped from Ansi to Unicode.
  */
-LRESULT WINPROC_UnmapMsg32ATo32W( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam,
-                                  LRESULT result, WNDPROC dispatch )
+static LRESULT WINPROC_UnmapMsg32ATo32W( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam,
+                                         LRESULT result, WNDPROC dispatch )
 {
     switch(msg)
     {
@@ -2642,8 +2642,8 @@ void WINPROC_UnmapMsg32WTo16( HWND hwnd,
  *
  * Call a window procedure, translating args from Ansi to Unicode.
  */
-static LRESULT WINPROC_CallProcAtoW( winproc_callback_t callback, HWND hwnd, UINT msg, WPARAM wParam,
-                                     LPARAM lParam, LRESULT *result, void *arg )
+LRESULT WINPROC_CallProcAtoW( winproc_callback_t callback, HWND hwnd, UINT msg, WPARAM wParam,
+                              LPARAM lParam, LRESULT *result, void *arg )
 {
     LRESULT ret;
     int unmap;
diff --git a/dlls/user/winproc.h b/dlls/user/winproc.h
index 02d96cf..e80c295 100644
--- a/dlls/user/winproc.h
+++ b/dlls/user/winproc.h
@@ -55,8 +55,9 @@ extern WNDPROC WINPROC_GetProc( WNDPROC 
 extern WNDPROC WINPROC_AllocProc( WNDPROC funcA, WNDPROC funcW );
 extern BOOL WINPROC_IsUnicode( WNDPROC proc, BOOL def_val );
 
-extern INT WINPROC_MapMsg32ATo32W( HWND hwnd, UINT msg, WPARAM *pwparam,
-                                     LPARAM *plparam );
+extern LRESULT WINPROC_CallProcAtoW( winproc_callback_t callback, HWND hwnd, UINT msg,
+                                     WPARAM wParam, LPARAM lParam, LRESULT *result, void *arg );
+
 extern INT WINPROC_MapMsg16To32A( HWND hwnd, UINT16 msg16, WPARAM16 wParam16,
                                     UINT *pmsg32, WPARAM *pwparam32,
                                     LPARAM *plparam );
@@ -69,9 +70,6 @@ extern INT WINPROC_MapMsg32ATo16( HWND h
 extern INT WINPROC_MapMsg32WTo16( HWND hwnd, UINT msg32,
                                     WPARAM wParam32, UINT16 *pmsg16,
                                     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,
                                         LPARAM lParam, LRESULT result );
 extern LRESULT WINPROC_UnmapMsg16To32W( HWND hwnd, UINT msg, WPARAM wParam,




More information about the wine-cvs mailing list