From 0970a98c8488d6aeff20839417205c8200acacf6 Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Mon, 2 Sep 2024 14:08:26 +0200 Subject: Windows: Fix bug in disabling of Windows privileges, they were completely removed instead This started to cause issues after latest changes to disable privileges when they are no more needed. Because of the bug, the privileges could not be enabled again because they were wrongly removed. --- src/Common/Dlgcode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Common/Dlgcode.c') diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c index 488b050f..269817d8 100644 --- a/src/Common/Dlgcode.c +++ b/src/Common/Dlgcode.c @@ -13706,11 +13706,11 @@ BOOL SetPrivilege(LPTSTR szPrivilegeName, BOOL bEnable) &tkp.Privileges[0].Luid)) { tkp.PrivilegeCount = 1; - tkp.Privileges[0].Attributes = bEnable? SE_PRIVILEGE_ENABLED : SE_PRIVILEGE_REMOVED; + tkp.Privileges[0].Attributes = bEnable? SE_PRIVILEGE_ENABLED : 0; bRet = AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, NULL, NULL); dwLastError = GetLastError (); - if ( ERROR_SUCCESS != dwLastError) + if (bRet && (ERROR_NOT_ALL_ASSIGNED == dwLastError)) { bRet = FALSE; } -- cgit v1.2.3