VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Setup/Setup.c
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2019-01-26 00:18:03 (GMT)
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2019-01-26 00:20:51 (GMT)
commita20b3083b058901572953364dccbdd4cad8f3c5a (patch)
tree6a208ab4663e8e7d7da021ac61c8aa290fa0edde /src/Setup/Setup.c
parent7b95b375a0aeb7fcba50437944d94bab074e7df4 (diff)
downloadVeraCrypt-a20b3083b058901572953364dccbdd4cad8f3c5a.zip
VeraCrypt-a20b3083b058901572953364dccbdd4cad8f3c5a.tar.gz
Windows: Add a build configuration containing EFI bootloader signed with custom SecureBoot key instead
Diffstat (limited to 'src/Setup/Setup.c')
-rw-r--r--src/Setup/Setup.c51
1 files changed, 49 insertions, 2 deletions
diff --git a/src/Setup/Setup.c b/src/Setup/Setup.c
index bd073d9..7d17962 100644
--- a/src/Setup/Setup.c
+++ b/src/Setup/Setup.c
@@ -658,6 +658,53 @@ void IconMessage (HWND hwndDlg, const wchar_t *txt)
StatusMessageParam (hwndDlg, "ADDING_ICON", txt);
}
+#ifdef VC_EFI_CUSTOM_MODE
+BOOL CheckSecureBootCompatibility (HWND hWnd)
+{
+ BOOL bRet = FALSE;
+ BOOL bDriverAttached = FALSE;
+ if (hDriver == INVALID_HANDLE_VALUE)
+ {
+ int status = DriverAttach();
+ if (status || (hDriver == INVALID_HANDLE_VALUE))
+ return FALSE;
+ bDriverAttached = TRUE;
+ }
+
+ try
+ {
+ BootEncryption bootEnc (hWnd);
+ if (bootEnc.GetDriverServiceStartType() == SERVICE_BOOT_START)
+ {
+ SystemDriveConfiguration config = bootEnc.GetSystemDriveConfiguration ();
+ if (config.SystemPartition.IsGPT)
+ {
+ BOOL bSecureBootEnabled = FALSE, bVeraCryptKeysLoaded = FALSE;
+ bootEnc.GetSecureBootConfig (&bSecureBootEnabled, &bVeraCryptKeysLoaded);
+ if (!bSecureBootEnabled || bVeraCryptKeysLoaded)
+ {
+ bRet = TRUE;
+ }
+ }
+ else
+ bRet = TRUE;
+ }
+ else
+ bRet = TRUE;
+ }
+ catch (...)
+ {
+ }
+
+ if (bDriverAttached)
+ {
+ CloseHandle (hDriver);
+ hDriver = INVALID_HANDLE_VALUE;
+ }
+ return bRet;
+}
+#endif
+
void DetermineUpgradeDowngradeStatus (BOOL bCloseDriverHandle, LONG *driverVersionPtr)
{
LONG driverVersion = VERSION_NUM;
@@ -1133,7 +1180,7 @@ BOOL DoRegInstall (HWND hwndDlg, wchar_t *szDestDir, BOOL bInstallType)
if (RegCreateKeyEx (HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\VeraCrypt",
0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE | KEY_WOW64_32KEY, NULL, &hkey, &dw) == ERROR_SUCCESS)
{
- StringCbCopyW (szTmp, sizeof(szTmp), _T(VERSION_STRING));
+ StringCbCopyW (szTmp, sizeof(szTmp), _T(VERSION_STRING) _T(VERSION_STRING_SUFFIX));
RegSetValueEx (hkey, L"DisplayVersion", 0, REG_SZ, (BYTE *) szTmp, (wcslen (szTmp) + 1) * sizeof (wchar_t));
StringCbCopyW (szTmp, sizeof(szTmp), TC_HOMEPAGE);
@@ -1249,7 +1296,7 @@ BOOL DoRegInstall (HWND hwndDlg, wchar_t *szDestDir, BOOL bInstallType)
if (RegSetValueEx (hkey, L"DisplayIcon", 0, REG_SZ, (BYTE *) szTmp, (wcslen (szTmp) + 1) * sizeof (wchar_t)) != ERROR_SUCCESS)
goto error;
- StringCbCopyW (szTmp, sizeof(szTmp), _T(VERSION_STRING));
+ StringCbCopyW (szTmp, sizeof(szTmp), _T(VERSION_STRING) _T(VERSION_STRING_SUFFIX));
if (RegSetValueEx (hkey, L"DisplayVersion", 0, REG_SZ, (BYTE *) szTmp, (wcslen (szTmp) + 1) * sizeof (wchar_t)) != ERROR_SUCCESS)
goto error;