Zebediah Figura : user32: Use the given string length when converting strings in WM_GETTEXT.
Alexandre Julliard
julliard at winehq.org
Mon Nov 6 14:37:35 CST 2017
Module: wine
Branch: master
Commit: 9b7f9f2d08f39aa41b8a4b10331b9d0ba20beb6c
URL: http://source.winehq.org/git/wine.git/?a=commit;h=9b7f9f2d08f39aa41b8a4b10331b9d0ba20beb6c
Author: Zebediah Figura <z.figura12 at gmail.com>
Date: Sat Nov 4 17:48:11 2017 -0500
user32: Use the given string length when converting strings in WM_GETTEXT.
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/user32/tests/win.c | 4 ----
dlls/user32/winproc.c | 4 ++--
2 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c
index 5806f81..feca2be 100644
--- a/dlls/user32/tests/win.c
+++ b/dlls/user32/tests/win.c
@@ -6932,10 +6932,8 @@ static void test_gettext(void)
memset( bufW, 0x1c, sizeof(bufW) );
g_wm_gettext_override.dont_terminate = TRUE;
buf_len = GetWindowTextW( hwnd, bufW, sizeof(bufW)/sizeof(bufW[0]) );
-todo_wine
ok( buf_len == 4, "Unexpected text length, %d\n", buf_len );
ok( !memcmp(bufW, textW, 4 * sizeof(WCHAR)), "Unexpected window text, %s\n", wine_dbgstr_w(bufW) );
-todo_wine
ok( bufW[4] == 0, "Unexpected buffer contents, %#x\n", bufW[4] );
g_wm_gettext_override.dont_terminate = FALSE;
@@ -6945,10 +6943,8 @@ todo_wine
memset( buf, 0x1c, sizeof(buf) );
g_wm_gettext_override.dont_terminate = TRUE;
buf_len = GetWindowTextA( hwnd2, buf, sizeof(buf) );
-todo_wine
ok( buf_len == 4, "Unexpected text length, %d\n", buf_len );
ok( !memcmp(buf, "text", 4), "Unexpected window text, '%s'\n", buf );
-todo_wine
ok( buf[4] == 0, "Unexpected buffer contents, %#x\n", buf[4] );
g_wm_gettext_override.dont_terminate = FALSE;
diff --git a/dlls/user32/winproc.c b/dlls/user32/winproc.c
index aa71c8e..904a350 100644
--- a/dlls/user32/winproc.c
+++ b/dlls/user32/winproc.c
@@ -460,7 +460,7 @@ LRESULT WINPROC_CallProcAtoW( winproc_callback_t callback, HWND hwnd, UINT msg,
{
len = 0;
if (*result)
- RtlUnicodeToMultiByteN( str, wParam - 1, &len, ptr, strlenW(ptr) * sizeof(WCHAR) );
+ RtlUnicodeToMultiByteN( str, wParam - 1, &len, ptr, ret * sizeof(WCHAR) );
str[len] = 0;
*result = len;
}
@@ -682,7 +682,7 @@ static LRESULT WINPROC_CallProcWtoA( winproc_callback_t callback, HWND hwnd, UIN
{
if (*result)
{
- RtlMultiByteToUnicodeN( (LPWSTR)lParam, wParam*sizeof(WCHAR), &len, ptr, strlen(ptr)+1 );
+ RtlMultiByteToUnicodeN( (LPWSTR)lParam, wParam*sizeof(WCHAR), &len, ptr, ret + 1 );
*result = len/sizeof(WCHAR) - 1; /* do not count terminating null */
}
((LPWSTR)lParam)[*result] = 0;
More information about the wine-cvs
mailing list