Author: akhaldi Date: Mon Oct 3 19:49:16 2011 New Revision: 53976
URL: http://svn.reactos.org/svn/reactos?rev=53976&view=rev Log: [USER32_WINETEST] * Sync with Wine 1.3.29.
Modified: trunk/rostests/winetests/user32/combo.c trunk/rostests/winetests/user32/cursoricon.c trunk/rostests/winetests/user32/edit.c trunk/rostests/winetests/user32/msg.c trunk/rostests/winetests/user32/resource.rc trunk/rostests/winetests/user32/static.c trunk/rostests/winetests/user32/win.c trunk/rostests/winetests/user32/winstation.c
Modified: trunk/rostests/winetests/user32/combo.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/user32/combo.c?r... ============================================================================== --- trunk/rostests/winetests/user32/combo.c [iso-8859-1] (original) +++ trunk/rostests/winetests/user32/combo.c [iso-8859-1] Mon Oct 3 19:49:16 2011 @@ -404,6 +404,37 @@ ok( rc.bottom - rc.top == clheight + 2, "drop-down rect height is %d vs %d\n", rc.bottom - rc.top, clheight + 2); } + + ddwidth = SendMessageA(hCombo, CB_SETDROPPEDWIDTH, -1, 0); + ok( ddwidth == clwidth + 2, "drop-width is %d vs %d\n", ddwidth, clwidth + 2); + ddwidth = SendMessageA(hCombo, CB_GETDROPPEDWIDTH, 0, 0); + ok( ddwidth == clwidth + 2, "drop-width is %d vs %d\n", ddwidth, clwidth + 2); + + ddwidth = SendMessageA(hCombo, CB_SETDROPPEDWIDTH, 0, 0); + ok( ddwidth == clwidth + 2, "drop-width is %d vs %d\n", ddwidth, clwidth + 2); + ddwidth = SendMessageA(hCombo, CB_GETDROPPEDWIDTH, 0, 0); + ok( ddwidth == clwidth + 2, "drop-width is %d vs %d\n", ddwidth, clwidth + 2); + + ddwidth = SendMessageA(hCombo, CB_SETDROPPEDWIDTH, clwidth - 1, 0); + ok( ddwidth == clwidth + 2, "drop-width is %d vs %d\n", ddwidth, clwidth + 2); + ddwidth = SendMessageA(hCombo, CB_GETDROPPEDWIDTH, 0, 0); + ok( ddwidth == clwidth + 2, "drop-width is %d vs %d\n", ddwidth, clwidth + 2); + + ddwidth = SendMessageA(hCombo, CB_SETDROPPEDWIDTH, clwidth << 1, 0); + ok( ddwidth == (clwidth << 1), "drop-width is %d vs %d\n", ddwidth, clwidth << 1); + ddwidth = SendMessageA(hCombo, CB_GETDROPPEDWIDTH, 0, 0); + ok( ddwidth == (clwidth << 1), "drop-width is %d vs %d\n", ddwidth, clwidth << 1); + + ddwidth = SendMessageA(hCombo, CB_SETDROPPEDWIDTH, 0, 0); + ok( ddwidth == (clwidth << 1), "drop-width is %d vs %d\n", ddwidth, clwidth << 1); + ddwidth = SendMessageA(hCombo, CB_GETDROPPEDWIDTH, 0, 0); + ok( ddwidth == (clwidth << 1), "drop-width is %d vs %d\n", ddwidth, clwidth << 1); + + ddwidth = SendMessageA(hCombo, CB_SETDROPPEDWIDTH, 1, 0); + ok( ddwidth == clwidth + 2, "drop-width is %d vs %d\n", ddwidth, clwidth + 2); + ddwidth = SendMessageA(hCombo, CB_GETDROPPEDWIDTH, 0, 0); + ok( ddwidth == clwidth + 2, "drop-width is %d vs %d\n", ddwidth, clwidth + 2); + DestroyWindow(hCombo); }
Modified: trunk/rostests/winetests/user32/cursoricon.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/user32/cursorico... ============================================================================== --- trunk/rostests/winetests/user32/cursoricon.c [iso-8859-1] (original) +++ trunk/rostests/winetests/user32/cursoricon.c [iso-8859-1] Mon Oct 3 19:49:16 2011 @@ -1405,6 +1405,7 @@ BITMAPINFO *info; ICONINFO iinfo; DWORD ret; + int i;
ret = GetIconInfo( hCursor, &iinfo ); ok(ret, "GetIconInfo() failed\n"); @@ -1430,10 +1431,11 @@ if (!image) goto cleanup; ret = GetDIBits( hdc, iinfo.hbmColor, 0, 32, image, info, DIB_RGB_COLORS ); ok(ret, "GetDIBits() failed\n"); - if (!ret) goto cleanup; - ret = (memcmp(image, data, length) == 0); - ok(ret, "Expected 0x%x, actually 0x%x (first 4 bytes only)\n", *(DWORD *)data, *(DWORD *)image); - + for (i = 0; ret && i < length / sizeof(COLORREF); i++) + { + ret = color_match( ((COLORREF *)data)[i], ((COLORREF *)image)[i] ); + ok(ret, "%04x: Expected 0x%x, actually 0x%x\n", i, ((COLORREF *)data)[i], ((COLORREF *)image)[i] ); + } cleanup: HeapFree( GetProcessHeap(), 0, image ); HeapFree( GetProcessHeap(), 0, info );
Modified: trunk/rostests/winetests/user32/edit.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/user32/edit.c?re... ============================================================================== --- trunk/rostests/winetests/user32/edit.c [iso-8859-1] (original) +++ trunk/rostests/winetests/user32/edit.c [iso-8859-1] Mon Oct 3 19:49:16 2011 @@ -736,9 +736,10 @@ */ static void test_edit_control_2(void) { - HWND hwndMain; + HWND hwndMain, phwnd; char szLocalString[MAXLEN]; - LONG r; + LONG r, w = 150, h = 50; + POINT cpos;
/* Create main and edit windows. */ hwndMain = CreateWindow(szEditTest2Class, "ET2", WS_OVERLAPPEDWINDOW, @@ -749,7 +750,7 @@
hwndET2 = CreateWindow("EDIT", NULL, WS_CHILD|WS_BORDER|ES_LEFT|ES_AUTOHSCROLL, - 0, 0, 150, 50, /* important this not be 0 size. */ + 0, 0, w, h, /* important this not be 0 size. */ hwndMain, (HMENU) ID_EDITTEST2, hinst, NULL); assert(hwndET2); if (winetest_interactive) @@ -767,6 +768,37 @@ GetWindowText(hwndET2, szLocalString, MAXLEN); ok(lstrcmp(szLocalString, "bar")==0, "Wrong contents of edit: %s\n", szLocalString); + + /* try setting the caret before it's visible */ + r = SetCaretPos(0, 0); + todo_wine ok(0 == r, "SetCaretPos succeeded unexpectedly, expected: 0, got: %d\n", r); + phwnd = SetFocus(hwndET2); + ok(phwnd != NULL, "SetFocus failed unexpectedly, expected non-zero, got NULL\n"); + r = SetCaretPos(0, 0); + ok(1 == r, "SetCaretPos failed unexpectedly, expected: 1, got: %d\n", r); + r = GetCaretPos(&cpos); + ok(1 == r, "GetCaretPos failed unexpectedly, expected: 1, got: %d\n", r); + ok(cpos.x == 0 && cpos.y == 0, "Wrong caret position, expected: (0,0), got: (%d,%d)\n", cpos.x, cpos.y); + r = SetCaretPos(-1, -1); + ok(1 == r, "SetCaretPos failed unexpectedly, expected: 1, got: %d\n", r); + r = GetCaretPos(&cpos); + ok(1 == r, "GetCaretPos failed unexpectedly, expected: 1, got: %d\n", r); + ok(cpos.x == -1 && cpos.y == -1, "Wrong caret position, expected: (-1,-1), got: (%d,%d)\n", cpos.x, cpos.y); + r = SetCaretPos(w << 1, h << 1); + ok(1 == r, "SetCaretPos failed unexpectedly, expected: 1, got: %d\n", r); + r = GetCaretPos(&cpos); + ok(1 == r, "GetCaretPos failed unexpectedly, expected: 1, got: %d\n", r); + ok(cpos.x == (w << 1) && cpos.y == (h << 1), "Wrong caret position, expected: (%d,%d), got: (%d,%d)\n", w << 1, h << 1, cpos.x, cpos.y); + r = SetCaretPos(w, h); + ok(1 == r, "SetCaretPos failed unexpectedly, expected: 1, got: %d\n", r); + r = GetCaretPos(&cpos); + ok(1 == r, "GetCaretPos failed unexpectedly, expected: 1, got: %d\n", r); + ok(cpos.x == w && cpos.y == h, "Wrong caret position, expected: (%d,%d), got: (%d,%d)\n", w, h, cpos.x, cpos.y); + r = SetCaretPos(w - 1, h - 1); + ok(1 == r, "SetCaretPos failed unexpectedly, expected: 1, got: %d\n", r); + r = GetCaretPos(&cpos); + ok(1 == r, "GetCaretPos failed unexpectedly, expected: 1, got: %d\n", r); + ok(cpos.x == (w - 1) && cpos.y == (h - 1), "Wrong caret position, expected: (%d,%d), got: (%d,%d)\n", w - 1, h - 1, cpos.x, cpos.y);
/* OK, done! */ DestroyWindow (hwndET2);
Modified: trunk/rostests/winetests/user32/msg.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/user32/msg.c?rev... ============================================================================== --- trunk/rostests/winetests/user32/msg.c [iso-8859-1] (original) +++ trunk/rostests/winetests/user32/msg.c [iso-8859-1] Mon Oct 3 19:49:16 2011 @@ -7608,6 +7608,21 @@ return ret; }
+static INT_PTR CALLBACK StopQuitMsgCheckProcA(HWND hwnd, UINT message, WPARAM wp, LPARAM lp) +{ + if (message == WM_CREATE) + PostMessage(hwnd, WM_CLOSE, 0, 0); + else if (message == WM_CLOSE) + { + /* Only the first WM_QUIT will survive the window destruction */ + PostMessage(hwnd, WM_USER, 0x1234, 0x5678); + PostMessage(hwnd, WM_QUIT, 0x1234, 0x5678); + PostMessage(hwnd, WM_QUIT, 0x4321, 0x8765); + } + + return DefWindowProcA(hwnd, message, wp, lp); +} + static LRESULT WINAPI TestDlgProcA(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { static LONG defwndproc_counter = 0; @@ -7788,6 +7803,10 @@
cls.lpfnWndProc = ParentMsgCheckProcA; cls.lpszClassName = "TestParentClass"; + if(!RegisterClassA(&cls)) return FALSE; + + cls.lpfnWndProc = StopQuitMsgCheckProcA; + cls.lpszClassName = "StopQuitClass"; if(!RegisterClassA(&cls)) return FALSE;
cls.lpfnWndProc = DefWindowProcA; @@ -10131,6 +10150,13 @@ { 0 } };
+static const struct message WmStopQuitSeq[] = { + { WM_DWMNCRENDERINGCHANGED, posted|optional }, + { WM_CLOSE, posted }, + { WM_QUIT, posted|wparam|lparam, 0x1234, 0 }, + { 0 } +}; + static void test_quit_message(void) { MSG msg; @@ -10193,6 +10219,29 @@ ok(msg.message == WM_QUIT, "Received message 0x%04x instead of WM_QUIT\n", msg.message); ok(msg.wParam == 0x1234, "wParam was 0x%lx instead of 0x1234\n", msg.wParam); ok(msg.lParam == 0, "lParam was 0x%lx instead of 0\n", msg.lParam); + + /* Check what happens to a WM_QUIT message posted to a window that gets + * destroyed. + */ + CreateWindowExA(0, "StopQuitClass", "Stop Quit Test", WS_OVERLAPPEDWINDOW, + 0, 0, 100, 100, NULL, NULL, NULL, NULL); + flush_sequence(); + while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) + { + struct recvd_message rmsg; + rmsg.hwnd = msg.hwnd; + rmsg.message = msg.message; + rmsg.flags = posted|wparam|lparam; + rmsg.wParam = msg.wParam; + rmsg.lParam = msg.lParam; + rmsg.descr = "stop/quit"; + if (msg.message == WM_QUIT) + /* The hwnd can only be checked here */ + ok(!msg.hwnd, "The WM_QUIT hwnd was %p instead of NULL\n", msg.hwnd); + add_message(&rmsg); + DispatchMessage(&msg); + } + ok_sequence(WmStopQuitSeq, "WmStopQuitSeq", FALSE); }
static const struct message WmMouseHoverSeq[] = {
Modified: trunk/rostests/winetests/user32/resource.rc URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/user32/resource.... ============================================================================== --- trunk/rostests/winetests/user32/resource.rc [iso-8859-1] (original) +++ trunk/rostests/winetests/user32/resource.rc [iso-8859-1] Mon Oct 3 19:49:16 2011 @@ -45,7 +45,7 @@ 65534 "Test high id" }
-TEST_DIALOG DIALOG DISCARDABLE 0, 0, 60, 30 +TEST_DIALOG DIALOG 0, 0, 60, 30 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE CAPTION "Test dialog" FONT 8, "MS Shell Dlg" @@ -65,7 +65,7 @@ PUSHBUTTON "Cancel", IDCANCEL,109,20,50,14, WS_TABSTOP | WS_GROUP }
-CLASS_TEST_DIALOG DIALOG DISCARDABLE 0, 0, 91, 28 +CLASS_TEST_DIALOG DIALOG 0, 0, 91, 28 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "CreateDialogParams Test" CLASS "TestDialog" @@ -73,7 +73,7 @@ { }
-CLASS_TEST_DIALOG_2 DIALOG DISCARDABLE 0, 0, 100, 100 +CLASS_TEST_DIALOG_2 DIALOG 0, 0, 100, 100 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "CreateDialogParams Test" CLASS "MyDialogClass" @@ -81,7 +81,7 @@ { }
-FOCUS_TEST_DIALOG DIALOG DISCARDABLE 0, 0, 60, 30 +FOCUS_TEST_DIALOG DIALOG 0, 0, 60, 30 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | DS_CONTROL CAPTION "Test dialog" FONT 8, "MS Shell Dlg" @@ -89,7 +89,7 @@ EDITTEXT 200,4,4,50,14 }
-IDD_DIALOG DIALOG DISCARDABLE 0, 0, 186, 95 +IDD_DIALOG DIALOG 0, 0, 186, 95 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Dialog" FONT 8, "MS Sans Serif" @@ -98,14 +98,14 @@ PUSHBUTTON "Cancel",IDCANCEL,129,24,50,14 END
-TEST_EMPTY_DIALOG DIALOG DISCARDABLE 0, 0, 186, 95 +TEST_EMPTY_DIALOG DIALOG 0, 0, 186, 95 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Dialog" FONT 8, "MS Sans Serif" BEGIN END
-MULTI_EDIT_DIALOG DIALOG DISCARDABLE 0, 0, 160, 75 +MULTI_EDIT_DIALOG DIALOG 0, 0, 160, 75 STYLE WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | DS_CENTER CAPTION "Multiple Edit Test" FONT 8, "MS Shell Dlg" @@ -115,52 +115,52 @@ EDITTEXT 1002, 5, 45, 150, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP }
-EDIT_DIALOG DIALOG DISCARDABLE 0, 0, 160, 80 +EDIT_DIALOG DIALOG 0, 0, 160, 80 STYLE WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | DS_CENTER CAPTION "Edit Test" FONT 8, "MS Shell Dlg" { - PUSHBUTTON "Ok", IDOK, 20, 60, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP + PUSHBUTTON "OK", IDOK, 20, 60, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP PUSHBUTTON "Cancel", IDCANCEL, 100, 60, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP EDITTEXT 1000, 5, 5, 150, 50, WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_MULTILINE | WS_VSCROLL | ES_AUTOVSCROLL }
-EDIT_SINGLELINE_DIALOG DIALOG DISCARDABLE 0, 0, 160, 80 +EDIT_SINGLELINE_DIALOG DIALOG 0, 0, 160, 80 STYLE WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | DS_CENTER CAPTION "Edit Test" FONT 8, "MS Shell Dlg" { - PUSHBUTTON "Ok", IDOK, 20, 60, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP + PUSHBUTTON "OK", IDOK, 20, 60, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP PUSHBUTTON "Cancel", IDCANCEL, 100, 60, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP EDITTEXT 1000, 5, 5, 150, 50, WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL | ES_AUTOVSCROLL }
-EDIT_SINGLELINE_WANTRETURN_DIALOG DIALOG DISCARDABLE 0, 0, 160, 80 +EDIT_SINGLELINE_WANTRETURN_DIALOG DIALOG 0, 0, 160, 80 STYLE WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | DS_CENTER CAPTION "Edit Test" FONT 8, "MS Shell Dlg" { - PUSHBUTTON "Ok", IDOK, 20, 60, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP + PUSHBUTTON "OK", IDOK, 20, 60, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP PUSHBUTTON "Cancel", IDCANCEL, 100, 60, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP EDITTEXT 1000, 5, 5, 150, 50, WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL | ES_AUTOVSCROLL | ES_WANTRETURN }
-EDIT_WANTRETURN_DIALOG DIALOG DISCARDABLE 0, 0, 160, 80 +EDIT_WANTRETURN_DIALOG DIALOG 0, 0, 160, 80 STYLE WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | DS_CENTER CAPTION "Edit Test" FONT 8, "MS Shell Dlg" { - PUSHBUTTON "Ok", IDOK, 20, 60, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP + PUSHBUTTON "OK", IDOK, 20, 60, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP PUSHBUTTON "Cancel", IDCANCEL, 100, 60, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP EDITTEXT 1000, 5, 5, 150, 50, WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_MULTILINE | WS_VSCROLL | ES_AUTOVSCROLL | ES_WANTRETURN }
-EDIT_READONLY_DIALOG DIALOG DISCARDABLE 0, 0, 160, 80 +EDIT_READONLY_DIALOG DIALOG 0, 0, 160, 80 STYLE WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | DS_CENTER CAPTION "Edit Readonly Test" FONT 8, "MS Shell Dlg" { - PUSHBUTTON "Ok", IDOK, 20, 60, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP + PUSHBUTTON "OK", IDOK, 20, 60, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP PUSHBUTTON "Cancel", IDCANCEL, 100, 60, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP EDITTEXT 1000, 5, 5, 150, 50, WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_MULTILINE | WS_VSCROLL | ES_AUTOVSCROLL | ES_READONLY } @@ -190,4 +190,5 @@ MENUITEM "&Paste", 203 MENUITEM "&Delete", 204 } + MENUITEM "&Quit", 300 }
Modified: trunk/rostests/winetests/user32/static.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/user32/static.c?... ============================================================================== --- trunk/rostests/winetests/user32/static.c [iso-8859-1] (original) +++ trunk/rostests/winetests/user32/static.c [iso-8859-1] Mon Oct 3 19:49:16 2011 @@ -40,6 +40,22 @@
static int g_nReceivedColorStatic = 0;
+/* try to make sure pending X events have been processed before continuing */ +static void flush_events(void) +{ + MSG msg; + int diff = 200; + int min_timeout = 100; + DWORD time = GetTickCount() + diff; + + while (diff > 0) + { + if (MsgWaitForMultipleObjects( 0, NULL, FALSE, min_timeout, QS_ALLINPUT ) == WAIT_TIMEOUT) break; + while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessage( &msg ); + diff = time - GetTickCount(); + } +} + static HWND build_static(DWORD style) { return CreateWindow("static", "Test", WS_VISIBLE|WS_CHILD|style, 5, 5, 100, 100, hMainWnd, (HMENU)CTRL_ID, NULL, 0); @@ -70,6 +86,7 @@ HWND hStatic = build_static(style); int exp;
+ flush_events(); trace("Testing style 0x%x\n", style); g_nReceivedColorStatic = 0; /* during each update parent WndProc will test the WM_CTLCOLORSTATIC message */ @@ -122,7 +139,6 @@
hMainWnd = CreateWindow(szClassName, "Test", WS_OVERLAPPEDWINDOW, 0, 0, 500, 500, NULL, NULL, GetModuleHandle(NULL), NULL); ShowWindow(hMainWnd, SW_SHOW); - UpdateWindow(hMainWnd);
test_updates(0, 0); test_updates(SS_SIMPLE, 0);
Modified: trunk/rostests/winetests/user32/win.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/user32/win.c?rev... ============================================================================== --- trunk/rostests/winetests/user32/win.c [iso-8859-1] (original) +++ trunk/rostests/winetests/user32/win.c [iso-8859-1] Mon Oct 3 19:49:16 2011 @@ -6701,7 +6701,7 @@ if(!winetest_interactive) skip("bug 5957: skipping test_shell_window, it crashes ros/win7 explorer\n"); else - test_shell_window(); + test_shell_window(); test_handles( hwndMain ); test_winregion();
Modified: trunk/rostests/winetests/user32/winstation.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/user32/winstatio... ============================================================================== --- trunk/rostests/winetests/user32/winstation.c [iso-8859-1] (original) +++ trunk/rostests/winetests/user32/winstation.c [iso-8859-1] Mon Oct 3 19:49:16 2011 @@ -108,7 +108,7 @@ HWINSTA w1, w2, w3; HDESK d1, d2, d3; HANDLE hthread; - DWORD id, flags; + DWORD id, flags, le; ATOM atom; char buffer[20];
@@ -137,16 +137,22 @@ ok( CloseHandle(w2), "closing dup win station handle failed\n" );
w2 = CreateWindowStation("WinSta0", 0, WINSTA_ALL_ACCESS, NULL ); - ok( w2 != 0, "CreateWindowStation failed\n" ); - ok( w2 != w1, "CreateWindowStation returned default handle\n" ); - SetLastError( 0xdeadbeef ); - ok( !CloseDesktop( (HDESK)w2 ), "CloseDesktop succeeded on win station\n" ); - ok( GetLastError() == ERROR_INVALID_HANDLE || broken(GetLastError() == 0xdeadbeef), /* wow64 */ - "bad last error %d\n", GetLastError() ); - ok( CloseWindowStation( w2 ), "CloseWindowStation failed\n" ); - - w2 = CreateWindowStation("WinSta0", 0, WINSTA_ALL_ACCESS, NULL ); - ok( CloseHandle( w2 ), "CloseHandle failed\n" ); + le = GetLastError(); + ok( w2 != 0 || le == ERROR_ACCESS_DENIED, "CreateWindowStation failed (%u)\n", le ); + if (w2 != 0) + { + ok( w2 != w1, "CreateWindowStation returned default handle\n" ); + SetLastError( 0xdeadbeef ); + ok( !CloseDesktop( (HDESK)w2 ), "CloseDesktop succeeded on win station\n" ); + ok( GetLastError() == ERROR_INVALID_HANDLE || broken(GetLastError() == 0xdeadbeef), /* wow64 */ + "bad last error %d\n", GetLastError() ); + ok( CloseWindowStation( w2 ), "CloseWindowStation failed\n" ); + + w2 = CreateWindowStation("WinSta0", 0, WINSTA_ALL_ACCESS, NULL ); + ok( CloseHandle( w2 ), "CloseHandle failed\n" ); + } + else if (le == ERROR_ACCESS_DENIED) + win_skip( "Not enough privileges for CreateWindowStation\n" );
w2 = OpenWindowStation("winsta0", TRUE, WINSTA_ALL_ACCESS ); ok( w2 != 0, "OpenWindowStation failed\n" ); @@ -158,38 +164,43 @@
CreateMutexA( NULL, 0, "foobar" ); w2 = CreateWindowStation("foobar", 0, WINSTA_ALL_ACCESS, NULL ); - ok( w2 != 0, "create foobar station failed\n" ); - - w3 = OpenWindowStation("foobar", TRUE, WINSTA_ALL_ACCESS ); - ok( w3 != 0, "open foobar station failed\n" ); - ok( w3 != w2, "open foobar station returned same handle\n" ); - ok( CloseWindowStation( w2 ), "CloseWindowStation failed\n" ); - ok( CloseWindowStation( w3 ), "CloseWindowStation failed\n" ); - - w3 = OpenWindowStation("foobar", TRUE, WINSTA_ALL_ACCESS ); - ok( !w3, "open foobar station succeeded\n" ); - - w2 = CreateWindowStation("foobar1", 0, WINSTA_ALL_ACCESS, NULL ); - ok( w2 != 0, "create foobar station failed\n" ); - w3 = CreateWindowStation("foobar2", 0, WINSTA_ALL_ACCESS, NULL ); - ok( w3 != 0, "create foobar station failed\n" ); - ok( GetHandleInformation( w2, &flags ), "GetHandleInformation failed\n" ); - ok( GetHandleInformation( w3, &flags ), "GetHandleInformation failed\n" ); - - SetProcessWindowStation( w2 ); - register_class(); - atom = GlobalAddAtomA("foo"); - ok( GlobalGetAtomNameA( atom, buffer, sizeof(buffer) ) == 3, "GlobalGetAtomName failed\n" ); - ok( !lstrcmpiA( buffer, "foo" ), "bad atom value %s\n", buffer ); - - ok( !CloseWindowStation( w2 ), "CloseWindowStation succeeded\n" ); - ok( GetHandleInformation( w2, &flags ), "GetHandleInformation failed\n" ); - - SetProcessWindowStation( w3 ); - ok( GetHandleInformation( w2, &flags ), "GetHandleInformation failed\n" ); - ok( CloseWindowStation( w2 ), "CloseWindowStation failed\n" ); - ok( GlobalGetAtomNameA( atom, buffer, sizeof(buffer) ) == 3, "GlobalGetAtomName failed\n" ); - ok( !lstrcmpiA( buffer, "foo" ), "bad atom value %s\n", buffer ); + le = GetLastError(); + ok( w2 != 0 || le == ERROR_ACCESS_DENIED, "create foobar station failed (%u)\n", le ); + + if (w2 != 0) + { + w3 = OpenWindowStation("foobar", TRUE, WINSTA_ALL_ACCESS ); + ok( w3 != 0, "open foobar station failed\n" ); + ok( w3 != w2, "open foobar station returned same handle\n" ); + ok( CloseWindowStation( w2 ), "CloseWindowStation failed\n" ); + ok( CloseWindowStation( w3 ), "CloseWindowStation failed\n" ); + + w3 = OpenWindowStation("foobar", TRUE, WINSTA_ALL_ACCESS ); + ok( !w3, "open foobar station succeeded\n" ); + + w2 = CreateWindowStation("foobar1", 0, WINSTA_ALL_ACCESS, NULL ); + ok( w2 != 0, "create foobar station failed\n" ); + w3 = CreateWindowStation("foobar2", 0, WINSTA_ALL_ACCESS, NULL ); + ok( w3 != 0, "create foobar station failed\n" ); + ok( GetHandleInformation( w2, &flags ), "GetHandleInformation failed\n" ); + ok( GetHandleInformation( w3, &flags ), "GetHandleInformation failed\n" ); + + SetProcessWindowStation( w2 ); + atom = GlobalAddAtomA("foo"); + ok( GlobalGetAtomNameA( atom, buffer, sizeof(buffer) ) == 3, "GlobalGetAtomName failed\n" ); + ok( !lstrcmpiA( buffer, "foo" ), "bad atom value %s\n", buffer ); + + ok( !CloseWindowStation( w2 ), "CloseWindowStation succeeded\n" ); + ok( GetHandleInformation( w2, &flags ), "GetHandleInformation failed\n" ); + + SetProcessWindowStation( w3 ); + ok( GetHandleInformation( w2, &flags ), "GetHandleInformation failed\n" ); + ok( CloseWindowStation( w2 ), "CloseWindowStation failed\n" ); + ok( GlobalGetAtomNameA( atom, buffer, sizeof(buffer) ) == 3, "GlobalGetAtomName failed\n" ); + ok( !lstrcmpiA( buffer, "foo" ), "bad atom value %s\n", buffer ); + } + else if (le == ERROR_ACCESS_DENIED) + win_skip( "Not enough privileges for CreateWindowStation\n" );
/* desktops */ d1 = GetThreadDesktop(GetCurrentThreadId()); @@ -251,6 +262,7 @@ d2 = GetThreadDesktop(GetCurrentThreadId()); ok( d1 == d2, "got different handles after close\n" );
+ register_class(); trace( "thread 1 desktop: %p\n", d1 ); print_object( d1 ); hthread = CreateThread( NULL, 0, thread, (LPVOID)2, 0, &id );