[ros-diffs] [cwittich] 41301: sync user32 winetest with wine 1.1.23

cwittich at svn.reactos.org cwittich at svn.reactos.org
Sat Jun 6 16:25:57 CEST 2009


Author: cwittich
Date: Sat Jun  6 18:25:56 2009
New Revision: 41301

URL: http://svn.reactos.org/svn/reactos?rev=41301&view=rev
Log:
sync user32 winetest with wine 1.1.23

Modified:
    trunk/rostests/winetests/user32/dde.c
    trunk/rostests/winetests/user32/input.c
    trunk/rostests/winetests/user32/menu.c
    trunk/rostests/winetests/user32/msg.c
    trunk/rostests/winetests/user32/scroll.c
    trunk/rostests/winetests/user32/sysparams.c
    trunk/rostests/winetests/user32/text.c
    trunk/rostests/winetests/user32/win.c

Modified: trunk/rostests/winetests/user32/dde.c
URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/user32/dde.c?rev=41301&r1=41300&r2=41301&view=diff
==============================================================================
--- trunk/rostests/winetests/user32/dde.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/user32/dde.c [iso-8859-1] Sat Jun  6 18:25:56 2009
@@ -1615,12 +1615,6 @@
     ok(hdata != NULL, "Expected non-NULL hdata\n");
     ok(err == DMLERR_NO_ERROR, "Expected DMLERR_NO_ERROR, got %d\n", err);
 
-    ptr = GlobalLock(hdata);
-    todo_wine
-    {
-        ok(ptr == NULL, "Expected NULL, got %p\n", ptr);
-    }
-
     ptr = DdeAccessData(hdata, &size);
     ok(ptr != NULL, "Expected non-NULL ptr\n");
     ok(size == 260, "Expected 260, got %d\n", size);
@@ -1638,12 +1632,6 @@
     ok(hdata != NULL, "Expected non-NULL hdata\n");
     ok(err == DMLERR_NO_ERROR, "Expected DMLERR_NO_ERROR, got %d\n", err);
 
-    ptr = GlobalLock(hdata);
-    todo_wine
-    {
-        ok(ptr == NULL, "Expected NULL, got %p\n", ptr);
-    }
-
     ptr = DdeAccessData(hdata, &size);
     ok(ptr != NULL, "Expected non-NULL ptr\n");
     ok(size == 0, "Expected 0, got %d\n", size);
@@ -1661,12 +1649,6 @@
     ok(hdata != NULL, "Expected non-NULL hdata\n");
     ok(err == DMLERR_NO_ERROR, "Expected DMLERR_NO_ERROR, got %d\n", err);
 
-    ptr = GlobalLock(hdata);
-    todo_wine
-    {
-        ok(ptr == NULL, "Expected NULL, got %p\n", ptr);
-    }
-
     ptr = DdeAccessData(hdata, &size);
     ok(ptr != NULL, "Expected non-NULL ptr\n");
     ok(size == 262, "Expected 262, got %d\n", size);
@@ -1688,12 +1670,6 @@
     ok(hdata != NULL, "Expected non-NULL hdata\n");
     ok(err == DMLERR_NO_ERROR, "Expected DMLERR_NO_ERROR, got %d\n", err);
 
-    ptr = GlobalLock(hdata);
-    todo_wine
-    {
-        ok(ptr == NULL, "Expected NULL, got %p\n", ptr);
-    }
-
     ptr = DdeAccessData(hdata, &size);
     ok(ptr != NULL, "Expected non-NULL ptr\n");
     ok(!lstrcmpA((LPSTR)ptr, "data"), "Expected data, got %s\n", ptr);
@@ -1712,12 +1688,6 @@
     ok(hdata != NULL, "Expected non-NULL hdata\n");
     ok(err == DMLERR_NO_ERROR, "Expected DMLERR_NO_ERROR, got %d\n", err);
 
-    ptr = GlobalLock(hdata);
-    todo_wine
-    {
-        ok(ptr == NULL, "Expected NULL, got %p\n", ptr);
-    }
-
     ptr = DdeAccessData(hdata, &size);
     ok(ptr != NULL, "Expected non-NULL ptr\n");
     ok(!lstrcmpA((LPSTR)ptr, "data"), "Expected data, got %s\n", ptr);
@@ -1735,12 +1705,6 @@
     err = DdeGetLastError(dde_inst);
     ok(hdata != NULL, "Expected non-NULL hdata\n");
     ok(err == DMLERR_NO_ERROR, "Expected DMLERR_NO_ERROR, got %d\n", err);
-
-    ptr = GlobalLock(hdata);
-    todo_wine
-    {
-        ok(ptr == NULL, "Expected NULL, got %p\n", ptr);
-    }
 
     ptr = DdeAccessData(hdata, &size);
     ok(ptr != NULL, "Expected non-NULL ptr\n");

Modified: trunk/rostests/winetests/user32/input.c
URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/user32/input.c?rev=41301&r1=41300&r2=41301&view=diff
==============================================================================
--- trunk/rostests/winetests/user32/input.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/user32/input.c [iso-8859-1] Sat Jun  6 18:25:56 2009
@@ -1276,7 +1276,7 @@
     state[VK_LCONTROL] |= HIGHEST_BIT;
 
     ret = ToUnicode(VK_TAB, SC_TAB, state, wStr, 2, 0);
-    todo_wine ok(ret == 0, "ToUnicode for CTRL + Tab didn't return 0 (was %i)\n", ret);
+    ok(ret == 0, "ToUnicode for CTRL + Tab didn't return 0 (was %i)\n", ret);
 
     ret = ToUnicode(VK_RETURN, SC_RETURN, state, wStr, 2, 0);
     ok(ret == 1, "ToUnicode for CTRL + Return didn't return 1 (was %i)\n", ret);
@@ -1285,6 +1285,8 @@
 
     state[VK_SHIFT] |= HIGHEST_BIT;
     state[VK_LSHIFT] |= HIGHEST_BIT;
+    ret = ToUnicode(VK_TAB, SC_TAB, state, wStr, 2, 0);
+    ok(ret == 0, "ToUnicode for CTRL + SHIFT + Tab didn't return 0 (was %i)\n", ret);
     ret = ToUnicode(VK_RETURN, SC_RETURN, state, wStr, 2, 0);
     todo_wine ok(ret == 0, "ToUnicode for CTRL + SHIFT + Return didn't return 0 (was %i)\n", ret);
 }

Modified: trunk/rostests/winetests/user32/menu.c
URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/user32/menu.c?rev=41301&r1=41300&r2=41301&view=diff
==============================================================================
--- trunk/rostests/winetests/user32/menu.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/user32/menu.c [iso-8859-1] Sat Jun  6 18:25:56 2009
@@ -571,7 +571,7 @@
                        4 + (mnuopt != 1 ? GetSystemMetrics(SM_CXMENUCHECK) : 0)
                        : 0) +
                        arrowwidth  + MOD_avec + (hbmp ?
-                                    ((int)hbmp<0||(int)hbmp>12 ? bmpsize.cx + 2 : GetSystemMetrics( SM_CXMENUSIZE) + 2)
+                                    ((INT_PTR)hbmp<0||(INT_PTR)hbmp>12 ? bmpsize.cx + 2 : GetSystemMetrics( SM_CXMENUSIZE) + 2)
                                     : 0) +
                 (text && hastab ? /* TAB space */
                  MOD_avec + ( hastab==2 ? sc_size.cx : 0) : 0) +
@@ -588,7 +588,7 @@
             expect = max( ( !(text || hbmp) ? GetSystemMetrics( SM_CYMENUSIZE)/2 : 0),
                           max( (text ? max( 2 + size.cy, MOD_hic + 4) : 0),
                                (hbmp ?
-                                   ((int)hbmp<0||(int)hbmp>12 ?
+                                   ((INT_PTR)hbmp<0||(INT_PTR)hbmp>12 ?
                                        bmpsize.cy + 2
                                      : GetSystemMetrics( SM_CYMENUSIZE) + 2)
                                  : 0)));

Modified: trunk/rostests/winetests/user32/msg.c
URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/user32/msg.c?rev=41301&r1=41300&r2=41301&view=diff
==============================================================================
--- trunk/rostests/winetests/user32/msg.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/user32/msg.c [iso-8859-1] Sat Jun  6 18:25:56 2009
@@ -885,7 +885,7 @@
     { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
     { WM_SETFOCUS, sent|defwinproc },
     { WM_GETTEXT, sent|optional },
-    { WM_WINDOWPOSCHANGED, sent|wparam|optional, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
+    { WM_WINDOWPOSCHANGED, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE, 0, SWP_SHOWWINDOW },
     { 0 }
 };
 /* CreateWindow (for child window, not initially visible) */
@@ -1123,6 +1123,13 @@
     { WM_DESTROY, sent|optional }, /* some other (IME?) window */
     { WM_NCDESTROY, sent|optional }, /* some other (IME?) window */
     { WM_NCDESTROY, sent },
+    { 0 }
+};
+/* visible child window destroyed by thread exit */
+static const struct message WmExitThreadSeq[] = {
+    { WM_NCDESTROY, sent },  /* actually in grandchild */
+    { WM_PAINT, sent|parent },
+    { WM_ERASEBKGND, sent|parent|beginpaint },
     { 0 }
 };
 /* DestroyWindow for a visible child window with invisible parent */
@@ -1557,6 +1564,8 @@
 {
     { WM_CANCELMODE, sent|wparam|lparam, 0, 0 },
     { EVENT_OBJECT_STATECHANGE, winevent_hook|wparam|lparam, 0, 0 },
+    { HCBT_SETFOCUS, hook|optional },
+    { WM_KILLFOCUS, sent|optional },
     { WM_ENABLE, sent|wparam|lparam, FALSE, 0 },
     { 0 }
 };
@@ -1759,6 +1768,16 @@
 #undef DUMP
 }
 
+static BOOL ignore_message( UINT message )
+{
+    /* these are always ignored */
+    return (message >= 0xc000 ||
+            message == WM_GETICON ||
+            message == WM_GETOBJECT ||
+            message == WM_TIMECHANGE ||
+            message == WM_DEVICECHANGE);
+}
+
 
 #define add_message(msg) add_message_(__LINE__,msg);
 static void add_message_(int line, const struct recvd_message *msg)
@@ -1863,6 +1882,8 @@
                 sprintf( seq->output, "%s: %p %04x wp %08lx lp %08lx",
                          msg->descr, msg->hwnd, msg->message, msg->wParam, msg->lParam );
             }
+            if (msg->flags & (sent|posted|parent|defwinproc|beginpaint))
+                sprintf( seq->output + strlen(seq->output), " (flags %x)", msg->flags );
         }
     }
 
@@ -3202,9 +3223,7 @@
         message != WM_NCHITTEST &&
         message != WM_GETTEXT &&
         message != WM_MDIGETACTIVE &&
-        message != WM_GETICON &&
-        message != WM_GETOBJECT &&
-        message != WM_DEVICECHANGE)
+        !ignore_message( message ))
     {
         msg.hwnd = hwnd;
         msg.message = message;
@@ -3231,9 +3250,7 @@
         message != WM_ERASEBKGND &&
         message != WM_NCHITTEST &&
         message != WM_GETTEXT &&
-        message != WM_GETICON &&
-        message != WM_GETOBJECT &&
-        message != WM_DEVICECHANGE)
+        !ignore_message( message ))
     {
         switch (message)
         {
@@ -3281,9 +3298,7 @@
         message != WM_ERASEBKGND &&
         message != WM_NCHITTEST &&
         message != WM_GETTEXT &&
-        message != WM_GETICON &&
-        message != WM_GETOBJECT &&
-        message != WM_DEVICECHANGE)
+        !ignore_message( message ))
     {
         msg.hwnd = hwnd;
         msg.message = message;
@@ -3898,16 +3913,15 @@
 {
     struct recvd_message msg;
 
+    if (ignore_message( message )) return 0;
+
     switch (message)
     {
 	/* ignore */
-        case WM_GETICON:
-        case WM_GETOBJECT:
 	case WM_MOUSEMOVE:
 	case WM_NCMOUSEMOVE:
 	case WM_NCMOUSELEAVE:
 	case WM_SETCURSOR:
-	case WM_DEVICECHANGE:
             return 0;
         case WM_NCHITTEST:
             return HTCLIENT;
@@ -3958,7 +3972,6 @@
 
     xmin = 0xdeadbeef;
     xmax = 0xdeadbeef;
-    trace("Ignore GetScrollRange error below if you are on Win9x\n");
     ret = GetScrollRange(hwnd, ctl, &xmin, &xmax);
     ok( ret, "GetScrollRange(%d) error %d\n", ctl, GetLastError());
     ok_sequence(WmEmptySeq, "GetScrollRange(SB_HORZ/SB_VERT) empty sequence", FALSE);
@@ -5157,11 +5170,10 @@
     LRESULT ret;
     struct recvd_message msg;
 
+    if (ignore_message( message )) return 0;
+
     switch (message)
     {
-    case WM_GETICON:
-    case WM_GETOBJECT:
-        return 0;  /* ignore them */
     case WM_SYNCPAINT:
         break;
     case BM_SETSTATE:
@@ -5318,7 +5330,7 @@
     LRESULT ret;
     struct recvd_message msg;
 
-    if (message == WM_GETICON || message == WM_GETOBJECT) return 0;  /* ignore them */
+    if (ignore_message( message )) return 0;
 
     msg.hwnd = hwnd;
     msg.message = message;
@@ -5420,9 +5432,7 @@
         message != WM_ERASEBKGND &&
         message != WM_NCHITTEST &&
         message != WM_GETTEXT &&
-        message != WM_GETICON &&
-        message != WM_GETOBJECT &&
-        message != WM_DEVICECHANGE)
+        !ignore_message( message ))
     {
         msg.hwnd = hwnd;
         msg.message = message;
@@ -6305,7 +6315,9 @@
 struct wnd_event
 {
     HWND hwnd;
-    HANDLE event;
+    HANDLE grand_child;
+    HANDLE start_event;
+    HANDLE stop_event;
 };
 
 static DWORD WINAPI thread_proc(void *param)
@@ -6317,7 +6329,7 @@
                                       100, 100, 200, 200, 0, 0, 0, NULL);
     ok(wnd_event->hwnd != 0, "Failed to create overlapped window\n");
 
-    SetEvent(wnd_event->event);
+    SetEvent(wnd_event->start_event);
 
     while (GetMessage(&msg, 0, 0, 0))
     {
@@ -6327,6 +6339,54 @@
 
     ok(IsWindow(wnd_event->hwnd), "window should still exist\n");
 
+    return 0;
+}
+
+static DWORD CALLBACK create_grand_child_thread( void *param )
+{
+    struct wnd_event *wnd_event = param;
+    HWND hchild;
+    MSG msg;
+
+    hchild = CreateWindowExA(0, "TestWindowClass", "Test child",
+                             WS_CHILD | WS_VISIBLE, 0, 0, 10, 10, wnd_event->hwnd, 0, 0, NULL);
+    ok (hchild != 0, "Failed to create child window\n");
+    flush_events();
+    flush_sequence();
+    SetEvent( wnd_event->start_event );
+
+    for (;;)
+    {
+        MsgWaitForMultipleObjects(0, NULL, FALSE, 1000, QS_ALLINPUT);
+        if (!IsWindow( hchild )) break;  /* will be destroyed when parent thread exits */
+        while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessage(&msg);
+    }
+    return 0;
+}
+
+static DWORD CALLBACK create_child_thread( void *param )
+{
+    struct wnd_event *wnd_event = param;
+    struct wnd_event child_event;
+    DWORD ret, tid;
+    MSG msg;
+
+    child_event.hwnd = CreateWindowExA(0, "TestWindowClass", "Test child",
+                             WS_CHILD | WS_VISIBLE, 0, 0, 10, 10, wnd_event->hwnd, 0, 0, NULL);
+    ok (child_event.hwnd != 0, "Failed to create child window\n");
+    SetFocus( child_event.hwnd );
+    flush_events();
+    flush_sequence();
+    child_event.start_event = wnd_event->start_event;
+    wnd_event->grand_child = CreateThread(NULL, 0, create_grand_child_thread, &child_event, 0, &tid);
+    for (;;)
+    {
+        DWORD ret = MsgWaitForMultipleObjects(1, &child_event.start_event, FALSE, 1000, QS_SENDMESSAGE);
+        if (ret != 1) break;
+        while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessage(&msg);
+    }
+    ret = WaitForSingleObject( wnd_event->stop_event, 5000 );
+    ok( !ret, "WaitForSingleObject failed %x\n", ret );
     return 0;
 }
 
@@ -6341,8 +6401,8 @@
     struct wnd_event wnd_event;
     BOOL ret;
 
-    wnd_event.event = CreateEventW(NULL, 0, 0, NULL);
-    if (!wnd_event.event)
+    wnd_event.start_event = CreateEventW(NULL, 0, 0, NULL);
+    if (!wnd_event.start_event)
     {
         win_skip("skipping interthread message test under win9x\n");
         return;
@@ -6351,9 +6411,9 @@
     hThread = CreateThread(NULL, 0, thread_proc, &wnd_event, 0, &tid);
     ok(hThread != NULL, "CreateThread failed, error %d\n", GetLastError());
 
-    ok(WaitForSingleObject(wnd_event.event, INFINITE) == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
-
-    CloseHandle(wnd_event.event);
+    ok(WaitForSingleObject(wnd_event.start_event, INFINITE) == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
+
+    CloseHandle(wnd_event.start_event);
 
     SetLastError(0xdeadbeef);
     ok(!DestroyWindow(wnd_event.hwnd), "DestroyWindow succeded\n");
@@ -6397,6 +6457,38 @@
     CloseHandle(hThread);
 
     ok(!IsWindow(wnd_event.hwnd), "window should be destroyed on thread exit\n");
+
+    wnd_event.hwnd = CreateWindowExA(0, "TestParentClass", "Test parent", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
+                              100, 100, 200, 200, 0, 0, 0, NULL);
+    ok (wnd_event.hwnd != 0, "Failed to create parent window\n");
+    flush_sequence();
+    log_all_parent_messages++;
+    wnd_event.start_event = CreateEventA( NULL, TRUE, FALSE, NULL );
+    wnd_event.stop_event = CreateEventA( NULL, TRUE, FALSE, NULL );
+    hThread = CreateThread( NULL, 0, create_child_thread, &wnd_event, 0, &tid );
+    for (;;)
+    {
+        ret = MsgWaitForMultipleObjects(1, &wnd_event.start_event, FALSE, 1000, QS_SENDMESSAGE);
+        if (ret != 1) break;
+        while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessage(&msg);
+    }
+    ok( !ret, "MsgWaitForMultipleObjects failed %x\n", ret );
+    /* now wait for the thread without processing messages; this shouldn't deadlock */
+    SetEvent( wnd_event.stop_event );
+    ret = WaitForSingleObject( hThread, 5000 );
+    ok( !ret, "WaitForSingleObject failed %x\n", ret );
+    CloseHandle( hThread );
+
+    ret = WaitForSingleObject( wnd_event.grand_child, 5000 );
+    ok( !ret, "WaitForSingleObject failed %x\n", ret );
+    CloseHandle( wnd_event.grand_child );
+
+    CloseHandle( wnd_event.start_event );
+    CloseHandle( wnd_event.stop_event );
+    flush_events();
+    ok_sequence(WmExitThreadSeq, "destroy child on thread exit", FALSE);
+    log_all_parent_messages--;
+    DestroyWindow( wnd_event.hwnd );
 }
 
 
@@ -6657,10 +6749,8 @@
 
         /* ignore some unwanted messages */
         if (msg.message == WM_MOUSEMOVE ||
-            msg.message == WM_GETICON ||
-            msg.message == WM_GETOBJECT ||
             msg.message == WM_TIMER ||
-            msg.message == WM_DEVICECHANGE)
+            ignore_message( msg.message ))
             continue;
 
         log_msg.hwnd = msg.hwnd;
@@ -6902,8 +6992,7 @@
     LRESULT ret;
     struct recvd_message msg;
 
-    /* ignore registered messages */
-    if (message >= 0xc000) return 0;
+    if (ignore_message( message )) return 0;
 
     switch (message)
     {
@@ -6966,9 +7055,6 @@
 	case WM_MOUSEACTIVATE:
 	case WM_NCMOUSEMOVE:
 	case WM_SETCURSOR:
-	case WM_GETICON:
-	case WM_GETOBJECT:
-	case WM_DEVICECHANGE:
 	case WM_IME_SELECT:
 	    return 0;
     }
@@ -7038,11 +7124,10 @@
     LRESULT ret;
     struct recvd_message msg;
 
+    if (ignore_message( message )) return 0;
+
     switch (message)
     {
-    case WM_GETICON:
-    case WM_GETOBJECT:
-        return 0;  /* ignore them */
     case WM_QUERYENDSESSION:
     case WM_ENDSESSION:
         lParam &= ~0x01;  /* Vista adds a 0x01 flag */
@@ -7078,10 +7163,7 @@
     LRESULT ret;
     struct recvd_message msg;
 
-    if (message == WM_GETICON || message == WM_GETOBJECT) return 0;  /* ignore them */
-
-    /* ignore registered messages */
-    if (message >= 0xc000) return 0;
+    if (ignore_message( message )) return 0;
 
     if (log_all_parent_messages ||
         message == WM_PARENTNOTIFY || message == WM_CANCELMODE ||
@@ -7145,7 +7227,7 @@
     LRESULT ret;
     struct recvd_message msg;
 
-    if (message == WM_GETICON || message == WM_GETOBJECT) return 0;  /* ignore them */
+    if (ignore_message( message )) return 0;
 
     if (test_def_id)
     {
@@ -8254,6 +8336,7 @@
     { WM_GETTEXT, sent|beginpaint|optional },
     { WM_GETTEXT, sent|beginpaint|optional },
     { WM_GETTEXT, sent|beginpaint|optional },
+    { WM_GETTEXT, sent|beginpaint|defwinproc|optional },
     { WM_ERASEBKGND, sent|beginpaint|optional },
     { 0 }
 };
@@ -8773,7 +8856,7 @@
     LRESULT ret;
     struct recvd_message msg;
 
-    if (message == WM_GETICON || message == WM_GETOBJECT) return 0;  /* ignore them */
+    if (ignore_message( message )) return 0;
 
     msg.hwnd = hwnd;
     msg.message = message;
@@ -10138,7 +10221,7 @@
 };
 static const struct message WmShowMaximized_3[] = {
     { HCBT_MINMAX, hook|lparam, 0, SW_SHOWMAXIMIZED },
-    { WM_GETMINMAXINFO, sent },
+    { WM_GETMINMAXINFO, sent|optional },
     { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_STATECHANGED, 0, SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE|SWP_NOSIZE|SWP_NOMOVE },
     { HCBT_ACTIVATE, hook|optional }, /* win2000 doesn't send it */
     { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE }, /* win2000 doesn't send it */
@@ -10271,12 +10354,7 @@
 {
     struct recvd_message msg;
 
-    switch (message)
-    {
-    case WM_GETICON:
-    case WM_GETOBJECT:
-        return 0;  /* ignore them */
-    }
+    if (ignore_message( message )) return 0;
 
     msg.hwnd = hwnd;
     msg.message = message;
@@ -11020,14 +11098,18 @@
 static const struct message wm_lb_deletestring[] =
 {
     { LB_DELETESTRING, sent|wparam|lparam, 0, 0 },
-    { WM_DELETEITEM, sent|wparam|parent, ID_LISTBOX, 0 },
+    { WM_DELETEITEM, sent|wparam|parent|optional, ID_LISTBOX, 0 },
+    { WM_DRAWITEM, sent|wparam|parent|optional, ID_LISTBOX },
+    { WM_DRAWITEM, sent|wparam|parent|optional, ID_LISTBOX },
     { 0 }
 };
 static const struct message wm_lb_deletestring_reset[] =
 {
     { LB_DELETESTRING, sent|wparam|lparam, 0, 0 },
-    { LB_RESETCONTENT, sent|wparam|lparam|defwinproc, 0, 0 },
-    { WM_DELETEITEM, sent|wparam|parent, ID_LISTBOX, 0 },
+    { LB_RESETCONTENT, sent|wparam|lparam|defwinproc|optional, 0, 0 },
+    { WM_DELETEITEM, sent|wparam|parent|optional, ID_LISTBOX, 0 },
+    { WM_DRAWITEM, sent|wparam|parent|optional, ID_LISTBOX },
+    { WM_DRAWITEM, sent|wparam|parent|optional, ID_LISTBOX },
     { 0 }
 };
 
@@ -11048,9 +11130,7 @@
         message != WM_ERASEBKGND &&
         message != WM_NCHITTEST &&
         message != WM_GETTEXT &&
-        message != WM_GETOBJECT &&
-        message != WM_GETICON &&
-        message != WM_DEVICECHANGE)
+        !ignore_message( message ))
     {
         msg.hwnd = hwnd;
         msg.message = message;
@@ -11080,7 +11160,9 @@
     ret = CallWindowProcA(listbox_orig_proc, listbox, LB_GETCURSEL, 0, 0);
     ok_(__FILE__, line)(ret == cur_sel, "expected cur sel %d, got %ld\n", cur_sel, ret);
     ret = CallWindowProcA(listbox_orig_proc, listbox, LB_GETCARETINDEX, 0, 0);
-    ok_(__FILE__, line)(ret == caret_index, "expected caret index %d, got %ld\n", caret_index, ret);
+    ok_(__FILE__, line)(ret == caret_index ||
+                        broken(cur_sel == -1 && caret_index == 0 && ret == -1),  /* nt4 */
+                        "expected caret index %d, got %ld\n", caret_index, ret);
     ret = CallWindowProcA(listbox_orig_proc, listbox, LB_GETTOPINDEX, 0, 0);
     ok_(__FILE__, line)(ret == top_index, "expected top index %d, got %ld\n", top_index, ret);
 }

Modified: trunk/rostests/winetests/user32/scroll.c
URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/user32/scroll.c?rev=41301&r1=41300&r2=41301&view=diff
==============================================================================
--- trunk/rostests/winetests/user32/scroll.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/user32/scroll.c [iso-8859-1] Sat Jun  6 18:25:56 2009
@@ -222,25 +222,27 @@
 
     ret = GetScrollRange( hwnd, SB_VERT, &min, &max);
     ok( ret ||
-            broken( !ret) /* Win 98/ME */ , "GetScrollRange failed.\n");
+            broken( !ret) /* Win 9x/ME */ , "GetScrollRange failed.\n");
     /* range is 0,0 if there are no H or V scroll bars. 0,100 otherwise */
     if( !( style & ( WS_VSCROLL | WS_HSCROLL)))
         ok( min == 0 && max == 0,
                 "Scroll bar range is %d,%d. Expected 0,0. Style %08x\n", min, max, style);
     else
 todo_wine
-        ok( min == 0 && max == 100,
+        ok(( min == 0 && max == 100) ||
+                broken( min == 0 && max == 0), /* Win 9x/ME */
                 "Scroll bar range is %d,%d. Expected 0,100. Style %08x\n", min, max, style);
     ret = GetScrollRange( hwnd, SB_HORZ, &min, &max);
     ok( ret ||
-            broken( !ret) /* Win 98/ME */ , "GetScrollRange failed.\n");
+            broken( !ret) /* Win 9x/ME */ , "GetScrollRange failed.\n");
     /* range is 0,0 if there are no H or V scroll bars. 0,100 otherwise */
     if( !( style & ( WS_VSCROLL | WS_HSCROLL)))
         ok( min == 0 && max == 0,
                 "Scroll bar range is %d,%d. Expected 0,0. Style %08x\n", min, max, style);
     else
 todo_wine
-        ok( min == 0 && max == 100,
+        ok(( min == 0 && max == 100) ||
+                broken( min == 0 && max == 0), /* Win 9x/ME */
                 "Scroll bar range is %d,%d. Expected 0,100. Style %08x\n", min, max, style);
     /* test GetScrollInfo, vist for vertical SB */
     ret = GetScrollInfo( hwnd, SB_VERT, &si);
@@ -249,7 +251,9 @@
         ok( !ret, "GetScrollInfo succeeded unexpectedly. Style is %08x\n", style);
     else
 todo_wine
-        ok( ret, "GetScrollInfo failed unexpectedly. Style is %08x\n", style);
+        ok( ret ||
+                broken( !ret), /* Win 9x/ME */
+                "GetScrollInfo failed unexpectedly. Style is %08x\n", style);
     /* Same for Horizontal SB */
     ret = GetScrollInfo( hwnd, SB_HORZ, &si);
     /* should fail if no H orV scroll bar styles are present. Succeed otherwise */
@@ -257,7 +261,9 @@
         ok( !ret, "GetScrollInfo succeeded unexpectedly. Style is %08x\n", style);
     else
 todo_wine
-        ok( ret, "GetScrollInfo failed unexpectedly. Style is %08x\n", style);
+        ok( ret ||
+                broken( !ret), /* Win 9x/ME */
+                "GetScrollInfo failed unexpectedly. Style is %08x\n", style);
     /* now set the Vertical Scroll range to something that could be the default value it
      * already has */;
     ret = SetScrollRange( hwnd, SB_VERT, 0, 100, FALSE);
@@ -276,7 +282,7 @@
     /* should succeed in ALL cases */
     ok( ret, "GetScrollInfo failed unexpectedly. Style is %08x\n", style);
     /* report the windows style */
-    winstyle = GetWindowLongW( hwnd, GWL_STYLE );
+    winstyle = GetWindowLongA( hwnd, GWL_STYLE );
     /* WS_VSCROLL added to the window style */
     if( !(style & WS_VSCROLL))
     {
@@ -286,7 +292,8 @@
                     "unexpected style change %8lx expected %8lx\n",
                     (winstyle & (WS_HSCROLL|WS_VSCROLL)), style | WS_VSCROLL);
         else
-            ok( (winstyle & (WS_HSCROLL|WS_VSCROLL)) == style,
+            ok( (winstyle & (WS_HSCROLL|WS_VSCROLL)) == style ||
+                    broken((winstyle & (WS_HSCROLL|WS_VSCROLL)) == (WS_HSCROLL|WS_VSCROLL)), /* Win 9x/ME */
                     "unexpected style change %8lx expected %8x\n",
                     (winstyle & (WS_HSCROLL|WS_VSCROLL)), style);
     }
@@ -314,7 +321,7 @@
     /* should succeed in ALL cases */
     ok( ret, "GetScrollInfo failed unexpectedly. Style is %08x\n", style);
     /* report the windows style */
-    winstyle = GetWindowLongW( hwnd, GWL_STYLE );
+    winstyle = GetWindowLongA( hwnd, GWL_STYLE );
     /* WS_HSCROLL added to the window style */
     if( !(style & WS_HSCROLL))
     {
@@ -324,7 +331,8 @@
                     "unexpected style change %8lx expected %8lx\n",
                     (winstyle & (WS_HSCROLL|WS_VSCROLL)), style | WS_HSCROLL);
         else
-            ok( (winstyle & (WS_HSCROLL|WS_VSCROLL)) == style,
+            ok( (winstyle & (WS_HSCROLL|WS_VSCROLL)) == style ||
+                    broken((winstyle & (WS_HSCROLL|WS_VSCROLL)) == (WS_HSCROLL|WS_VSCROLL)), /* Win 9x/ME */
                     "unexpected style change %8lx expected %8x\n",
                     (winstyle & (WS_HSCROLL|WS_VSCROLL)), style);
     }
@@ -372,7 +380,7 @@
     /* should fail */
     ok( !ret, "GetScrollInfo succeeded unexpectedly. Style is %08x\n", style);
     /* add scroll styles */
-    winstyle = GetWindowLongW( hwnd, GWL_STYLE );
+    winstyle = GetWindowLongA( hwnd, GWL_STYLE );
     SetWindowLongW( hwnd, GWL_STYLE, winstyle | WS_VSCROLL | WS_HSCROLL);
     ret = GetScrollInfo( hwnd, SB_VERT, &si);
     /* should still fail */

Modified: trunk/rostests/winetests/user32/sysparams.c
URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/user32/sysparams.c?rev=41301&r1=41300&r2=41301&view=diff
==============================================================================
--- trunk/rostests/winetests/user32/sysparams.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/user32/sysparams.c [iso-8859-1] Sat Jun  6 18:25:56 2009
@@ -245,11 +245,11 @@
     {
         if (last_error==0xdeadbeef || last_error==ERROR_INVALID_SPI_VALUE || last_error==ERROR_INVALID_PARAMETER)
         {
-            trace("%s not supported on this platform. Skipping test\n", name);
+            skip("%s not supported on this platform\n", name);
         }
         else if (last_error==ERROR_ACCESS_DENIED)
         {
-            trace("%s does not have privileges to run. Skipping test\n", name);
+            skip("%s does not have privileges to run\n", name);
         }
         else
         {
@@ -274,7 +274,7 @@
  * lpsRegName - registry entry name
  * lpsTestValue - value to test
  */
-static void _test_reg_key( LPCSTR subKey1, LPCSTR subKey2, LPCSTR valName1, LPCSTR valName2, LPCSTR testValue )
+static void _test_reg_key( LPCSTR subKey1, LPCSTR subKey2, LPCSTR valName1, LPCSTR valName2, LPCSTR testValue, BOOL optional )
 {
     CHAR  value[MAX_PATH];
     DWORD valueLen;
@@ -360,16 +360,21 @@
             }
          }
     }
-    ok(found,"Missing registry values: %s or %s in keys: %s or %s\n",
+    ok(found || optional,
+       "Missing registry values: %s or %s in keys: %s or %s\n",
        valName1, (valName2?valName2:"<n/a>"), subKey1, (subKey2?subKey2:"<n/a>") );
 }
 
 #define test_reg_key( subKey, valName, testValue ) \
-    _test_reg_key( subKey, NULL, valName, NULL, testValue )
+    _test_reg_key( subKey, NULL, valName, NULL, testValue, FALSE )
+#define test_reg_key_optional( subKey, valName, testValue ) \
+    _test_reg_key( subKey, NULL, valName, NULL, testValue, TRUE )
 #define test_reg_key_ex( subKey1, subKey2, valName, testValue ) \
-    _test_reg_key( subKey1, subKey2, valName, NULL, testValue )
+    _test_reg_key( subKey1, subKey2, valName, NULL, testValue, FALSE )
 #define test_reg_key_ex2( subKey1, subKey2, valName1, valName2, testValue ) \
-    _test_reg_key( subKey1, subKey2, valName1, valName2, testValue )
+    _test_reg_key( subKey1, subKey2, valName1, valName2, testValue, FALSE )
+#define test_reg_key_ex2_optional( subKey1, subKey2, valName1, valName2, testValue ) \
+    _test_reg_key( subKey1, subKey2, valName1, valName2, testValue, TRUE )
 
 /* get a metric from the registry. If the value is negative
  * it is assumed to be in twips and converted to pixels */
@@ -1800,10 +1805,10 @@
         test_change_message( SPI_SETWORKAREA, 0);
     eq( area.left,   curr_val.left,   "left",   "%d" );
     eq( area.top,    curr_val.top,    "top",    "%d" );
-    /* size may be rounded up */
-    ok( area.right >= curr_val.right && area.right < curr_val.right + 16,
+    /* size may be rounded */
+    ok( area.right >= curr_val.right - 16 && area.right < curr_val.right + 16,
         "right: got %d instead of %d\n", area.right, curr_val.right );
-    ok( area.bottom >= curr_val.bottom && area.bottom < curr_val.bottom + 16,
+    ok( area.bottom >= curr_val.bottom - 16 && area.bottom < curr_val.bottom + 16,
         "bottom: got %d instead of %d\n", area.bottom, curr_val.bottom );
     curr_val = area;
     rc=SystemParametersInfoA( SPI_SETWORKAREA, 0, &old_area,
@@ -1815,10 +1820,10 @@
         test_change_message( SPI_SETWORKAREA, 0 );
     eq( area.left,   old_area.left,   "left",   "%d" );
     eq( area.top,    old_area.top,    "top",    "%d" );
-    /* size may be rounded up */
-    ok( area.right >= old_area.right && area.right < old_area.right + 16,
+    /* size may be rounded */
+    ok( area.right >= old_area.right - 16 && area.right < old_area.right + 16,
         "right: got %d instead of %d\n", area.right, old_area.right );
-    ok( area.bottom >= old_area.bottom && area.bottom < old_area.bottom + 16,
+    ok( area.bottom >= old_area.bottom - 16 && area.bottom < old_area.bottom + 16,
         "bottom: got %d instead of %d\n", area.bottom, old_area.bottom );
 }
 
@@ -1917,9 +1922,9 @@
         if (!test_error_msg(rc,"SPI_SETSCREENREADER")) return;
         ok(rc!=0,"%d: rc=%d err=%d\n",i,rc,GetLastError());
         test_change_message( SPI_SETSCREENREADER, 1 );
-        test_reg_key_ex2( SPI_SETSCREENREADER_REGKEY, SPI_SETSCREENREADER_REGKEY_LEGACY,
-                      SPI_SETSCREENREADER_VALNAME, SPI_SETSCREENREADER_VALNAME_LEGACY,
-                      vals[i] ? "1" : "0" );
+        test_reg_key_ex2_optional( SPI_SETSCREENREADER_REGKEY, SPI_SETSCREENREADER_REGKEY_LEGACY,
+                                   SPI_SETSCREENREADER_VALNAME, SPI_SETSCREENREADER_VALNAME_LEGACY,
+                                   vals[i] ? "1" : "0" );
 
         rc=SystemParametersInfoA( SPI_GETSCREENREADER, 0, &v, 0 );
         ok(rc!=0,"%d: rc=%d err=%d\n",i,rc,GetLastError());
@@ -1988,14 +1993,16 @@
         if (!test_error_msg(rc,"SPI_SETLOWPOWERACTIVE")) return;
         ok(rc!=0,"%d: rc=%d err=%d\n",i,rc,GetLastError());
         test_change_message( SPI_SETLOWPOWERACTIVE, 1 );
-        test_reg_key( SPI_SETLOWPOWERACTIVE_REGKEY,
-                      SPI_SETLOWPOWERACTIVE_VALNAME,
-                      vals[i] ? "1" : "0" );
+        test_reg_key_optional( SPI_SETLOWPOWERACTIVE_REGKEY,
+                               SPI_SETLOWPOWERACTIVE_VALNAME,
+                               vals[i] ? "1" : "0" );
 
         /* SPI_SETLOWPOWERACTIVE is not persistent in win2k3 and above */
+        v = 0xdeadbeef;
         rc=SystemParametersInfoA( SPI_GETLOWPOWERACTIVE, 0, &v, 0 );
         ok(rc!=0,"%d: rc=%d err=%d\n",i,rc,GetLastError());
         ok(v == vals[i] ||
+           broken(v == (0xdead0000 | vals[i])) ||  /* win98 only sets the low word */
            v == 0, /* win2k3 */
            "SPI_GETLOWPOWERACTIVE: got %d instead of 0 or %d\n", v, vals[i]);
     }
@@ -2026,14 +2033,16 @@
         if (!test_error_msg(rc,"SPI_SETPOWEROFFACTIVE")) return;
         ok(rc!=0,"%d: rc=%d err=%d\n",i,rc,GetLastError());
         test_change_message( SPI_SETPOWEROFFACTIVE, 1 );
-        test_reg_key( SPI_SETPOWEROFFACTIVE_REGKEY,
-                      SPI_SETPOWEROFFACTIVE_VALNAME,
-                      vals[i] ? "1" : "0" );
+        test_reg_key_optional( SPI_SETPOWEROFFACTIVE_REGKEY,
+                               SPI_SETPOWEROFFACTIVE_VALNAME,
+                               vals[i] ? "1" : "0" );
 
         /* SPI_SETPOWEROFFACTIVE is not persistent in win2k3 and above */
+        v = 0xdeadbeef;
         rc=SystemParametersInfoA( SPI_GETPOWEROFFACTIVE, 0, &v, 0 );
         ok(rc!=0,"%d: rc=%d err=%d\n",i,rc,GetLastError());
         ok(v == vals[i] ||
+           broken(v == (0xdead0000 | vals[i])) ||  /* win98 only sets the low word */
            v == 0, /* win2k3 */
            "SPI_GETPOWEROFFACTIVE: got %d instead of 0 or %d\n", v, vals[i]);
     }
@@ -2064,9 +2073,9 @@
         if (!test_error_msg(rc,"SPI_SETSNAPTODEFBUTTON")) return;
         ok(rc!=0,"%d: rc=%d err=%d\n",i,rc,GetLastError());
         test_change_message( SPI_SETSNAPTODEFBUTTON, 0 );
-        test_reg_key( SPI_SETSNAPTODEFBUTTON_REGKEY,
-                      SPI_SETSNAPTODEFBUTTON_VALNAME,
-                      vals[i] ? "1" : "0" );
+        test_reg_key_optional( SPI_SETSNAPTODEFBUTTON_REGKEY,
+                               SPI_SETSNAPTODEFBUTTON_VALNAME,
+                               vals[i] ? "1" : "0" );
 
         rc=SystemParametersInfoA( SPI_GETSNAPTODEFBUTTON, 0, &v, 0 );
         ok(rc!=0,"%d: rc=%d err=%d\n",i,rc,GetLastError());
@@ -2722,12 +2731,14 @@
     DWORD num;
 
     memset(&devmode, 0, sizeof(devmode));
-    devmode.dmSize = sizeof(devmode);
+    /* Win95 doesn't handle ENUM_CURRENT_SETTINGS correctly */
     EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &devmode);
 
     hdc = GetDC(0);
     val = GetDeviceCaps(hdc, BITSPIXEL);
-    ok(devmode.dmBitsPerPel == val, "GetDeviceCaps(BITSPIXEL) returned %d, EnumDisplaySettings returned %d\n",
+    ok(devmode.dmBitsPerPel == val ||
+        broken(devmode.dmDeviceName[0] == 0), /* Win95 */
+        "GetDeviceCaps(BITSPIXEL) returned %d, EnumDisplaySettings returned %d\n",
         val, devmode.dmBitsPerPel);
 
     val = GetDeviceCaps(hdc, NUMCOLORS);

Modified: trunk/rostests/winetests/user32/text.c
URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/user32/text.c?rev=41301&r1=41300&r2=41301&view=diff
==============================================================================
--- trunk/rostests/winetests/user32/text.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/user32/text.c [iso-8859-1] Sat Jun  6 18:25:56 2009
@@ -27,8 +27,7 @@
 #include "winuser.h"
 #include "winerror.h"
 
-#define MODIFIED(rect) (rect.left = 10 && rect.right != 100 && rect.top == 10 && rect.bottom != 100)
-#define SAME(rect) (rect.left = 10 && rect.right == 100 && rect.top == 10 && rect.bottom == 100)
+#define MODIFIED(rect) (rect.left == 10 && rect.right != 100 && rect.top == 10 && rect.bottom != 100)
 #define EMPTY(rect) (rect.left == rect.right && rect.bottom == rect.top)
 
 static void test_DrawTextCalcRect(void)

Modified: trunk/rostests/winetests/user32/win.c
URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/user32/win.c?rev=41301&r1=41300&r2=41301&view=diff
==============================================================================
--- trunk/rostests/winetests/user32/win.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/user32/win.c [iso-8859-1] Sat Jun  6 18:25:56 2009
@@ -116,6 +116,16 @@
         res = pGetAncestor( hwnd, GA_ROOTOWNER );
         ok( res == ga_root_owner, "Wrong result for GA_ROOTOWNER %p expected %p\n", res, ga_root_owner );
     }
+}
+
+static BOOL ignore_message( UINT message )
+{
+    /* these are always ignored */
+    return (message >= 0xc000 ||
+            message == WM_GETICON ||
+            message == WM_GETOBJECT ||
+            message == WM_TIMECHANGE ||
+            message == WM_DEVICECHANGE);
 }
 
 static BOOL CALLBACK EnumChildProc( HWND hwndChild, LPARAM lParam)
@@ -2312,7 +2322,10 @@
                              HWND active, HWND foreground, HWND focus, HWND capture)
 {
     ok_(file, line)(active == GetActiveWindow(), "GetActiveWindow() = %p\n", GetActiveWindow());
-    if (foreground && GetForegroundWindow())
+    /* only check foreground if it belongs to the current thread */
+    /* foreground can be moved to a different app pretty much at any time */
+    if (foreground && GetForegroundWindow() &&
+        GetWindowThreadProcessId(GetForegroundWindow(), NULL) == GetCurrentThreadId())
         ok_(file, line)(foreground == GetForegroundWindow(), "GetForegroundWindow() = %p\n", GetForegroundWindow());
     ok_(file, line)(focus == GetFocus(), "GetFocus() = %p\n", GetFocus());
     ok_(file, line)(capture == GetCapture(), "GetCapture() = %p\n", GetCapture());
@@ -2621,6 +2634,17 @@
     ok (ret, "releasecapture did not return TRUE after second try.\n");
 }
 
+/* PeekMessage wrapper that ignores the messages we don't care about */
+static BOOL peek_message( MSG *msg )
+{
+    BOOL ret;
+    do
+    {
+        ret = PeekMessageA(msg, 0, 0, 0, PM_REMOVE);
+    } while (ret && (msg->message == WM_TIMER || ignore_message(msg->message)));
+    return ret;
+}
+
 static void test_keyboard_input(HWND hwnd)
 {
     MSG msg;
@@ -2639,40 +2663,31 @@
     flush_events( TRUE );
 
     PostMessageA(hwnd, WM_KEYDOWN, 0, 0);
-    do
-    {
-        ret = PeekMessageA(&msg, 0, 0, 0, PM_REMOVE);
-        ok( ret, "no message available\n");
-    }
-    while (ret && msg.message >= 0xc000);
+    ret = peek_message(&msg);
+    ok( ret, "no message available\n");
     ok(msg.hwnd == hwnd && msg.message == WM_KEYDOWN, "hwnd %p message %04x\n", msg.hwnd, msg.message);
-    do
-        ret = PeekMessageA(&msg, 0, 0, 0, PM_REMOVE);
-    while (ret && (msg.message == WM_TIMER || msg.message >= 0xc000));
+    ret = peek_message(&msg);
     ok( !ret, "message %04x available\n", msg.message);
 
     ok(GetFocus() == hwnd, "wrong focus window %p\n", GetFocus());
 
     PostThreadMessageA(GetCurrentThreadId(), WM_KEYDOWN, 0, 0);
-    ok(PeekMessageA(&msg, 0, 0, 0, PM_REMOVE), "no message available\n");
+    ret = peek_message(&msg);
+    ok(ret, "no message available\n");
     ok(!msg.hwnd && msg.message == WM_KEYDOWN, "hwnd %p message %04x\n", msg.hwnd, msg.message);
-    ret = PeekMessageA(&msg, 0, 0, 0, PM_REMOVE);
+    ret = peek_message(&msg);
     ok( !ret, "message %04x available\n", msg.message);
 
     ok(GetFocus() == hwnd, "wrong focus window %p\n", GetFocus());
 
     keybd_event(VK_SPACE, 0, 0, 0);
-    do
-    {
-        ret = PeekMessageA(&msg, 0, 0, 0, PM_REMOVE);
-    } while (ret && msg.message >= 0xc000);
-    if (!ret)
+    if (!peek_message(&msg))
     {
         skip( "keybd_event didn't work, skipping keyboard test\n" );
         return;
     }
     ok(msg.hwnd == hwnd && msg.message == WM_KEYDOWN, "hwnd %p message %04x\n", msg.hwnd, msg.message);
-    ret = PeekMessageA(&msg, 0, 0, 0, PM_REMOVE);
+    ret = peek_message(&msg);
     ok( !ret, "message %04x available\n", msg.message);
 
     SetFocus(0);
@@ -2681,25 +2696,28 @@
     flush_events( TRUE );
 
     PostMessageA(hwnd, WM_KEYDOWN, 0, 0);
-    ok(PeekMessageA(&msg, 0, 0, 0, PM_REMOVE), "no message available\n");
+    ret = peek_message(&msg);
+    ok(ret, "no message available\n");
     ok(msg.hwnd == hwnd && msg.message == WM_KEYDOWN, "hwnd %p message %04x\n", msg.hwnd, msg.message);
-    ret = PeekMessageA(&msg, 0, 0, 0, PM_REMOVE);
+    ret = peek_message(&msg);
     ok( !ret, "message %04x available\n", msg.message);
 
     ok(GetFocus() == 0, "wrong focus window %p\n", GetFocus());
 
     PostThreadMessageA(GetCurrentThreadId(), WM_KEYDOWN, 0, 0);
-    ok(PeekMessageA(&msg, 0, 0, 0, PM_REMOVE), "no message available\n");
+    ret = peek_message(&msg);
+    ok(ret, "no message available\n");
     ok(!msg.hwnd && msg.message == WM_KEYDOWN, "hwnd %p message %04x\n", msg.hwnd, msg.message);
-    ret = PeekMessageA(&msg, 0, 0, 0, PM_REMOVE);
+    ret = peek_message(&msg);
     ok( !ret, "message %04x available\n", msg.message);
 
     ok(GetFocus() == 0, "wrong focus window %p\n", GetFocus());
 
     keybd_event(VK_SPACE, 0, 0, 0);
-    ok(PeekMessageA(&msg, 0, 0, 0, PM_REMOVE), "no message available\n");
+    ret = peek_message(&msg);
+    ok(ret, "no message available\n");
     ok(msg.hwnd == hwnd && msg.message == WM_SYSKEYDOWN, "hwnd %p message %04x\n", msg.hwnd, msg.message);
-    ret = PeekMessageA(&msg, 0, 0, 0, PM_REMOVE);
+    ret = peek_message(&msg);
     ok( !ret, "message %04x available\n", msg.message);
 }
 
@@ -2709,11 +2727,11 @@
 
     for (;;)
     {
-        ret = PeekMessageA(msg, 0, 0, 0, PM_REMOVE);
+        ret = peek_message(msg);
         if (ret)
         {
             if (msg->message == WM_PAINT) DispatchMessage(msg);
-            else if (msg->message < 0xc000) break;  /* skip registered messages */
+            else break;
         }
         else if (MsgWaitForMultipleObjects( 0, NULL, FALSE, 100, QS_ALLINPUT ) == WAIT_TIMEOUT) break;
     }
@@ -2766,9 +2784,7 @@
     /* Check that setting the same position may generate WM_MOUSEMOVE */
     SetCursorPos(x, y);
     msg.message = 0;
-    do
-        ret = PeekMessageA(&msg, 0, 0, 0, PM_REMOVE);
-    while (ret && msg.message >= 0xc000);  /* skip registered messages */
+    ret = peek_message(&msg);
     if (ret)
     {
         ok(msg.hwnd == popup && msg.message == WM_MOUSEMOVE, "hwnd %p message %04x\n",
@@ -2789,11 +2805,11 @@
     /* FIXME: SetCursorPos in Wine generates additional WM_MOUSEMOVE message */
     while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE))
     {
-        if (msg.message == WM_TIMER || msg.message >= 0xc000) continue;  /* skip registered messages */
+        if (msg.message == WM_TIMER || ignore_message(msg.message)) continue;
         ok(msg.hwnd == popup && msg.message == WM_MOUSEMOVE,
            "hwnd %p message %04x\n", msg.hwnd, msg.message);
     }
-    ret = PeekMessageA(&msg, 0, 0, 0, PM_REMOVE);
+    ret = peek_message(&msg);
     ok( !ret, "message %04x available\n", msg.message);
 
     mouse_event(MOUSEEVENTF_MOVE, -1, -1, 0, 0);
@@ -2853,7 +2869,7 @@
     ok(msg.hwnd == popup && msg.message == WM_LBUTTONUP, "hwnd %p/%p message %04x\n",
        msg.hwnd, popup, msg.message);
 
-    ret = PeekMessageA(&msg, 0, 0, 0, PM_REMOVE);
+    ret = peek_message(&msg);
     ok(!ret, "message %04x available\n", msg.message);
 
     ShowWindow(popup, SW_HIDE);
@@ -2881,10 +2897,10 @@
     ok(ret, "no message available\n");
     ok(msg.hwnd == popup && msg.message == WM_LBUTTONDOWN, "hwnd %p/%p message %04x\n",
        msg.hwnd, popup, msg.message);
-    ok(PeekMessageA(&msg, 0, 0, 0, PM_REMOVE), "no message available\n");
+    ok(peek_message(&msg), "no message available\n");
     ok(msg.hwnd == popup && msg.message == WM_LBUTTONUP, "hwnd %p/%p message %04x\n",
        msg.hwnd, popup, msg.message);
-    ok(PeekMessageA(&msg, 0, 0, 0, PM_REMOVE), "no message available\n");
+    ok(peek_message(&msg), "no message available\n");
 
     /* Test WM_MOUSEACTIVATE */
 #define TEST_MOUSEACTIVATE(A,B)                                                          \



More information about the Ros-diffs mailing list