advapi32/tests: Properly restore privileges in test_AdjustTokenPrivileges.

Thomas Faber thomas.faber at reactos.org
Thu Jun 15 06:56:15 CDT 2017


In the current version, the AdjustTokenPrivileges always fails because
PreviousState is passed in, but not ReturnLength:
https://testbot.winehq.org/JobDetails.pl?Key=31655

Removing the &prev argument makes it actually restore the privilege.
-------------- next part --------------
From 3e9f2363c8a5d843bf451986dd51cddb181bff12 Mon Sep 17 00:00:00 2001
From: Thomas Faber <thomas.faber at reactos.org>
Date: Thu, 15 Jun 2017 12:56:48 +0200
Subject: advapi32/tests: Properly restore privileges in
 test_AdjustTokenPrivileges.

Signed-off-by: Thomas Faber <thomas.faber at reactos.org>
---
 dlls/advapi32/tests/security.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c
index fa3211ce440..364c994f585 100644
--- a/dlls/advapi32/tests/security.c
+++ b/dlls/advapi32/tests/security.c
@@ -6081,7 +6081,7 @@ static void test_default_dacl_owner_sid(void)
 
 static void test_AdjustTokenPrivileges(void)
 {
-    TOKEN_PRIVILEGES tp, prev;
+    TOKEN_PRIVILEGES tp;
     HANDLE token;
     DWORD len;
     LUID luid;
@@ -6109,7 +6109,8 @@ static void test_AdjustTokenPrivileges(void)
     tp.PrivilegeCount = 1;
     tp.Privileges[0].Luid = luid;
     tp.Privileges[0].Attributes = 0;
-    AdjustTokenPrivileges(token, FALSE, &tp, sizeof(TOKEN_PRIVILEGES), &prev, NULL);
+    ret = AdjustTokenPrivileges(token, FALSE, &tp, sizeof(TOKEN_PRIVILEGES), NULL, NULL);
+    ok(ret, "got %d\n", ret);
 
     CloseHandle(token);
 }
-- 
2.12.2.windows.2



More information about the wine-patches mailing list