From 11d550dfa8c4b6a5775b1b6c0ff7fab7049d1083 Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Mon, 4 Oct 2004 20:39:00 +0000 Subject: [PATCH] Add more message conversion tests, make the tests pass under Wine. --- dlls/user/message.c | 8 ++++---- dlls/user/tests/msg.c | 32 ++++++++++++++++++++++++++------ 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/dlls/user/message.c b/dlls/user/message.c index 5ee38b61393..32c742227c7 100644 --- a/dlls/user/message.c +++ b/dlls/user/message.c @@ -2033,7 +2033,7 @@ BOOL WINAPI SendNotifyMessageW( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpara if (is_pointer_message(msg)) { - SetLastError(ERROR_INVALID_PARAMETER); + SetLastError( ERROR_MESSAGE_SYNC_ONLY ); return FALSE; } @@ -2086,7 +2086,7 @@ BOOL WINAPI SendMessageCallbackW( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpa if (is_pointer_message(msg)) { - SetLastError(ERROR_INVALID_PARAMETER); + SetLastError( ERROR_MESSAGE_SYNC_ONLY ); return FALSE; } @@ -2175,7 +2175,7 @@ BOOL WINAPI PostMessageW( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam ) if (is_pointer_message( msg )) { - SetLastError( ERROR_INVALID_PARAMETER ); + SetLastError( ERROR_MESSAGE_SYNC_ONLY ); return FALSE; } @@ -2223,7 +2223,7 @@ BOOL WINAPI PostThreadMessageW( DWORD thread, UINT msg, WPARAM wparam, LPARAM lp if (is_pointer_message( msg )) { - SetLastError( ERROR_INVALID_PARAMETER ); + SetLastError( ERROR_MESSAGE_SYNC_ONLY ); return FALSE; } if (USER_IsExitingThread( thread )) return TRUE; diff --git a/dlls/user/tests/msg.c b/dlls/user/tests/msg.c index 07dadf58632..19756b41ebf 100644 --- a/dlls/user/tests/msg.c +++ b/dlls/user/tests/msg.c @@ -32,7 +32,6 @@ #include "winuser.h" #include "wine/test.h" -#include "wine/unicode.h" #define MDI_FIRST_CHILD_ID 2004 @@ -2945,9 +2944,9 @@ static LRESULT CALLBACK MsgConversionProcW(HWND hwnd, UINT uMsg, WPARAM wParam, { case CB_FINDSTRINGEXACT: trace("String: %p\n", (LPCWSTR)lParam); - if (!strcmpW((LPCWSTR)lParam, wszUnicode)) + if (!lstrcmpW((LPCWSTR)lParam, wszUnicode)) return 1; - if (!strcmpW((LPCWSTR)lParam, wszAnsi)) + if (!lstrcmpW((LPCWSTR)lParam, wszAnsi)) return 0; return -1; } @@ -3006,8 +3005,6 @@ static void test_message_conversion(void) /* Asynchronous messages */ - todo_wine - { SetLastError(0); lRes = PostMessageA(hwnd, CB_FINDSTRINGEXACT, 0, (LPARAM)wszUnicode); ok(lRes == 0 && GetLastError() == ERROR_MESSAGE_SYNC_ONLY, @@ -3016,7 +3013,30 @@ static void test_message_conversion(void) lRes = PostMessageW(hwnd, CB_FINDSTRINGEXACT, 0, (LPARAM)wszUnicode); ok(lRes == 0 && GetLastError() == ERROR_MESSAGE_SYNC_ONLY, "PostMessage on sync only message returned %ld, last error %ld\n", lRes, GetLastError()); - } + SetLastError(0); + lRes = PostThreadMessageA(GetCurrentThreadId(), CB_FINDSTRINGEXACT, 0, (LPARAM)wszUnicode); + ok(lRes == 0 && GetLastError() == ERROR_MESSAGE_SYNC_ONLY, + "PosThreadtMessage on sync only message returned %ld, last error %ld\n", lRes, GetLastError()); + SetLastError(0); + lRes = PostThreadMessageW(GetCurrentThreadId(), CB_FINDSTRINGEXACT, 0, (LPARAM)wszUnicode); + ok(lRes == 0 && GetLastError() == ERROR_MESSAGE_SYNC_ONLY, + "PosThreadtMessage on sync only message returned %ld, last error %ld\n", lRes, GetLastError()); + SetLastError(0); + lRes = SendNotifyMessageA(hwnd, CB_FINDSTRINGEXACT, 0, (LPARAM)wszUnicode); + ok(lRes == 0 && GetLastError() == ERROR_MESSAGE_SYNC_ONLY, + "SendNotifyMessage on sync only message returned %ld, last error %ld\n", lRes, GetLastError()); + SetLastError(0); + lRes = SendNotifyMessageW(hwnd, CB_FINDSTRINGEXACT, 0, (LPARAM)wszUnicode); + ok(lRes == 0 && GetLastError() == ERROR_MESSAGE_SYNC_ONLY, + "SendNotifyMessage on sync only message returned %ld, last error %ld\n", lRes, GetLastError()); + SetLastError(0); + lRes = SendMessageCallbackA(hwnd, CB_FINDSTRINGEXACT, 0, (LPARAM)wszUnicode, NULL, 0); + ok(lRes == 0 && GetLastError() == ERROR_MESSAGE_SYNC_ONLY, + "SendMessageCallback on sync only message returned %ld, last error %ld\n", lRes, GetLastError()); + SetLastError(0); + lRes = SendMessageCallbackW(hwnd, CB_FINDSTRINGEXACT, 0, (LPARAM)wszUnicode, NULL, 0); + ok(lRes == 0 && GetLastError() == ERROR_MESSAGE_SYNC_ONLY, + "SendMessageCallback on sync only message returned %ld, last error %ld\n", lRes, GetLastError()); } START_TEST(msg)