VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common/Dlgcode.c
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2018-04-23 12:56:02 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2018-04-23 16:59:40 +0200
commit4f0d1c02bdf4adf56caf48de967c41d2d4d9ff2d (patch)
tree360d2be90e73133d06037922c6267617ab77d9ff /src/Common/Dlgcode.c
parent42e7da2e8aa86eff54667fa1e76a64b1787d68e5 (diff)
downloadVeraCrypt-4f0d1c02bdf4adf56caf48de967c41d2d4d9ff2d.tar.gz
VeraCrypt-4f0d1c02bdf4adf56caf48de967c41d2d4d9ff2d.zip
Windows: Don't start EFI system encryption process if SecureBoot is enabled and VeraCrypt-DCS custom keys were not loaded in the machine firmware.
Diffstat (limited to 'src/Common/Dlgcode.c')
-rw-r--r--src/Common/Dlgcode.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c
index 03e0d6c8..00e1558f 100644
--- a/src/Common/Dlgcode.c
+++ b/src/Common/Dlgcode.c
@@ -13093,7 +13093,7 @@ BOOL GetFreeDriveLetter(WCHAR* pCh) {
return FALSE;
}
-BOOL RaisePrivileges(void)
+BOOL SetPrivilege(LPTSTR szPrivilegeName, BOOL bEnable)
{
HANDLE hToken;
TOKEN_PRIVILEGES tkp;
@@ -13104,15 +13104,13 @@ BOOL RaisePrivileges(void)
TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY,
&hToken))
{
- if (LookupPrivilegeValue(NULL, SE_SYSTEM_ENVIRONMENT_NAME,
+ if (LookupPrivilegeValue(NULL, szPrivilegeName,
&tkp.Privileges[0].Luid))
{
- DWORD len;
-
tkp.PrivilegeCount = 1;
- tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
+ tkp.Privileges[0].Attributes = bEnable? SE_PRIVILEGE_ENABLED : SE_PRIVILEGE_REMOVED;
- bRet = AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, NULL, &len);
+ bRet = AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, NULL, NULL);
if (!bRet)
dwLastError = GetLastError ();
}