[PATCH] user32/tests: Fix a test failure on Windows < Vista.

Zebediah Figura z.figura12 at gmail.com
Sat Dec 28 12:09:51 CST 2019


Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 dlls/user32/tests/winstation.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/dlls/user32/tests/winstation.c b/dlls/user32/tests/winstation.c
index aaa51d560ac..233ce966355 100644
--- a/dlls/user32/tests/winstation.c
+++ b/dlls/user32/tests/winstation.c
@@ -68,7 +68,10 @@ static HDESK initial_desktop;
 static DWORD CALLBACK thread( LPVOID arg )
 {
     HDESK d1, d2;
-    HWND hwnd = CreateWindowExA(0,"WinStationClass","test",WS_POPUP,0,0,100,100,GetDesktopWindow(),0,0,0);
+    HWND hwnd;
+    BOOL ret;
+
+    hwnd = CreateWindowExA(0,"WinStationClass","test",WS_POPUP,0,0,100,100,GetDesktopWindow(),0,0,0);
     ok( hwnd != 0, "CreateWindow failed\n" );
     d1 = GetThreadDesktop(GetCurrentThreadId());
     trace( "thread %p desktop: %p\n", arg, d1 );
@@ -92,9 +95,13 @@ static DWORD CALLBACK thread( LPVOID arg )
         "bad last error %d\n", GetLastError() );
 
     DestroyWindow( hwnd );
-    ok( SetThreadDesktop( d2 ), "set thread desktop failed\n" );
-    d1 = GetThreadDesktop(GetCurrentThreadId());
-    ok( d1 == d2, "GetThreadDesktop did not return set desktop %p/%p\n", d1, d2 );
+    ret = SetThreadDesktop( d2 );
+    ok(ret || broken(!ret) /* < Vista */, "failed to set desktop, error %u\n", GetLastError());
+    if (ret)
+    {
+        d1 = GetThreadDesktop(GetCurrentThreadId());
+        ok( d1 == d2, "GetThreadDesktop did not return set desktop %p/%p\n", d1, d2 );
+    }
     print_object( d2 );
     if (arg < (LPVOID)5)
     {
-- 
2.24.0




More information about the wine-devel mailing list