From b1132531bf6d9c589829f43bc049f29606934c86 Mon Sep 17 00:00:00 2001 From: Piotr Caban Date: Wed, 9 Mar 2016 13:51:43 +0100 Subject: [PATCH] user32/tests: Show that message conversion should work on window procedures without handles. Signed-off-by: Piotr Caban Signed-off-by: Alexandre Julliard --- dlls/user32/tests/win.c | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index e1218099627..cf7ddc85657 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -8686,8 +8686,30 @@ static LRESULT WINAPI winproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) return 0; } -static LRESULT WINAPI winproc2(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) +static LRESULT WINAPI winproc_convA(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { + if(msg == WM_SETTEXT) + { + const char *text = (const char*)lparam; + + ok(!wparam, "wparam = %08lx\n", wparam); + ok(!strcmp(text, "text"), "WM_SETTEXT lparam = %s\n", text); + return 1; + } + return 0; +} + +static const WCHAR textW[] = {'t','e','x','t',0}; +static LRESULT WINAPI winproc_convW(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) +{ + if(msg == WM_SETTEXT) + { + const WCHAR *text = (const WCHAR*)lparam; + + ok(!wparam, "wparam = %08lx\n", wparam); + ok(!lstrcmpW(text, textW), "WM_SETTEXT lparam = %s\n", wine_dbgstr_w(text)); + return 1; + } return 0; } @@ -8765,8 +8787,16 @@ static void test_winproc_limit(void) break; } ok(i != 0xffff, "unable to run out of winproc slots\n"); - ok(SetWindowLongPtrA(hwnd, GWLP_WNDPROC, (LONG_PTR)winproc2), + + ok(SetWindowLongPtrA(hwnd, GWLP_WNDPROC, (LONG_PTR)winproc_convA), "SetWindowLongPtr failed with error %d\n", GetLastError()); + ok(SendMessageA(hwnd, WM_SETTEXT, 0, (LPARAM)"text"), "WM_SETTEXT failed\n"); + ok(SendMessageW(hwnd, WM_SETTEXT, 0, (LPARAM)textW), "WM_SETTEXT with conversion failed\n"); + + ok(SetWindowLongPtrW(hwnd, GWLP_WNDPROC, (LONG_PTR)winproc_convW), + "SetWindowLongPtr failed with error %d\n", GetLastError()); + ok(SendMessageA(hwnd, WM_SETTEXT, 0, (LPARAM)"text"), "WM_SETTEXT failed\n"); + ok(SendMessageW(hwnd, WM_SETTEXT, 0, (LPARAM)textW), "WM_SETTEXT with conversion failed\n"); i = 0; CallWindowProcA(winproc_handle, 0, 0, 0, (LPARAM)&i);