VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common/BootEncryption.cpp
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2018-04-19 18:31:40 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2018-04-23 16:59:35 +0200
commitf4edd72662106798dc216c5cabbf39605391523e (patch)
tree53fc78c171ace77bb256d5835ea50ca3f0764bb1 /src/Common/BootEncryption.cpp
parent8e4497de2a68600daabcfbd75524d04d2edae17c (diff)
downloadVeraCrypt-f4edd72662106798dc216c5cabbf39605391523e.tar.gz
VeraCrypt-f4edd72662106798dc216c5cabbf39605391523e.zip
Windows: code refactoring
Diffstat (limited to 'src/Common/BootEncryption.cpp')
-rw-r--r--src/Common/BootEncryption.cpp25
1 files changed, 10 insertions, 15 deletions
diff --git a/src/Common/BootEncryption.cpp b/src/Common/BootEncryption.cpp
index e64347d7..c62df958 100644
--- a/src/Common/BootEncryption.cpp
+++ b/src/Common/BootEncryption.cpp
@@ -2717,11 +2717,13 @@ namespace VeraCrypt
}
if (GetSetupconfigLocation (szSetupconfigLocation, ARRAYSIZE (szSetupconfigLocation)))
{
- ::CreateDirectoryW (szSetupconfigLocation, NULL);
+ if (bForInstall)
+ ::CreateDirectoryW (szSetupconfigLocation, NULL);
StringCchCatW (szSetupconfigLocation, ARRAYSIZE (szSetupconfigLocation), L"SetupConfig.ini");
- WritePrivateProfileStringW (L"SetupConfig", L"ReflectDrivers", bForInstall? szInstallPath : NULL, szSetupconfigLocation);
+ if (bForInstall || FileExists (szSetupconfigLocation))
+ WritePrivateProfileStringW (L"SetupConfig", L"ReflectDrivers", bForInstall? szInstallPath : NULL, szSetupconfigLocation);
}
}
}
@@ -3837,20 +3839,13 @@ namespace VeraCrypt
device.Write (bootLoaderBuf, sizeof (bootLoaderBuf));
}
- // starting from Windows 10 1607 (Build 14393), ReflectDrivers in Setupconfig.ini is supported
- if (IsOSVersionAtLeast (WIN_10, 0) && CurrentOSBuildNumber >= 14393)
+ if (!IsAdmin() && IsUacSupported())
{
- wchar_t szSetupconfigLocation [TC_MAX_PATH + 20];
-
- if (GetSetupconfigLocation (szSetupconfigLocation, ARRAYSIZE (szSetupconfigLocation)))
- {
- StringCchCatW (szSetupconfigLocation, ARRAYSIZE (szSetupconfigLocation), L"SetupConfig.ini");
-
- if (FileExists (szSetupconfigLocation))
- {
- WritePrivateProfileStringW (L"SetupConfig", L"ReflectDrivers", NULL, szSetupconfigLocation);
- }
- }
+ Elevator::UpdateSetupConfigFile (false);
+ }
+ else
+ {
+ UpdateSetupConfigFile (false);
}
}