From a2e24748b1a3a2c88a5727f3c16be4f12d1bf595 Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Mon, 14 Mar 2005 10:05:50 +0000 Subject: [PATCH] Fix some msg.c and win.c failures running on NT4 and XP. --- dlls/user/tests/msg.c | 66 +++++++++++++++++++++++++++++++++++++++++++-------- dlls/user/tests/win.c | 10 ++++---- 2 files changed, 62 insertions(+), 14 deletions(-) diff --git a/dlls/user/tests/msg.c b/dlls/user/tests/msg.c index fc3debc6cf3..0024ea67ad2 100644 --- a/dlls/user/tests/msg.c +++ b/dlls/user/tests/msg.c @@ -360,6 +360,7 @@ static const struct message WmCreateVisibleChildSeq[] = { { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 }, { WM_ERASEBKGND, sent|parent|optional }, { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOZORDER|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE }, + { WM_NCCALCSIZE, sent|wparam|optional, 1 }, /* WinXP */ { 0 } }; /* ShowWindow(SW_SHOW) for a not visible child window */ @@ -771,6 +772,28 @@ static const struct message WmModalDialogSeq[] = { { WM_PAINT, sent|optional }, { WM_CTLCOLORBTN, sent }, { WM_ENTERIDLE, sent|parent|optional }, + { WM_ENTERIDLE, sent|parent|optional }, + { WM_ENTERIDLE, sent|parent|optional }, + { WM_ENTERIDLE, sent|parent|optional }, + { WM_ENTERIDLE, sent|parent|optional }, + { WM_ENTERIDLE, sent|parent|optional }, + { WM_ENTERIDLE, sent|parent|optional }, + { WM_ENTERIDLE, sent|parent|optional }, + { WM_ENTERIDLE, sent|parent|optional }, + { WM_ENTERIDLE, sent|parent|optional }, + { WM_ENTERIDLE, sent|parent|optional }, + { WM_ENTERIDLE, sent|parent|optional }, + { WM_ENTERIDLE, sent|parent|optional }, + { WM_ENTERIDLE, sent|parent|optional }, + { WM_ENTERIDLE, sent|parent|optional }, + { WM_ENTERIDLE, sent|parent|optional }, + { WM_ENTERIDLE, sent|parent|optional }, + { WM_ENTERIDLE, sent|parent|optional }, + { WM_ENTERIDLE, sent|parent|optional }, + { WM_ENTERIDLE, sent|parent|optional }, + { WM_GETICON, sent|parent|optional }, + { WM_GETICON, sent|parent|optional }, + { WM_GETICON, sent|parent|optional }, { WM_TIMER, sent }, { EVENT_OBJECT_STATECHANGE, winevent_hook|wparam|lparam, 0, 0 }, { WM_ENABLE, sent|parent|wparam, 1 }, @@ -1019,9 +1042,15 @@ static const struct message WmSHOWNATopInvisible[] = { { WM_SHOWWINDOW, sent|wparam, 1 }, { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE }, { WM_NCPAINT, sent|wparam, 1 }, + { WM_GETICON, sent|optional }, + { WM_GETICON, sent|optional }, + { WM_GETICON, sent|optional }, { WM_GETTEXT, sent|defwinproc|optional }, { WM_ERASEBKGND, sent|optional }, { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE }, + { WM_NCCALCSIZE, sent|wparam|optional, 1 }, + { WM_NCPAINT, sent|wparam|optional, 1 }, + { WM_ERASEBKGND, sent|optional }, { WM_SIZE, sent }, { WM_MOVE, sent }, { 0 } @@ -1195,6 +1224,9 @@ static const struct message WmCreateMDIframeSeq[] = { { WM_WINDOWPOSCHANGED, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE }, /* Win9x */ { WM_ACTIVATEAPP, sent|wparam, 1 }, { WM_NCACTIVATE, sent|wparam, 1 }, + { WM_GETTEXT, sent|defwinproc|optional }, + { WM_GETICON, sent|defwinproc|optional }, + { WM_GETICON, sent|defwinproc|optional }, { WM_ACTIVATE, sent|wparam, 1 }, { HCBT_SETFOCUS, hook }, { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 }, @@ -3112,7 +3144,9 @@ static void test_messages(void) /* PeekMessage(NULL) fails, but still removes the message */ SetLastError(0xdeadbeef); ok( !PeekMessageW( NULL, 0, 0, 0, PM_REMOVE ), "PeekMessage(NULL) should fail\n" ); - ok( GetLastError() == ERROR_NOACCESS, "last error is %ld\n", GetLastError() ); + ok( GetLastError() == ERROR_NOACCESS || /* Win2k */ + GetLastError() == 0xdeadbeef, /* NT4 */ + "last error is %ld\n", GetLastError() ); ok( PeekMessageW( &msg, 0, 0, 0, PM_REMOVE ), "PeekMessage should succeed\n" ); ok( msg.message == WM_USER+1, "got %x instead of WM_USER+1\n", msg.message ); @@ -4600,10 +4634,22 @@ static DWORD cbt_hook_thread_id; static LRESULT CALLBACK cbt_hook_proc(int nCode, WPARAM wParam, LPARAM lParam) { + static const char *CBT_code_name[10] = { + "HCBT_MOVESIZE", + "HCBT_MINMAX", + "HCBT_QS", + "HCBT_CREATEWND", + "HCBT_DESTROYWND", + "HCBT_ACTIVATE", + "HCBT_CLICKSKIPPED", + "HCBT_KEYSKIPPED", + "HCBT_SYSCOMMAND", + "HCBT_SETFOCUS" }; + const char *code_name = (nCode >= 0 && nCode <= HCBT_SETFOCUS) ? CBT_code_name[nCode] : "Unknown"; HWND hwnd; char buf[256]; - trace("CBT: %d, %08x, %08lx\n", nCode, wParam, lParam); + trace("CBT: %d (%s), %08x, %08lx\n", nCode, code_name, wParam, lParam); ok(cbt_hook_thread_id == GetCurrentThreadId(), "we didn't ask for events from other threads\n"); @@ -4779,35 +4825,35 @@ static void test_message_conversion(void) SetLastError(0); lRes = PostMessageA(hwnd, CB_FINDSTRINGEXACT, 0, (LPARAM)wszUnicode); - ok(lRes == 0 && GetLastError() == ERROR_MESSAGE_SYNC_ONLY, + ok(lRes == 0 && (GetLastError() == ERROR_MESSAGE_SYNC_ONLY || GetLastError() == ERROR_INVALID_PARAMETER), "PostMessage on sync only message returned %ld, last error %ld\n", lRes, GetLastError()); SetLastError(0); lRes = PostMessageW(hwnd, CB_FINDSTRINGEXACT, 0, (LPARAM)wszUnicode); - ok(lRes == 0 && GetLastError() == ERROR_MESSAGE_SYNC_ONLY, + ok(lRes == 0 && (GetLastError() == ERROR_MESSAGE_SYNC_ONLY || GetLastError() == ERROR_INVALID_PARAMETER), "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, + ok(lRes == 0 && (GetLastError() == ERROR_MESSAGE_SYNC_ONLY || GetLastError() == ERROR_INVALID_PARAMETER), "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, + ok(lRes == 0 && (GetLastError() == ERROR_MESSAGE_SYNC_ONLY || GetLastError() == ERROR_INVALID_PARAMETER), "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, + ok(lRes == 0 && (GetLastError() == ERROR_MESSAGE_SYNC_ONLY || GetLastError() == ERROR_INVALID_PARAMETER), "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, + ok(lRes == 0 && (GetLastError() == ERROR_MESSAGE_SYNC_ONLY || GetLastError() == ERROR_INVALID_PARAMETER), "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, + ok(lRes == 0 && (GetLastError() == ERROR_MESSAGE_SYNC_ONLY || GetLastError() == ERROR_INVALID_PARAMETER), "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, + ok(lRes == 0 && (GetLastError() == ERROR_MESSAGE_SYNC_ONLY || GetLastError() == ERROR_INVALID_PARAMETER), "SendMessageCallback on sync only message returned %ld, last error %ld\n", lRes, GetLastError()); } diff --git a/dlls/user/tests/win.c b/dlls/user/tests/win.c index 4a4057cb78a..f51429f2dc7 100644 --- a/dlls/user/tests/win.c +++ b/dlls/user/tests/win.c @@ -619,10 +619,12 @@ static void verify_window_info(HWND hwnd, const WINDOWINFO *info, BOOL test_bord MapWindowPoints(hwnd, 0, (LPPOINT)&rcClient, 2); ok(EqualRect(&rcClient, &info->rcClient), "wrong rcClient\n"); - ok(info->dwStyle == (DWORD)GetWindowLongA(hwnd, GWL_STYLE), "wrong dwStyle\n"); - ok(info->dwExStyle == (DWORD)GetWindowLongA(hwnd, GWL_EXSTYLE), "wrong dwExStyle\n"); + ok(info->dwStyle == (DWORD)GetWindowLongA(hwnd, GWL_STYLE), + "wrong dwStyle: %08lx != %08lx\n", info->dwStyle, GetWindowLongA(hwnd, GWL_STYLE)); + ok(info->dwExStyle == (DWORD)GetWindowLongA(hwnd, GWL_EXSTYLE), + "wrong dwExStyle: %08lx != %08lx\n", info->dwStyle, GetWindowLongA(hwnd, GWL_EXSTYLE)); status = (GetActiveWindow() == hwnd) ? WS_ACTIVECAPTION : 0; - ok(info->dwWindowStatus == status, "wrong dwWindowStatus %04lx/%04lx\n", + ok(info->dwWindowStatus == status, "wrong dwWindowStatus: %04lx != %04lx\n", info->dwWindowStatus, status); if (test_borders && !IsRectEmpty(&rcWindow)) @@ -711,7 +713,7 @@ static LRESULT CALLBACK cbt_hook_proc(int nCode, WPARAM wParam, LPARAM lParam) trace("CBT: %d (%s), %08x, %08lx\n", nCode, code_name, wParam, lParam); /* on HCBT_DESTROYWND window state is undefined */ - if (nCode != HCBT_DESTROYWND && wParam) + if (nCode != HCBT_DESTROYWND && IsWindow((HWND)wParam)) { BOOL is_win9x = GetWindowLongPtrW((HWND)wParam, GWLP_WNDPROC) == 0; if (is_win9x && nCode == HCBT_CREATEWND) -- 2.11.4.GIT