diff options
author | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2024-09-02 14:08:26 +0200 |
---|---|---|
committer | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2024-09-02 14:08:26 +0200 |
commit | 0970a98c8488d6aeff20839417205c8200acacf6 (patch) | |
tree | c749d71d295ad4ac744456c5b4420077d19f4d54 /src/Common/Dlgcode.c | |
parent | f024653450e3bbbd54aa98ab8dc1ad96f8afa1b6 (diff) | |
download | VeraCrypt-0970a98c8488d6aeff20839417205c8200acacf6.tar.gz VeraCrypt-0970a98c8488d6aeff20839417205c8200acacf6.zip |
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.
Diffstat (limited to 'src/Common/Dlgcode.c')
-rw-r--r-- | src/Common/Dlgcode.c | 4 |
1 files changed, 2 insertions, 2 deletions
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; } |