Alexandre Julliard : user: Use winproc callbacks instead of message
map/ unmap in SendMessage16.
Alexandre Julliard
julliard at wine.codeweavers.com
Sat May 20 11:22:34 CDT 2006
Module: wine
Branch: refs/heads/master
Commit: 58a03a103d0de6e2d8fa87fb8952f69fd239a20c
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=58a03a103d0de6e2d8fa87fb8952f69fd239a20c
Author: Alexandre Julliard <julliard at winehq.org>
Date: Sat May 20 16:32:45 2006 +0200
user: Use winproc callbacks instead of message map/unmap in SendMessage16.
---
dlls/user/msg16.c | 46 +++++++++++++++++++++++-----------------------
dlls/user/winproc.c | 4 ++--
dlls/user/winproc.h | 2 ++
3 files changed, 27 insertions(+), 25 deletions(-)
diff --git a/dlls/user/msg16.c b/dlls/user/msg16.c
index e61fef3..e8b9d4c 100644
--- a/dlls/user/msg16.c
+++ b/dlls/user/msg16.c
@@ -30,14 +30,33 @@ WINE_DEFAULT_DEBUG_CHANNEL(msg);
DWORD USER16_AlertableWait = 0;
+static LRESULT cwp_hook_callback( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp,
+ LRESULT *result, void *arg )
+{
+ CWPSTRUCT cwp;
+
+ cwp.hwnd = hwnd;
+ cwp.message = msg;
+ cwp.wParam = wp;
+ cwp.lParam = lp;
+ *result = 0;
+ return HOOK_CallHooks( WH_CALLWNDPROC, HC_ACTION, 1, (LPARAM)&cwp, FALSE );
+}
+
+static LRESULT send_message_callback( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp,
+ LRESULT *result, void *arg )
+{
+ *result = SendMessageA( hwnd, msg, wp, lp );
+ return *result;
+}
+
+
/***********************************************************************
* SendMessage (USER.111)
*/
LRESULT WINAPI SendMessage16( HWND16 hwnd16, UINT16 msg, WPARAM16 wparam, LPARAM lparam )
{
LRESULT result;
- UINT msg32;
- WPARAM wparam32;
HWND hwnd = WIN_Handle32( hwnd16 );
if (hwnd != HWND_BROADCAST && WIN_IsCurrentThread(hwnd))
@@ -47,22 +66,7 @@ LRESULT WINAPI SendMessage16( HWND16 hwn
/* first the WH_CALLWNDPROC hook */
if (HOOK_IsHooked( WH_CALLWNDPROC ))
- {
- LPARAM lparam32 = lparam;
-
- if (WINPROC_MapMsg16To32A( hwnd, msg, wparam, &msg32, &wparam32, &lparam32 ) != -1)
- {
- CWPSTRUCT cwp;
-
- cwp.hwnd = hwnd;
- cwp.message = msg32;
- cwp.wParam = wparam32;
- cwp.lParam = lparam32;
- HOOK_CallHooks( WH_CALLWNDPROC, HC_ACTION, 1, (LPARAM)&cwp, FALSE );
- WINPROC_UnmapMsg16To32A( hwnd, msg32, wparam32, lparam32, 0 );
- /* FIXME: should reflect changes back into the message we send */
- }
- }
+ WINPROC_CallProc16To32A( cwp_hook_callback, hwnd16, msg, wparam, lparam, &result, NULL );
if (!(winproc = (WNDPROC16)GetWindowLong16( hwnd16, GWLP_WNDPROC ))) return 0;
@@ -72,11 +76,7 @@ LRESULT WINAPI SendMessage16( HWND16 hwn
}
else /* map to 32-bit unicode for inter-thread/process message */
{
- if (WINPROC_MapMsg16To32W( hwnd, msg, wparam, &msg32, &wparam32, &lparam ) == -1)
- return 0;
- result = WINPROC_UnmapMsg16To32W( hwnd, msg32, wparam32, lparam,
- SendMessageW( hwnd, msg32, wparam32, lparam ),
- NULL );
+ WINPROC_CallProc16To32A( send_message_callback, hwnd16, msg, wparam, lparam, &result, NULL );
}
return result;
}
diff --git a/dlls/user/winproc.c b/dlls/user/winproc.c
index c278451..37f9c79 100644
--- a/dlls/user/winproc.c
+++ b/dlls/user/winproc.c
@@ -2902,8 +2902,8 @@ static LRESULT WINPROC_CallProcWtoA( win
/**********************************************************************
* WINPROC_CallProc16To32A
*/
-static LRESULT WINPROC_CallProc16To32A( winproc_callback_t callback, HWND16 hwnd, UINT16 msg,
- WPARAM16 wParam, LPARAM lParam, LRESULT *result, void *arg )
+LRESULT WINPROC_CallProc16To32A( winproc_callback_t callback, HWND16 hwnd, UINT16 msg,
+ WPARAM16 wParam, LPARAM lParam, LRESULT *result, void *arg )
{
LRESULT ret;
UINT msg32;
diff --git a/dlls/user/winproc.h b/dlls/user/winproc.h
index e80c295..4db36d5 100644
--- a/dlls/user/winproc.h
+++ b/dlls/user/winproc.h
@@ -57,6 +57,8 @@ extern BOOL WINPROC_IsUnicode( WNDPROC p
extern LRESULT WINPROC_CallProcAtoW( winproc_callback_t callback, HWND hwnd, UINT msg,
WPARAM wParam, LPARAM lParam, LRESULT *result, void *arg );
+extern LRESULT WINPROC_CallProc16To32A( winproc_callback_t callback, HWND16 hwnd, UINT16 msg,
+ WPARAM16 wParam, LPARAM lParam, LRESULT *result, void *arg );
extern INT WINPROC_MapMsg16To32A( HWND hwnd, UINT16 msg16, WPARAM16 wParam16,
UINT *pmsg32, WPARAM *pwparam32,
More information about the wine-cvs
mailing list