Qian Hong : user32/tests: Skip winstation tests when no enough privileges.

Alexandre Julliard julliard at winehq.org
Tue Oct 15 13:27:12 CDT 2013


Module: wine
Branch: master
Commit: a0637a7f52f4a40499d9689a6f71d6e957694afe
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=a0637a7f52f4a40499d9689a6f71d6e957694afe

Author: Qian Hong <qhong at codeweavers.com>
Date:   Tue Oct 15 17:01:27 2013 +0800

user32/tests: Skip winstation tests when no enough privileges.

---

 dlls/user32/tests/winstation.c |   19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/dlls/user32/tests/winstation.c b/dlls/user32/tests/winstation.c
index 9525902..fd6bcc0 100644
--- a/dlls/user32/tests/winstation.c
+++ b/dlls/user32/tests/winstation.c
@@ -662,8 +662,16 @@ static void test_inputdesktop2(void)
     ok(thread_desk != NULL, "GetThreadDesktop failed!\n");
     w1 = GetProcessWindowStation();
     ok(w1 != NULL, "GetProcessWindowStation failed!\n");
+    SetLastError(0xdeadbeef);
     w2 = CreateWindowStation("winsta_test", 0, WINSTA_ALL_ACCESS, NULL);
-    ok(w2 != NULL, "CreateWindowStation failed!\n");
+    ret = GetLastError();
+    ok(w2 != NULL || ret == ERROR_ACCESS_DENIED, "CreateWindowStation failed (%u)\n", ret);
+    if (!w2)
+    {
+        win_skip("Not enough privileges for CreateWindowStation\n");
+        return;
+    }
+
     ret = EnumDesktopsA(GetProcessWindowStation(), desktop_callbackA, 0);
     ok(!ret, "EnumDesktopsA failed!\n");
     input_desk = OpenInputDesktop(0, FALSE, DESKTOP_ALL_ACCESS);
@@ -804,8 +812,15 @@ static void test_foregroundwindow(void)
 
     hdesks[0] = GetThreadDesktop(GetCurrentThreadId());
     ok(hdesks[0] != NULL, "OpenDesktop failed!\n");
+    SetLastError(0xdeadbeef);
     hdesks[1] = CreateDesktop("desk2", NULL, NULL, 0, DESKTOP_ALL_ACCESS, NULL);
-    ok(hdesks[1] != NULL, "CreateDesktop failed!\n");
+    ret = GetLastError();
+    ok(hdesks[1] != NULL || ret == ERROR_ACCESS_DENIED, "CreateDesktop failed (%u)\n", ret);
+    if(!hdesks[1])
+    {
+        win_skip("Not enough privileges for CreateDesktop\n");
+        return;
+    }
 
     for (thread_desk_id = 0; thread_desk_id < DESKTOPS; thread_desk_id++)
     {




More information about the wine-cvs mailing list