Alexandre Julliard : user: Added fast A->
W mapping for WM_GETTEXTLENGTH and related messages.
Alexandre Julliard
julliard at wine.codeweavers.com
Mon May 22 05:19:08 CDT 2006
Module: wine
Branch: refs/heads/master
Commit: 0eec70f41031ad545d61e8054111401f9673b1d8
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=0eec70f41031ad545d61e8054111401f9673b1d8
Author: Alexandre Julliard <julliard at winehq.org>
Date: Sat May 20 19:58:38 2006 +0200
user: Added fast A->W mapping for WM_GETTEXTLENGTH and related messages.
---
dlls/user/winproc.c | 32 +++++++++++++++++++++++++++-----
1 files changed, 27 insertions(+), 5 deletions(-)
diff --git a/dlls/user/winproc.c b/dlls/user/winproc.c
index ae5b864..3dca3e9 100644
--- a/dlls/user/winproc.c
+++ b/dlls/user/winproc.c
@@ -770,11 +770,6 @@ static INT WINPROC_MapMsg32ATo32W( HWND
*plparam = (LPARAM)buf;
return (*plparam ? 1 : -1);
}
- case WM_GETTEXTLENGTH:
- case CB_GETLBTEXTLEN:
- case LB_GETTEXTLEN:
- return 1; /* need to map result */
-
case WM_PAINTCLIPBOARD:
case WM_SIZECLIPBOARD:
FIXME_(msg)("message %s (0x%x) needs translation, please report\n", SPY_GetMsgName(msg, hwnd), msg );
@@ -2704,6 +2699,33 @@ LRESULT WINPROC_CallProcAtoW( winproc_ca
ret = callback( hwnd, msg, map_wparam_char_AtoW(wParam,2), lParam, result, arg );
break;
+ case WM_GETTEXTLENGTH:
+ case CB_GETLBTEXTLEN:
+ case LB_GETTEXTLEN:
+ ret = callback( hwnd, msg, wParam, lParam, result, arg );
+ if (*result >= 0)
+ {
+ WCHAR *ptr, buffer[512];
+ LRESULT tmp;
+ DWORD len = *result + 1;
+ /* Determine respective GETTEXT message */
+ UINT msgGetText = (msg == WM_GETTEXTLENGTH) ? WM_GETTEXT :
+ ((msg == CB_GETLBTEXTLEN) ? CB_GETLBTEXT : LB_GETTEXT);
+ /* wParam differs between the messages */
+ WPARAM wp = (msg == WM_GETTEXTLENGTH) ? len : wParam;
+
+ if (!(ptr = get_buffer( buffer, sizeof(buffer), len * sizeof(WCHAR) ))) break;
+
+ if (callback == call_window_proc) /* FIXME: hack */
+ callback( hwnd, msgGetText, wp, (LPARAM)ptr, &tmp, arg );
+ else
+ tmp = SendMessageW( hwnd, msgGetText, wp, (LPARAM)ptr );
+ RtlUnicodeToMultiByteSize( &len, ptr, tmp * sizeof(WCHAR) );
+ *result = len;
+ free_buffer( buffer, ptr );
+ }
+ break;
+
default:
if( (unmap = WINPROC_MapMsg32ATo32W( hwnd, msg, &wParam, &lParam )) == -1) {
ERR_(msg)("Message translation failed. (msg=%s,wp=%08x,lp=%08lx)\n",
More information about the wine-cvs
mailing list