VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common/Dlgcode.c
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2023-06-23 00:32:24 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2023-06-23 00:32:24 +0200
commit0e4f1ecee33db0353dc845ee02b339f9c4ab7c22 (patch)
treefbe08122210f7d3509a8b59335a25afa1026e693 /src/Common/Dlgcode.c
parentd4ae2ce8937ad904894c90188ae3b44f9cda3315 (diff)
downloadVeraCrypt-0e4f1ecee33db0353dc845ee02b339f9c4ab7c22.tar.gz
VeraCrypt-0e4f1ecee33db0353dc845ee02b339f9c4ab7c22.zip
Windows: Make SetPrivilege return error if AdjustTokenPrivileges cannot adjust privileges
Diffstat (limited to 'src/Common/Dlgcode.c')
-rw-r--r--src/Common/Dlgcode.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c
index 76748fe5..e1170d84 100644
--- a/src/Common/Dlgcode.c
+++ b/src/Common/Dlgcode.c
@@ -13975,10 +13975,13 @@ BOOL SetPrivilege(LPTSTR szPrivilegeName, BOOL bEnable)
tkp.PrivilegeCount = 1;
tkp.Privileges[0].Attributes = bEnable? SE_PRIVILEGE_ENABLED : SE_PRIVILEGE_REMOVED;
bRet = AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, NULL, NULL);
- if (!bRet)
- dwLastError = GetLastError ();
+ dwLastError = GetLastError ();
+ if ( ERROR_SUCCESS != dwLastError)
+ {
+ bRet = FALSE;
+ }
}
else
dwLastError = GetLastError ();