diff options
Diffstat (limited to 'src/Mount')
-rw-r--r-- | src/Mount/Favorites.cpp | 212 | ||||
-rw-r--r-- | src/Mount/Favorites.h | 4 | ||||
-rw-r--r-- | src/Mount/Hotkeys.c | 2 | ||||
-rw-r--r-- | src/Mount/Hotkeys.h | 2 | ||||
-rw-r--r-- | src/Mount/MainCom.cpp | 57 | ||||
-rw-r--r-- | src/Mount/MainCom.h | 4 | ||||
-rw-r--r-- | src/Mount/MainCom.idl | 23 | ||||
-rw-r--r-- | src/Mount/Mount.c | 3083 | ||||
-rw-r--r-- | src/Mount/Mount.h | 43 | ||||
-rw-r--r-- | src/Mount/Mount.manifest | 8 | ||||
-rw-r--r-- | src/Mount/Mount.rc | 167 | ||||
-rw-r--r-- | src/Mount/Mount.vcproj | 1027 | ||||
-rw-r--r-- | src/Mount/Mount.vcxproj | 501 | ||||
-rw-r--r-- | src/Mount/Mount.vcxproj.filters | 419 | ||||
-rw-r--r-- | src/Mount/Mount.vcxproj.user | 3 | ||||
-rw-r--r-- | src/Mount/Resource.h | 23 |
16 files changed, 2904 insertions, 2674 deletions
diff --git a/src/Mount/Favorites.cpp b/src/Mount/Favorites.cpp index ee34272f..c829128f 100644 --- a/src/Mount/Favorites.cpp +++ b/src/Mount/Favorites.cpp @@ -3,9 +3,9 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed by the TrueCrypt License 3.0. Modifications and additions to the original source code (contained in this file) - and all other portions of this file are Copyright (c) 2013-2016 IDRIX + and all other portions of this file are Copyright (c) 2013-2017 IDRIX and are governed by the Apache License 2.0 the full text of which is contained in the file License.txt included in VeraCrypt binary and source code distribution packages. */ @@ -99,9 +99,8 @@ namespace VeraCrypt favorite.SystemEncryption = prop.partitionInInactiveSysEncScope ? true : false; favorite.OpenExplorerWindow = (bExplore == TRUE); favorite.Pim = prop.volumePim; favorite.Pkcs5 = prop.pkcs5; - favorite.TrueCryptMode = (prop.pkcs5Iterations == get_pkcs5_iteration_count(prop.pkcs5, 0, TRUE, prop.partitionInInactiveSysEncScope))? 1 : 0; memcpy (favorite.VolumeID, prop.volumeID, VOLUME_ID_SIZE); if (favorite.VolumePathId.empty() && IsVolumeDeviceHosted (favorite.Path.c_str()) @@ -242,78 +241,93 @@ namespace VeraCrypt switch (lw) { case IDOK: - - /* Global System Favorites settings */ - - if (SystemFavoritesMode) { - BootEncryption BootEncObj (NULL); + BOOL bInitialOptionValue = NeedPeriodicDeviceListUpdate; + + /* Global System Favorites settings */ - if (BootEncObj.GetStatus().DriveMounted) + if (SystemFavoritesMode) { - try - { - uint32 reqConfig = IsDlgButtonChecked (hwndDlg, IDC_FAVORITE_OPEN_EXPLORER_WIN_ON_MOUNT) ? TC_DRIVER_CONFIG_CACHE_BOOT_PASSWORD_FOR_SYS_FAVORITES : 0; - if (reqConfig != (ReadDriverConfigurationFlags() & TC_DRIVER_CONFIG_CACHE_BOOT_PASSWORD_FOR_SYS_FAVORITES)) - BootEncObj.RegisterSystemFavoritesService (reqConfig ? TRUE : FALSE); + BootEncryption BootEncObj (NULL); - SetDriverConfigurationFlag (TC_DRIVER_CONFIG_DISABLE_NONADMIN_SYS_FAVORITES_ACCESS, IsDlgButtonChecked (hwndDlg, IDC_FAVORITE_DISABLE_HOTKEY)); - } - catch (Exception &e) + if (BootEncObj.GetStatus().DriveMounted) { - e.Show (hwndDlg); + try + { + uint32 reqConfig = IsDlgButtonChecked (hwndDlg, IDC_FAVORITE_OPEN_EXPLORER_WIN_ON_MOUNT) ? TC_DRIVER_CONFIG_CACHE_BOOT_PASSWORD_FOR_SYS_FAVORITES : 0; + if (reqConfig != (ReadDriverConfigurationFlags() & TC_DRIVER_CONFIG_CACHE_BOOT_PASSWORD_FOR_SYS_FAVORITES)) + BootEncObj.SetDriverConfigurationFlag (TC_DRIVER_CONFIG_CACHE_BOOT_PASSWORD_FOR_SYS_FAVORITES, reqConfig ? true : false); + + if (!BootEncObj.IsSystemFavoritesServiceRunning()) + { + // The system favorites service should be always running + // If it is stopped for some reason, we reconfigure it + BootEncObj.RegisterSystemFavoritesService (TRUE); + } + + SetDriverConfigurationFlag (TC_DRIVER_CONFIG_DISABLE_NONADMIN_SYS_FAVORITES_ACCESS, IsDlgButtonChecked (hwndDlg, IDC_FAVORITE_DISABLE_HOTKEY)); + } + catch (Exception &e) + { + e.Show (hwndDlg); + } } } - } - /* (System) Favorites list */ + /* (System) Favorites list */ - if (SelectedItem != -1 && !Favorites.empty()) - SetFavoriteVolume (hwndDlg, Favorites[SelectedItem], SystemFavoritesMode); + if (SelectedItem != -1 && !Favorites.empty()) + SetFavoriteVolume (hwndDlg, Favorites[SelectedItem], SystemFavoritesMode); - if (SaveFavoriteVolumes (hwndDlg, Favorites, SystemFavoritesMode)) - { - if (!SystemFavoritesMode) + if (SaveFavoriteVolumes (hwndDlg, Favorites, SystemFavoritesMode)) { - bMountFavoritesOnLogon = FALSE; - - foreach (const FavoriteVolume &favorite, Favorites) + if (!SystemFavoritesMode) { - if (favorite.MountOnLogOn) + bMountFavoritesOnLogon = FALSE; + + foreach (const FavoriteVolume &favorite, Favorites) { - bMountFavoritesOnLogon = TRUE; - break; + if (favorite.MountOnLogOn) + { + bMountFavoritesOnLogon = TRUE; + break; + } } - } - if (!bEnableBkgTask || bCloseBkgTaskWhenNoVolumes || IsNonInstallMode()) - { - foreach (const FavoriteVolume favorite, Favorites) + if (!bEnableBkgTask || bCloseBkgTaskWhenNoVolumes || IsNonInstallMode()) { - if (favorite.MountOnArrival) + foreach (const FavoriteVolume favorite, Favorites) { - Warning ("FAVORITE_ARRIVAL_MOUNT_BACKGROUND_TASK_ERR", hwndDlg); - break; + if (favorite.MountOnArrival) + { + Warning ("FAVORITE_ARRIVAL_MOUNT_BACKGROUND_TASK_ERR", hwndDlg); + break; + } } } - } - FavoriteVolumes = Favorites; + if (!bInitialOptionValue && NeedPeriodicDeviceListUpdate) + { + // a favorite was set to use VolumeID. We update the list of devices available for mounting as early as possible + UpdateMountableHostDeviceList (); + } + + FavoriteVolumes = Favorites; - ManageStartupSeq(); - SaveSettings (hwndDlg); - } - else - SystemFavoriteVolumes = Favorites; + ManageStartupSeq(); + SaveSettings (hwndDlg); + } + else + SystemFavoriteVolumes = Favorites; - OnFavoriteVolumesUpdated(); - LoadDriveLetters (hwndDlg, GetDlgItem (MainDlg, IDC_DRIVELIST), 0); + OnFavoriteVolumesUpdated(); + LoadDriveLetters (hwndDlg, GetDlgItem (MainDlg, IDC_DRIVELIST), 0); - EndDialog (hwndDlg, IDOK); + EndDialog (hwndDlg, IDOK); + } } - return 1; case IDCANCEL: EndDialog (hwndDlg, IDCLOSE); @@ -381,18 +395,18 @@ namespace VeraCrypt } return 1; case IDC_FAVORITES_HELP_LINK: - Applink (SystemFavoritesMode ? "sysfavorites" : "favorites", TRUE, ""); + Applink (SystemFavoritesMode ? "sysfavorites" : "favorites"); return 1; case IDC_SHOW_PIM: HandleShowPasswordFieldAction (hwndDlg, IDC_SHOW_PIM, IDC_PIM, 0); return 1; case IDC_PIM: if (hw == EN_CHANGE) { - int pim = GetPim (hwndDlg, IDC_PIM); + int pim = GetPim (hwndDlg, IDC_PIM, -1); if (pim > (SystemFavoritesMode? MAX_BOOT_PIM_VALUE: MAX_PIM_VALUE)) { SetDlgItemText (hwndDlg, IDC_PIM, L""); SetFocus (GetDlgItem(hwndDlg, IDC_PIM)); @@ -437,15 +451,15 @@ namespace VeraCrypt return 1; case WM_CTLCOLORSTATIC: { HDC hdc = (HDC) wParam; - HWND hw = (HWND) lParam; - if (hw == GetDlgItem(hwndDlg, IDC_FAVORITE_VOLUME_ID)) + HWND hwnd = (HWND) lParam; + if (hwnd == GetDlgItem(hwndDlg, IDC_FAVORITE_VOLUME_ID)) { // This the favorite ID field. Make its background like normal edit HBRUSH hbr = GetSysColorBrush (COLOR_WINDOW); ::SelectObject(hdc, hbr); - return (BOOL) hbr; + return (BOOL)(INT_PTR)hbr; } } break; } @@ -553,8 +567,9 @@ namespace VeraCrypt void LoadFavoriteVolumes (vector <FavoriteVolume> &favorites, bool systemFavorites, bool noUacElevation) { + bool bVolumeIdInUse = false; favorites.clear(); wstring favoritesFilePath = systemFavorites ? GetServiceConfigPath (TC_APPD_FILENAME_SYSTEM_FAVORITE_VOLUMES, false) : GetConfigPath (TC_APPD_FILENAME_FAVORITE_VOLUMES); if (systemFavorites && !IsAdmin() && !noUacElevation) @@ -601,9 +616,9 @@ namespace VeraCrypt XmlGetAttributeText (xml, "ID", label, sizeof (label)); if (strlen (label) == (2*VOLUME_ID_SIZE)) { - std::vector<byte> arr; + std::vector<uint8> arr; if (HexWideStringToArray (Utf8StringToWide (label).c_str(), arr) && arr.size() == VOLUME_ID_SIZE) { memcpy (favorite.VolumeID, &arr[0], VOLUME_ID_SIZE); } @@ -617,11 +632,16 @@ namespace VeraCrypt { /* support old attribute name before it was changed to PIM*/ XmlGetAttributeText (xml, "pin", label, sizeof (label)); } - favorite.Pim = strtol (label, NULL, 10); - if (favorite.Pim < 0 || favorite.Pim > (systemFavorites? MAX_BOOT_PIM_VALUE : MAX_PIM_VALUE)) - favorite.Pim = 0; + if (label[0]) + { + favorite.Pim = strtol (label, NULL, 10); + if (favorite.Pim < 0 || favorite.Pim > (systemFavorites? MAX_BOOT_PIM_VALUE : MAX_PIM_VALUE)) + favorite.Pim = -1; + } + else + favorite.Pim = -1; char boolVal[2]; XmlGetAttributeText (xml, "readonly", boolVal, sizeof (boolVal)); if (boolVal[0]) @@ -671,36 +691,37 @@ namespace VeraCrypt else favorite.DisconnectedDevice = true; } - XmlGetAttributeText (xml, "TrueCryptMode", boolVal, sizeof (boolVal)); - if (boolVal[0]) - favorite.TrueCryptMode = (boolVal[0] == '1')? 1 : 0; - else - favorite.TrueCryptMode = -1; - - if (favorite.TrueCryptMode) - favorite.Pim = 0; - XmlGetAttributeText (xml, "pkcs5", label, sizeof (label)); if (label[0]) favorite.Pkcs5 = strtol (label, NULL, 10); else favorite.Pkcs5 = -1; if ( (favorite.Pkcs5 != -1) && ( (favorite.Pkcs5 < FIRST_PRF_ID) || (favorite.Pkcs5 > LAST_PRF_ID) - || (favorite.TrueCryptMode == 1 && (0 == get_pkcs5_iteration_count (favorite.Pkcs5, 0, TRUE, favorite.SystemEncryption? TRUE : FALSE))) ) ) { favorite.Pkcs5 = -1; } + if (!systemFavorites && favorite.UseVolumeID) + bVolumeIdInUse = true; + favorites.push_back (favorite); xml++; } + if (!systemFavorites) + { + if (bVolumeIdInUse && !DisablePeriodicDeviceListUpdate) + NeedPeriodicDeviceListUpdate = TRUE; + else + NeedPeriodicDeviceListUpdate = FALSE; + } + free (favoritesXml); } @@ -709,9 +730,9 @@ namespace VeraCrypt FillFavoriteVolumesMenu(); FavoritesOnArrivalMountRequired.clear(); - foreach (const FavoriteVolume favorite, FavoriteVolumes) + for (const FavoriteVolume favorite: FavoriteVolumes) { if (favorite.MountOnArrival) { FavoritesOnArrivalMountRequired.push_back (favorite); @@ -719,9 +740,9 @@ namespace VeraCrypt if (IsMountedVolume (favorite.Path.c_str())) { bool present = false; - foreach (const FavoriteVolume favoriteConnected, FavoritesMountedOnArrivalStillConnected) + for (const FavoriteVolume favoriteConnected: FavoritesMountedOnArrivalStillConnected) { if (favorite.Path == favoriteConnected.Path) { present = true; @@ -757,8 +778,9 @@ namespace VeraCrypt bool SaveFavoriteVolumes (HWND hwndDlg, const vector <FavoriteVolume> &favorites, bool systemFavorites) { FILE *f; int cnt = 0; + bool bVolumeIdInUse = false; f = _wfopen (GetConfigPath (systemFavorites ? TC_APPD_FILENAME_SYSTEM_FAVORITE_VOLUMES : TC_APPD_FILENAME_FAVORITE_VOLUMES), L"w,ccs=UTF-8"); if (f == NULL) { @@ -785,19 +807,14 @@ namespace VeraCrypt if (!favorite.Label.empty()) s += L" label=\"" + favorite.Label + L"\""; - if (favorite.Pim > 0) + if (favorite.Pim >= 0) s += L" pim=\"" + IntToWideString(favorite.Pim) + L"\""; if (favorite.Pkcs5 > 0) s += L" pkcs5=\"" + IntToWideString(favorite.Pkcs5) + L"\""; - if (favorite.TrueCryptMode > 0) - s += L" TrueCryptMode=\"1\""; - else if (favorite.TrueCryptMode == 0) - s += L" TrueCryptMode=\"0\""; - if (favorite.ReadOnly) s += L" readonly=\"1\""; if (favorite.Removable) @@ -821,9 +838,13 @@ namespace VeraCrypt if (favorite.UseLabelInExplorer && !favorite.ReadOnly) s += L" useLabelInExplorer=\"1\""; if (favorite.UseVolumeID && !IsRepeatedByteArray (0, favorite.VolumeID, sizeof (favorite.VolumeID))) + { s += L" useVolumeID=\"1\""; + if (!systemFavorites) + bVolumeIdInUse = true; + } s += L">" + wstring (tq) + L"</volume>"; fwprintf (f, L"%ws", s.c_str()); @@ -832,8 +853,16 @@ namespace VeraCrypt fputws (L"\n\t</favorites>", f); XmlWriteFooter (f); + if (!systemFavorites) + { + if (bVolumeIdInUse && !DisablePeriodicDeviceListUpdate) + NeedPeriodicDeviceListUpdate = TRUE; + else + NeedPeriodicDeviceListUpdate = FALSE; + } + if (!CheckFileStreamWriteErrors (hwndDlg, f, systemFavorites ? TC_APPD_FILENAME_SYSTEM_FAVORITE_VOLUMES : TC_APPD_FILENAME_FAVORITE_VOLUMES)) { fclose (f); return false; @@ -905,9 +934,8 @@ namespace VeraCrypt SetCheckBox (hwndDlg, IDC_FAVORITE_MOUNT_ON_ARRIVAL, favorite.MountOnArrival); SetCheckBox (hwndDlg, IDC_FAVORITE_MOUNT_READONLY, favorite.ReadOnly); SetCheckBox (hwndDlg, IDC_FAVORITE_MOUNT_REMOVABLE, favorite.Removable); SetCheckBox (hwndDlg, IDC_FAVORITE_USE_VOLUME_ID, favorite.UseVolumeID && bIsDevice); - SetCheckBox (hwndDlg, IDC_TRUECRYPT_MODE, (favorite.TrueCryptMode > 0)? TRUE : FALSE); /* Populate the PRF algorithms list */ int nIndex, i, nSelected = 0; HWND hComboBox = GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID); @@ -917,15 +945,12 @@ namespace VeraCrypt SendMessage (hComboBox, CB_SETITEMDATA, nIndex, (LPARAM) 0); for (i = FIRST_PRF_ID; i <= LAST_PRF_ID; i++) { - if (!favorite.SystemEncryption || (favorite.TrueCryptMode != 1) || (i == RIPEMD160)) - { - nIndex = (int) SendMessage (hComboBox, CB_ADDSTRING, 0, (LPARAM) get_pkcs5_prf_name(i)); - SendMessage (hComboBox, CB_SETITEMDATA, nIndex, (LPARAM) i); - if (favorite.Pkcs5 == i) - nSelected = nIndex; - } + nIndex = (int) SendMessage (hComboBox, CB_ADDSTRING, 0, (LPARAM) get_pkcs5_prf_name(i)); + SendMessage (hComboBox, CB_SETITEMDATA, nIndex, (LPARAM) i); + if (favorite.Pkcs5 == i) + nSelected = nIndex; } if (favorite.Pkcs5 >= 0) SendMessage (hComboBox, CB_SETCURSEL, nSelected, 0); @@ -957,9 +982,8 @@ namespace VeraCrypt EnableWindow (GetDlgItem (hwndDlg, IDC_FAVORITE_MOVE_DOWN), enable); EnableWindow (GetDlgItem (hwndDlg, IDC_FAVORITE_REMOVE), enable); EnableWindow (GetDlgItem (hwndDlg, IDT_PKCS5_PRF), enable && !favorite.SystemEncryption); EnableWindow (GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID), enable && !favorite.SystemEncryption); - EnableWindow (GetDlgItem (hwndDlg, IDC_TRUECRYPT_MODE), enable && !favorite.SystemEncryption); EnableWindow (GetDlgItem (hwndDlg, IDT_PIM), enable); EnableWindow (GetDlgItem (hwndDlg, IDC_PIM), enable); EnableWindow (GetDlgItem (hwndDlg, IDC_SHOW_PIM), enable); EnableWindow (GetDlgItem (hwndDlg, IDC_PIM_HELP), enable); @@ -1028,34 +1052,16 @@ namespace VeraCrypt } else favorite.Label.clear(); - favorite.Pim = GetPim (hwndDlg, IDC_PIM); + favorite.Pim = GetPim (hwndDlg, IDC_PIM, -1); favorite.UseLabelInExplorer = (IsDlgButtonChecked (hwndDlg, IDC_FAVORITE_USE_LABEL_IN_EXPLORER) != 0); favorite.UseVolumeID = (IsDlgButtonChecked (hwndDlg, IDC_FAVORITE_USE_VOLUME_ID) != 0); int nSelected = (int) SendMessage (GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID), CB_GETCURSEL, 0, 0); if (nSelected != CB_ERR) favorite.Pkcs5 = (int) SendMessage (GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID), CB_GETITEMDATA, nSelected, 0); else favorite.Pkcs5 = -1; - BOOL selectedTrueCryptMode = (IsDlgButtonChecked (hwndDlg, IDC_TRUECRYPT_MODE) != 0)? 1 : 0; - if ((favorite.TrueCryptMode >= 0) || selectedTrueCryptMode) - favorite.TrueCryptMode = selectedTrueCryptMode; - - if (favorite.TrueCryptMode == 1) - { - if ((favorite.Pkcs5 > 0) && !is_pkcs5_prf_supported (favorite.Pkcs5, TRUE, favorite.SystemEncryption? PRF_BOOT_MBR : PRF_BOOT_NO)) - { - Error ("ALGO_NOT_SUPPORTED_FOR_TRUECRYPT_MODE", hwndDlg); - favorite.Pkcs5 = 0; - } - - if (favorite.Pim > 0) - { - Error ("PIM_NOT_SUPPORTED_FOR_TRUECRYPT_MODE", hwndDlg); - favorite.Pim = 0; - } - } favorite.ReadOnly = (IsDlgButtonChecked (hwndDlg, IDC_FAVORITE_MOUNT_READONLY) != 0); favorite.Removable = (IsDlgButtonChecked (hwndDlg, IDC_FAVORITE_MOUNT_REMOVABLE) != 0); diff --git a/src/Mount/Favorites.h b/src/Mount/Favorites.h index 6c75590b..9384cbc8 100644 --- a/src/Mount/Favorites.h +++ b/src/Mount/Favorites.h @@ -3,9 +3,9 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed by the TrueCrypt License 3.0. Modifications and additions to the original source code (contained in this file) - and all other portions of this file are Copyright (c) 2013-2016 IDRIX + and all other portions of this file are Copyright (c) 2013-2017 IDRIX and are governed by the Apache License 2.0 the full text of which is contained in the file License.txt included in VeraCrypt binary and source code distribution packages. */ @@ -22,9 +22,8 @@ namespace VeraCrypt FavoriteVolume() : Pim (0), Pkcs5 (-1), - TrueCryptMode (-1), DisableHotkeyMount (false), DisconnectedDevice (false), MountOnLogOn (false), MountOnArrival (false), @@ -43,9 +42,8 @@ namespace VeraCrypt wstring VolumePathId; wstring Label; int Pim; int Pkcs5; - int TrueCryptMode; BYTE VolumeID[VOLUME_ID_SIZE]; bool DisableHotkeyMount; bool DisconnectedDevice; diff --git a/src/Mount/Hotkeys.c b/src/Mount/Hotkeys.c index 007b2fb4..9af4c628 100644 --- a/src/Mount/Hotkeys.c +++ b/src/Mount/Hotkeys.c @@ -3,9 +3,9 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed by the TrueCrypt License 3.0. Modifications and additions to the original source code (contained in this file) - and all other portions of this file are Copyright (c) 2013-2016 IDRIX + and all other portions of this file are Copyright (c) 2013-2017 IDRIX and are governed by the Apache License 2.0 the full text of which is contained in the file License.txt included in VeraCrypt binary and source code distribution packages. */ diff --git a/src/Mount/Hotkeys.h b/src/Mount/Hotkeys.h index db26af0f..731f9549 100644 --- a/src/Mount/Hotkeys.h +++ b/src/Mount/Hotkeys.h @@ -3,9 +3,9 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed by the TrueCrypt License 3.0. Modifications and additions to the original source code (contained in this file) - and all other portions of this file are Copyright (c) 2013-2016 IDRIX + and all other portions of this file are Copyright (c) 2013-2017 IDRIX and are governed by the Apache License 2.0 the full text of which is contained in the file License.txt included in VeraCrypt binary and source code distribution packages. */ diff --git a/src/Mount/MainCom.cpp b/src/Mount/MainCom.cpp index 6056697c..ce6803ac 100644 --- a/src/Mount/MainCom.cpp +++ b/src/Mount/MainCom.cpp @@ -3,9 +3,9 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed by the TrueCrypt License 3.0. Modifications and additions to the original source code (contained in this file) - and all other portions of this file are Copyright (c) 2013-2016 IDRIX + and all other portions of this file are Copyright (c) 2013-2017 IDRIX and are governed by the Apache License 2.0 the full text of which is contained in the file License.txt included in VeraCrypt binary and source code distribution packages. */ @@ -70,21 +70,21 @@ public: AddRef (); return S_OK; } - virtual void STDMETHODCALLTYPE AnalyzeKernelMiniDump (LONG_PTR hwndDlg) + virtual void STDMETHODCALLTYPE AnalyzeKernelMiniDump (__int64 hwndDlg) { // Do nothing MainDlg = (HWND) hwndDlg; } - virtual int STDMETHODCALLTYPE BackupVolumeHeader (LONG_PTR hwndDlg, BOOL bRequireConfirmation, BSTR lpszVolume) + virtual int STDMETHODCALLTYPE BackupVolumeHeader (__int64 hwndDlg, BOOL bRequireConfirmation, BSTR lpszVolume) { MainDlg = (HWND) hwndDlg; return ::BackupVolumeHeader ((HWND) hwndDlg, bRequireConfirmation, lpszVolume); } - virtual int STDMETHODCALLTYPE RestoreVolumeHeader (LONG_PTR hwndDlg, BSTR lpszVolume) + virtual int STDMETHODCALLTYPE RestoreVolumeHeader (__int64 hwndDlg, BSTR lpszVolume) { MainDlg = (HWND) hwndDlg; return ::RestoreVolumeHeader ((HWND) hwndDlg, lpszVolume); } @@ -93,12 +93,12 @@ public: { return BaseCom::CallDriver (ioctl, input, output); } - virtual int STDMETHODCALLTYPE ChangePassword (BSTR volumePath, Password *oldPassword, Password *newPassword, int pkcs5, int wipePassCount, LONG_PTR hWnd) + virtual int STDMETHODCALLTYPE ChangePassword (BSTR volumePath, Password *oldPassword, Password *newPassword, int pkcs5, int wipePassCount, __int64 hWnd) { MainDlg = (HWND) hWnd; - return ::ChangePwd (volumePath, oldPassword, 0, 0, FALSE, newPassword, pkcs5, 0, wipePassCount, (HWND) hWnd); + return ::ChangePwd (volumePath, oldPassword, 0, 0, newPassword, pkcs5, 0, wipePassCount, (HWND) hWnd); } virtual DWORD STDMETHODCALLTYPE CopyFile (BSTR sourceFile, BSTR destinationFile) { @@ -139,24 +139,24 @@ public: { return BaseCom::WriteLocalMachineRegistryDwordValue (keyPath, valueName, value); } - virtual int STDMETHODCALLTYPE ChangePasswordEx (BSTR volumePath, Password *oldPassword, int old_pkcs5, Password *newPassword, int pkcs5, int wipePassCount, LONG_PTR hWnd) + virtual int STDMETHODCALLTYPE ChangePasswordEx (BSTR volumePath, Password *oldPassword, int old_pkcs5, Password *newPassword, int pkcs5, int wipePassCount, __int64 hWnd) { MainDlg = (HWND) hWnd; - return ::ChangePwd (volumePath, oldPassword, old_pkcs5, 0, FALSE, newPassword, pkcs5, 0, wipePassCount, (HWND) hWnd); + return ::ChangePwd (volumePath, oldPassword, old_pkcs5, 0, newPassword, pkcs5, 0, wipePassCount, (HWND) hWnd); } - virtual int STDMETHODCALLTYPE ChangePasswordEx2 (BSTR volumePath, Password *oldPassword, int old_pkcs5, BOOL truecryptMode, Password *newPassword, int pkcs5, int wipePassCount, LONG_PTR hWnd) + virtual int STDMETHODCALLTYPE ChangePasswordEx2 (BSTR volumePath, Password *oldPassword, int old_pkcs5, Password *newPassword, int pkcs5, int wipePassCount, __int64 hWnd) { MainDlg = (HWND) hWnd; - return ::ChangePwd (volumePath, oldPassword, old_pkcs5, 0, truecryptMode, newPassword, pkcs5, 0, wipePassCount, (HWND) hWnd); + return ::ChangePwd (volumePath, oldPassword, old_pkcs5, 0, newPassword, pkcs5, 0, wipePassCount, (HWND) hWnd); } - virtual int STDMETHODCALLTYPE ChangePasswordEx3 (BSTR volumePath, Password *oldPassword, int old_pkcs5, int old_pim, BOOL truecryptMode, Password *newPassword, int pkcs5, int pim, int wipePassCount, LONG_PTR hWnd) + virtual int STDMETHODCALLTYPE ChangePasswordEx3 (BSTR volumePath, Password *oldPassword, int old_pkcs5, int old_pim, Password *newPassword, int pkcs5, int pim, int wipePassCount, __int64 hWnd) { MainDlg = (HWND) hWnd; - return ::ChangePwd (volumePath, oldPassword, old_pkcs5, old_pim, truecryptMode, newPassword, pkcs5, pim, wipePassCount, (HWND) hWnd); + return ::ChangePwd (volumePath, oldPassword, old_pkcs5, old_pim, newPassword, pkcs5, pim, wipePassCount, (HWND) hWnd); } virtual DWORD STDMETHODCALLTYPE GetFileSize (BSTR filePath, unsigned __int64 *pSize) { @@ -187,18 +187,33 @@ public: { return BaseCom::GetEfiBootDeviceNumber (pSdn); } - virtual DWORD STDMETHODCALLTYPE ReadEfiConfig (BSTR* pContent, DWORD *pcbRead) + virtual DWORD STDMETHODCALLTYPE GetSecureBootConfig (BOOL* pSecureBootEnabled, BOOL *pVeraCryptKeysLoaded) { - return BaseCom::ReadEfiConfig (pContent, pcbRead); + return BaseCom::GetSecureBootConfig (pSecureBootEnabled, pVeraCryptKeysLoaded); } virtual DWORD STDMETHODCALLTYPE WriteEfiBootSectorUserConfig (DWORD userConfig, BSTR customUserMessage, int pim, int hashAlg) { return BaseCom::WriteEfiBootSectorUserConfig (userConfig, customUserMessage,pim, hashAlg); } + virtual DWORD STDMETHODCALLTYPE UpdateSetupConfigFile (BOOL bForInstall) + { + return BaseCom::UpdateSetupConfigFile (bForInstall); + } + + virtual DWORD STDMETHODCALLTYPE NotifyService (DWORD dwNotifyCode) + { + return BaseCom::NotifyService (dwNotifyCode); + } + + virtual DWORD STDMETHODCALLTYPE FastFileResize (BSTR filePath, __int64 fileSize) + { + return BaseCom::FastFileResize (filePath, fileSize); + } + protected: DWORD MessageThreadId; LONG RefCount; }; @@ -259,18 +274,18 @@ extern "C" int UacBackupVolumeHeader (HWND hwndDlg, BOOL bRequireConfirmation, w { CComPtr<ITrueCryptMainCom> tc; int r; - CoInitialize (NULL); + CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE); if (ComGetInstance (hwndDlg, &tc)) { CComBSTR volumeBstr; BSTR bstr = W2BSTR(lpszVolume); if (bstr) { volumeBstr.Attach (bstr); - r = tc->BackupVolumeHeader ((LONG_PTR) hwndDlg, bRequireConfirmation, volumeBstr); + r = tc->BackupVolumeHeader ((__int64) hwndDlg, bRequireConfirmation, volumeBstr); } else r = ERR_OUTOFMEMORY; } @@ -287,18 +302,18 @@ extern "C" int UacRestoreVolumeHeader (HWND hwndDlg, wchar_t *lpszVolume) { CComPtr<ITrueCryptMainCom> tc; int r; - CoInitialize (NULL); + CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE); if (ComGetInstance (hwndDlg, &tc)) { CComBSTR volumeBstr; BSTR bstr = W2BSTR(lpszVolume); if (bstr) { volumeBstr.Attach (bstr); - r = tc->RestoreVolumeHeader ((LONG_PTR) hwndDlg, volumeBstr); + r = tc->RestoreVolumeHeader ((__int64) hwndDlg, volumeBstr); } else r = ERR_OUTOFMEMORY; } @@ -310,20 +325,20 @@ extern "C" int UacRestoreVolumeHeader (HWND hwndDlg, wchar_t *lpszVolume) return r; } -extern "C" int UacChangePwd (wchar_t *lpszVolume, Password *oldPassword, int old_pkcs5, int old_pim, BOOL truecryptMode, Password *newPassword, int pkcs5, int pim, int wipePassCount, HWND hwndDlg) +extern "C" int UacChangePwd (wchar_t *lpszVolume, Password *oldPassword, int old_pkcs5, int old_pim, Password *newPassword, int pkcs5, int pim, int wipePassCount, HWND hwndDlg) { CComPtr<ITrueCryptMainCom> tc; int r; - CoInitialize (NULL); + CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE); if (ComGetInstance (hwndDlg, &tc)) { CComBSTR bstrVolume (lpszVolume); WaitCursor (); - r = tc->ChangePasswordEx3 (bstrVolume, oldPassword, old_pkcs5, old_pim, truecryptMode, newPassword, pkcs5, pim, wipePassCount, (LONG_PTR) hwndDlg); + r = tc->ChangePasswordEx3 (bstrVolume, oldPassword, old_pkcs5, old_pim, newPassword, pkcs5, pim, wipePassCount, (__int64) hwndDlg); NormalCursor (); } else r = -1; diff --git a/src/Mount/MainCom.h b/src/Mount/MainCom.h index 7195e8ea..aeafa549 100644 --- a/src/Mount/MainCom.h +++ b/src/Mount/MainCom.h @@ -3,9 +3,9 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed by the TrueCrypt License 3.0. Modifications and additions to the original source code (contained in this file) - and all other portions of this file are Copyright (c) 2013-2016 IDRIX + and all other portions of this file are Copyright (c) 2013-2017 IDRIX and are governed by the Apache License 2.0 the full text of which is contained in the file License.txt included in VeraCrypt binary and source code distribution packages. */ @@ -25,9 +25,9 @@ extern "C" { BOOL ComServerMain (); int UacBackupVolumeHeader (HWND hwndDlg, BOOL bRequireConfirmation, wchar_t *lpszVolume); int UacRestoreVolumeHeader (HWND hwndDlg, wchar_t *lpszVolume); -int UacChangePwd (wchar_t *lpszVolume, Password *oldPassword, int old_pkcs5, int old_pim, BOOL truecryptMode, Password *newPassword, int pkcs5, int pim, int wipePassCount, HWND hwndDlg); +int UacChangePwd (wchar_t *lpszVolume, Password *oldPassword, int old_pkcs5, int old_pim, Password *newPassword, int pkcs5, int pim, int wipePassCount, HWND hwndDlg); #ifdef __cplusplus } #endif diff --git a/src/Mount/MainCom.idl b/src/Mount/MainCom.idl index 9c3ef372..06c2e48f 100644 --- a/src/Mount/MainCom.idl +++ b/src/Mount/MainCom.idl @@ -3,9 +3,9 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed by the TrueCrypt License 3.0. Modifications and additions to the original source code (contained in this file) - and all other portions of this file are Copyright (c) 2013-2016 IDRIX + and all other portions of this file are Copyright (c) 2013-2017 IDRIX and are governed by the Apache License 2.0 the full text of which is contained in the file License.txt included in VeraCrypt binary and source code distribution packages. */ @@ -15,9 +15,9 @@ import "..\Common\Password.h"; [ uuid(9ACF6176-5FC4-4690-A025-B3306A50EB6A), helpstring("VeraCrypt Main UAC Support Library"), - version(2.8) // Update ComSetup.cpp when changing version number + version(2.13) // Update ComSetup.cpp when changing version number ] library TrueCryptMainCom { [ @@ -27,32 +27,35 @@ library TrueCryptMainCom helpstring("VeraCrypt Main UAC Support Interface") ] interface ITrueCryptMainCom : IUnknown { - void AnalyzeKernelMiniDump (LONG_PTR hwndDlg); - int BackupVolumeHeader (LONG_PTR hwndDlg, BOOL bRequireConfirmation, BSTR lpszVolume); + void AnalyzeKernelMiniDump (__int64 hwndDlg); + int BackupVolumeHeader (__int64 hwndDlg, BOOL bRequireConfirmation, BSTR lpszVolume); DWORD CallDriver (DWORD ioctl, BSTR input, BSTR *output); - int ChangePassword (BSTR volumePath, Password *oldPassword, Password *newPassword, int pkcs5, int wipePassCount, LONG_PTR hWnd); + int ChangePassword (BSTR volumePath, Password *oldPassword, Password *newPassword, int pkcs5, int wipePassCount, __int64 hWnd); DWORD CopyFile (BSTR sourceFile, BSTR destinationFile); DWORD DeleteFile (BSTR file); BOOL IsPagingFileActive (BOOL checkNonWindowsPartitionsOnly); DWORD ReadWriteFile (BOOL write, BOOL device, BSTR filePath, BSTR *bufferBstr, unsigned __int64 offset, unsigned __int32 size, DWORD *sizeDone); DWORD RegisterFilterDriver (BOOL registerDriver, int filterType); DWORD RegisterSystemFavoritesService (BOOL registerService); - int RestoreVolumeHeader (LONG_PTR hwndDlg, BSTR lpszVolume); + int RestoreVolumeHeader (__int64 hwndDlg, BSTR lpszVolume); DWORD SetDriverServiceStartType (DWORD startType); DWORD WriteLocalMachineRegistryDwordValue (BSTR keyPath, BSTR valueName, DWORD value); - int ChangePasswordEx (BSTR volumePath, Password *oldPassword, int old_pkcs5, Password *newPassword, int pkcs5, int wipePassCount, LONG_PTR hWnd); - int ChangePasswordEx2 (BSTR volumePath, Password *oldPassword, int old_pkcs5, BOOL truecryptMode, Password *newPassword, int pkcs5, int wipePassCount, LONG_PTR hWnd); - int ChangePasswordEx3 (BSTR volumePath, Password *oldPassword, int old_pkcs5, int old_pim, BOOL truecryptMode, Password *newPassword, int pkcs5, int pim, int wipePassCount, LONG_PTR hWnd); + int ChangePasswordEx (BSTR volumePath, Password *oldPassword, int old_pkcs5, Password *newPassword, int pkcs5, int wipePassCount, __int64 hWnd); + int ChangePasswordEx2 (BSTR volumePath, Password *oldPassword, int old_pkcs5, Password *newPassword, int pkcs5, int wipePassCount, __int64 hWnd); + int ChangePasswordEx3 (BSTR volumePath, Password *oldPassword, int old_pkcs5, int old_pim, Password *newPassword, int pkcs5, int pim, int wipePassCount, __int64 hWnd); DWORD GetFileSize (BSTR filePath, unsigned __int64* pSize); DWORD DeviceIoControl (BOOL readOnly, BOOL device, BSTR filePath, DWORD dwIoControlCode, BSTR input, BSTR *output); DWORD InstallEfiBootLoader (BOOL preserveUserConfig, BOOL hiddenOSCreation, int pim, int hashAlg); DWORD BackupEfiSystemLoader (); DWORD RestoreEfiSystemLoader (); DWORD GetEfiBootDeviceNumber (BSTR* pSdn); - DWORD ReadEfiConfig (BSTR* pContent, DWORD *pcbRead); DWORD WriteEfiBootSectorUserConfig (DWORD userConfig, BSTR customUserMessage, int pim, int hashAlg); + DWORD UpdateSetupConfigFile (BOOL bForInstall); + DWORD GetSecureBootConfig (BOOL* pSecureBootEnabled, BOOL *pVeraCryptKeysLoaded); + DWORD NotifyService (DWORD dwNotifyCode); + DWORD FastFileResize (BSTR filePath, __int64 fileSize); }; [ uuid(FE8B3B95-C80C-41f7-830F-FBA271C26F7E), diff --git a/src/Mount/Mount.c b/src/Mount/Mount.c index e90a0571..09f43b88 100644 --- a/src/Mount/Mount.c +++ b/src/Mount/Mount.c @@ -5,9 +5,9 @@ governed by the TrueCrypt License 3.0, also from the source code of Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux and which is governed by the 'License Agreement for Encryption for the Masses' Modifications and additions to the original source code (contained in this file) - and all other portions of this file are Copyright (c) 2013-2016 IDRIX + and all other portions of this file are Copyright (c) 2013-2017 IDRIX and are governed by the Apache License 2.0 the full text of which is contained in the file License.txt included in VeraCrypt binary and source code distribution packages. */ @@ -47,22 +47,49 @@ #include "../Common/Resource.h" #include "../Common/SecurityToken.h" #include "../Platform/Finally.h" #include "../Platform/ForEach.h" +#include "../Setup/SelfExtract.h" +#include "../Common/EncryptionThreadPool.h" #include <Strsafe.h> +#include <InitGuid.h> +#include <devguid.h> +#include <devpkey.h> +#include <SetupAPI.h> +#include <Cfgmgr32.h> +#include <intrin.h> +#include <vector> +#include <algorithm> + +#pragma intrinsic(_InterlockedCompareExchange, _InterlockedExchange) + +#import <msxml6.dll> no_auto_exclude #include <wtsapi32.h> typedef BOOL (WINAPI *WTSREGISTERSESSIONNOTIFICATION)(HWND, DWORD); typedef BOOL (WINAPI *WTSUNREGISTERSESSIONNOTIFICATION)(HWND); +#ifndef _HPOWERNOTIFY_DEF_ +#define _HPOWERNOTIFY_DEF_ + +typedef PVOID HPOWERNOTIFY; +typedef HPOWERNOTIFY *PHPOWERNOTIFY; + +#endif + +typedef HPOWERNOTIFY (WINAPI *REGISTERSUSPENDRESUMENOTIFICATION)(HANDLE hRecipient, DWORD Flags); +typedef BOOL (WINAPI *UNREGISTERSUSPENDRESUMENOTIFICATION) (HPOWERNOTIFY Handle); + using namespace VeraCrypt; enum timer_ids { TIMER_ID_MAIN = 0xff, - TIMER_ID_KEYB_LAYOUT_GUARD + TIMER_ID_KEYB_LAYOUT_GUARD, + TIMER_ID_UPDATE_DEVICE_LIST, + TIMER_ID_CHECK_FOREGROUND }; enum hidden_os_read_only_notif_mode { @@ -72,8 +99,10 @@ enum hidden_os_read_only_notif_mode }; #define TIMER_INTERVAL_MAIN 500 #define TIMER_INTERVAL_KEYB_LAYOUT_GUARD 10 +#define TIMER_INTERVAL_UPDATE_DEVICE_LIST 1000 +#define TIMER_INTERVAL_CHECK_FOREGROUND 500 BootEncryption *BootEncObj = NULL; BootEncryptionStatus BootEncStatus; BootEncryptionStatus RecentBootEncStatus; @@ -137,43 +166,50 @@ int VolumePkcs5 = 0; int CmdVolumePkcs5 = 0; int VolumePim = -1; int CmdVolumePim = -1; int DefaultVolumePkcs5 = 0; -BOOL VolumeTrueCryptMode = FALSE; -BOOL CmdVolumeTrueCryptMode = FALSE; -BOOL DefaultVolumeTrueCryptMode = FALSE; BOOL CmdVolumePasswordValid = FALSE; MountOptions CmdMountOptions; BOOL CmdMountOptionsValid = FALSE; MountOptions mountOptions; MountOptions defaultMountOptions; -KeyFile *FirstCmdKeyFile; +KeyFile *FirstCmdKeyFile = NULL; HBITMAP hbmLogoBitmapRescaled = NULL; -wchar_t OrigKeyboardLayout [8+1] = L"00000409"; +wchar_t OrigKeyboardLayout [KL_NAMELENGTH] = L"00000409"; BOOL bKeyboardLayoutChanged = FALSE; /* TRUE if the keyboard layout was changed to the standard US keyboard layout (from any other layout). */ BOOL bKeybLayoutAltKeyWarningShown = FALSE; /* TRUE if the user has been informed that it is not possible to type characters by pressing keys while the right Alt key is held down. */ -static KeyFilesDlgParam hidVolProtKeyFilesParam; +static KeyFilesDlgParam hidVolProtKeyFilesParam = {0}; -static MOUNT_LIST_STRUCT LastKnownMountList; +static MOUNT_LIST_STRUCT LastKnownMountList = {0}; VOLUME_NOTIFICATIONS_LIST VolumeNotificationsList; static DWORD LastKnownLogicalDrives; +static volatile LONG FavoriteMountOnGoing = 0; + static HANDLE TaskBarIconMutex = NULL; static BOOL MainWindowHidden = FALSE; static int pwdChangeDlgMode = PCDM_CHANGE_PASSWORD; static int bSysEncPwdChangeDlgMode = FALSE; static int bPrebootPasswordDlgMode = FALSE; static int NoCmdLineArgs; static BOOL CmdLineVolumeSpecified; static int LastDriveListVolumeColumnWidth; +static BOOL ExitMailSlotSpecified = FALSE; +static TCHAR ExitMailSlotName[MAX_PATH]; // WTS handling static HMODULE hWtsLib = NULL; static WTSREGISTERSESSIONNOTIFICATION fnWtsRegisterSessionNotification = NULL; static WTSUNREGISTERSESSIONNOTIFICATION fnWtsUnRegisterSessionNotification = NULL; -static void RegisterWtsNotification(HWND hWnd) +// Used to opt-in to receive notification about power events. +// This is mandatory to support Windows 10 Modern Standby and Windows 8.1 Connected Standby power model. +// https://docs.microsoft.com/en-us/windows-hardware/design/device-experiences/prepare-software-for-modern-standby +// https://docs.microsoft.com/en-us/windows/win32/w8cookbook/desktop-activity-moderator?redirectedfrom=MSDN +static HPOWERNOTIFY g_hPowerNotify = NULL; + +static void RegisterWtsAndPowerNotification(HWND hWnd) { if (!hWtsLib) { wchar_t dllPath[MAX_PATH]; @@ -198,11 +234,21 @@ static void RegisterWtsNotification(HWND hWnd) hWtsLib = NULL; } } } + + if (IsOSAtLeast (WIN_8)) + { + REGISTERSUSPENDRESUMENOTIFICATION fnRegisterSuspendResumeNotification = (REGISTERSUSPENDRESUMENOTIFICATION) GetProcAddress (GetModuleHandle (L"user32.dll"), "RegisterSuspendResumeNotification"); + if (fnRegisterSuspendResumeNotification) + { + g_hPowerNotify = fnRegisterSuspendResumeNotification ((HANDLE) hWnd, DEVICE_NOTIFY_WINDOW_HANDLE); + } + + } } -static void UnregisterWtsNotification(HWND hWnd) +static void UnregisterWtsAndPowerNotification(HWND hWnd) { if (hWtsLib && fnWtsUnRegisterSessionNotification) { fnWtsUnRegisterSessionNotification(hWnd); @@ -210,10 +256,137 @@ static void UnregisterWtsNotification(HWND hWnd) hWtsLib = NULL; fnWtsRegisterSessionNotification = NULL; fnWtsUnRegisterSessionNotification = NULL; } + + if (IsOSAtLeast (WIN_8) && g_hPowerNotify) + { + UNREGISTERSUSPENDRESUMENOTIFICATION fnUnregisterSuspendResumeNotification = (UNREGISTERSUSPENDRESUMENOTIFICATION) GetProcAddress (GetModuleHandle (L"user32.dll"), "UnregisterSuspendResumeNotification"); + if (fnUnregisterSuspendResumeNotification) + fnUnregisterSuspendResumeNotification (g_hPowerNotify); + g_hPowerNotify = NULL; + } } +static std::vector<MSXML2::IXMLDOMNodePtr> GetReadChildNodes (MSXML2::IXMLDOMNodeListPtr childs) +{ + std::vector<MSXML2::IXMLDOMNodePtr> list; + if (childs && childs->Getlength()) + { + for (long i = 0; i < childs->Getlength(); i++) + { + MSXML2::IXMLDOMNodePtr node = childs->Getitem(i); + if (node) + { + //skip comments + if (node->GetnodeType() == NODE_COMMENT) + continue; + // skip root xml node + if (node->GetbaseName().GetBSTR() && (0 == strcmp ("xml", (const char*) node->GetbaseName()))) + continue; + + list.push_back (node); + } + } + } + + return list; +} + +static bool validateDcsPropXml(const char* xmlData) +{ + bool bValid = false; + HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE); + if(FAILED(hr)) + return false; + else + { + MSXML2::IXMLDOMDocumentPtr pXMLDom; + hr= pXMLDom.CreateInstance(__uuidof(MSXML2::DOMDocument60), NULL, CLSCTX_INPROC_SERVER); + if (SUCCEEDED(hr)) + { + try + { + pXMLDom->async = VARIANT_FALSE; + pXMLDom->validateOnParse = VARIANT_FALSE; + pXMLDom->resolveExternals = VARIANT_FALSE; + + if(pXMLDom->loadXML(xmlData) == VARIANT_TRUE && pXMLDom->hasChildNodes()) + { + MSXML2::IXMLDOMNodePtr veracryptNode, configurationNode, configNode; + std::vector<MSXML2::IXMLDOMNodePtr> nodes = GetReadChildNodes (pXMLDom->GetchildNodes()); + size_t nodesCount = nodes.size(); + if (nodesCount == 1 + && ((veracryptNode = nodes[0])->GetnodeType() == NODE_ELEMENT) + && veracryptNode->GetnodeName().GetBSTR() + && (0 == strcmp ((const char*) veracryptNode->GetnodeName(), "VeraCrypt")) + && veracryptNode->hasChildNodes() + + ) + { + nodes = GetReadChildNodes (veracryptNode->GetchildNodes()); + nodesCount = nodes.size(); + if ((nodesCount == 1) + && ((configurationNode = nodes[0])->GetnodeType() == NODE_ELEMENT) + && configurationNode->GetnodeName().GetBSTR() + && (0 == strcmp ((const char*) configurationNode->GetnodeName(), "configuration")) + && (configurationNode->hasChildNodes()) + ) + { + nodes = GetReadChildNodes (configurationNode->GetchildNodes()); + nodesCount = nodes.size(); + + if (nodesCount > 1) + { + bValid = true; + for (size_t i = 0; bValid && (i < nodesCount); i++) + { + configNode = nodes[i]; + if (configNode->GetnodeType() == NODE_COMMENT) + continue; + else if ( (configNode->GetnodeType() == NODE_ELEMENT) + && (configNode->GetnodeName().GetBSTR()) + && (0 == strcmp ((const char*) configNode->GetnodeName(), "config")) + ) + { + nodes = GetReadChildNodes (configNode->GetchildNodes()); + nodesCount = nodes.size(); + if ((nodesCount == 0 || (nodesCount == 1 && nodes[0]->GetnodeType() == NODE_TEXT)) + && configNode->Getattributes() + && (configNode->Getattributes()->Getlength() == 1) + && (configNode->Getattributes()->Getitem(0)) + ) + { + std::string val; + bstr_t bstr = configNode->Getattributes()->Getitem(0)->GetnodeName (); + if (bstr.GetBSTR()) + val = (const char*) bstr; + if (val != "key") + bValid = false; + } + else + bValid = false; + } + else + bValid = false; + } + } + } + } + } + } + catch(_com_error errorObject) + { + bValid = false; + } + } + } + + CoUninitialize(); + return bValid; +} + + static void localcleanup (void) { // Wipe command line char *c = GetCommandLineA (); @@ -235,14 +408,15 @@ static void localcleanup (void) burn (&VolumePkcs5, sizeof (VolumePkcs5)); burn (&CmdVolumePkcs5, sizeof (CmdVolumePkcs5)); burn (&VolumePim, sizeof (VolumePim)); burn (&CmdVolumePim, sizeof (CmdVolumePim)); - burn (&VolumeTrueCryptMode, sizeof (VolumeTrueCryptMode)); - burn (&CmdVolumeTrueCryptMode, sizeof (CmdVolumeTrueCryptMode)); burn (&mountOptions, sizeof (mountOptions)); burn (&defaultMountOptions, sizeof (defaultMountOptions)); burn (szFileName, sizeof(szFileName)); + KeyFileRemoveAll (&FirstCmdKeyFile); + KeyFileRemoveAll (&hidVolProtKeyFilesParam.FirstKeyFile); + /* Cleanup common code resources */ cleanup (); if (BootEncObj != NULL) @@ -253,15 +427,73 @@ static void localcleanup (void) RandStop (TRUE); } +#ifndef BS_SPLITBUTTON +#define BS_SPLITBUTTON 0x0000000C +#endif + +#ifndef BCN_DROPDOWN +#define BCN_DROPDOWN (0U-1250U) + 2U +#endif + +static void EnableSplitButton(HWND hwndDlg, int buttonId) +{ + HWND hwndButton = GetDlgItem(hwndDlg, buttonId); + if (hwndButton != NULL) + { + // change the button style + SetWindowLongPtr(hwndButton, GWL_STYLE, GetWindowLongPtr(hwndButton, GWL_STYLE) | BS_SPLITBUTTON); + } +} + +static void DisableSplitButton(HWND hwndDlg, int buttonId) +{ + HWND hwndButton = GetDlgItem(hwndDlg, buttonId); + if (hwndButton != NULL) + { + // change the button style + SetWindowLongPtr(hwndButton, GWL_STYLE, GetWindowLongPtr(hwndButton, GWL_STYLE) & ~BS_SPLITBUTTON); + } +} + +static HMENU CreateMountNoCacheDropdownMenu() +{ + HMENU hmenu = CreatePopupMenu(); + + // add menu items + AppendMenu(hmenu, MF_STRING, IDM_MOUNIT_NO_CACHE, GetString("IDM_MOUNT_NO_CACHE")); + + return hmenu; +} + +static void HandleMountButtonDropdown(HWND hwndButton, HWND hwndOwner, HMENU hmenu) +{ + RECT rc; + POINT pt; + + if (GetClientRect(hwndButton, &rc)) + { + pt.x = rc.left; + pt.y = rc.bottom; + ClientToScreen(hwndButton, &pt); + + TrackPopupMenu(hmenu, TPM_LEFTALIGN | TPM_TOPALIGN, pt.x, pt.y, 0, hwndOwner, NULL); + } +} + void RefreshMainDlg (HWND hwndDlg) { - int drive = (wchar_t) (HIWORD (GetSelectedLong (GetDlgItem (hwndDlg, IDC_DRIVELIST)))); + if (Silent) + LoadDriveLetters (hwndDlg, NULL, 0); + else + { + int drive = (wchar_t) (HIWORD (GetSelectedLong (GetDlgItem (hwndDlg, IDC_DRIVELIST)))); - MoveEditToCombo (GetDlgItem (hwndDlg, IDC_VOLUME), bHistory); - LoadDriveLetters (hwndDlg, GetDlgItem (hwndDlg, IDC_DRIVELIST), drive); - EnableDisableButtons (hwndDlg); + MoveEditToCombo (GetDlgItem (hwndDlg, IDC_VOLUME), bHistory); + LoadDriveLetters (hwndDlg, GetDlgItem (hwndDlg, IDC_DRIVELIST), drive); + EnableDisableButtons (hwndDlg); + } } void EndMainDlg (HWND hwndDlg) { @@ -289,10 +521,11 @@ void EndMainDlg (HWND hwndDlg) } else { KillTimer (hwndDlg, TIMER_ID_MAIN); + KillTimer (hwndDlg, TIMER_ID_UPDATE_DEVICE_LIST); TaskBarIconRemove (hwndDlg); - UnregisterWtsNotification(hwndDlg); + UnregisterWtsAndPowerNotification(hwndDlg); EndDialog (hwndDlg, 0); } } @@ -302,65 +535,68 @@ static void InitMainDialog (HWND hwndDlg) char *popupTexts[] = {"MENU_VOLUMES", "MENU_SYSTEM_ENCRYPTION", "MENU_FAVORITES", "MENU_TOOLS", "MENU_SETTINGS", "MENU_HELP", "MENU_WEBSITE", 0}; wchar_t *str; int i; - /* Call the common dialog init code */ - InitDialog (hwndDlg); - LocalizeDialog (hwndDlg, NULL); + if (!Silent) + { + /* Call the common dialog init code */ + InitDialog (hwndDlg); + LocalizeDialog (hwndDlg, NULL); - SetWindowLongPtrW (hwndDlg, DWLP_USER, (LONG_PTR) (IsAdmin() ? TC_MAIN_WINDOW_FLAG_ADMIN_PRIVILEGES : 0)); + SetWindowLongPtrW (hwndDlg, DWLP_USER, (LONG_PTR) (IsAdmin() ? TC_MAIN_WINDOW_FLAG_ADMIN_PRIVILEGES : 0)); - DragAcceptFiles (hwndDlg, TRUE); + DragAcceptFiles (hwndDlg, TRUE); - SendMessageW (GetDlgItem (hwndDlg, IDC_VOLUME), CB_LIMITTEXT, TC_MAX_PATH, 0); - SetWindowTextW (hwndDlg, (IsAdmin() && !IsBuiltInAdmin() && IsUacSupported() && !IsNonInstallMode()) ? (wstring (lpszTitle) + L" [" + GetString ("ADMINISTRATOR") + L"]").c_str() : lpszTitle); + SendMessageW (GetDlgItem (hwndDlg, IDC_VOLUME), CB_LIMITTEXT, TC_MAX_PATH, 0); + SetWindowTextW (hwndDlg, (IsAdmin() && !IsBuiltInAdmin() && IsUacSupported() && !IsNonInstallMode()) ? (wstring (lpszTitle) + L" [" + GetString ("ADMINISTRATOR") + L"]").c_str() : lpszTitle); - // Help file name - InitHelpFileName(); + // Help file name + InitHelpFileName(); - // Localize menu strings - for (i = 40001; str = (wchar_t *)GetDictionaryValueByInt (i); i++) - { - info.cbSize = sizeof (info); - info.fMask = MIIM_TYPE; - info.fType = MFT_STRING; - info.dwTypeData = str; - info.cch = (UINT) wcslen (str); + // Localize menu strings + for (i = 40001; str = (wchar_t *)GetDictionaryValueByInt (i); i++) + { + info.cbSize = sizeof (info); + info.fMask = MIIM_TYPE; + info.fType = MFT_STRING; + info.dwTypeData = str; + info.cch = (UINT) wcslen (str); - SetMenuItemInfoW (GetMenu (hwndDlg), i, FALSE, &info); - } + SetMenuItemInfoW (GetMenu (hwndDlg), i, FALSE, &info); + } - for (i = 0; popupTexts[i] != 0; i++) - { - str = GetString (popupTexts[i]); + for (i = 0; popupTexts[i] != 0; i++) + { + str = GetString (popupTexts[i]); - info.cbSize = sizeof (info); - info.fMask = MIIM_TYPE; + info.cbSize = sizeof (info); + info.fMask = MIIM_TYPE; - if (strcmp (popupTexts[i], "MENU_WEBSITE") == 0) - info.fType = MFT_STRING | MFT_RIGHTJUSTIFY; - else - info.fType = MFT_STRING; + if (strcmp (popupTexts[i], "MENU_WEBSITE") == 0) + info.fType = MFT_STRING | MFT_RIGHTJUSTIFY; + else + info.fType = MFT_STRING; - if (strcmp (popupTexts[i], "MENU_FAVORITES") == 0) - FavoriteVolumesMenu = GetSubMenu (GetMenu (hwndDlg), i); + if (strcmp (popupTexts[i], "MENU_FAVORITES") == 0) + FavoriteVolumesMenu = GetSubMenu (GetMenu (hwndDlg), i); - info.dwTypeData = str; - info.cch = (UINT) wcslen (str); + info.dwTypeData = str; + info.cch = (UINT) wcslen (str); - SetMenuItemInfoW (GetMenu (hwndDlg), i, TRUE, &info); - } + SetMenuItemInfoW (GetMenu (hwndDlg), i, TRUE, &info); + } - { - // disable hidden OS creation for GPT system encryption - if (bSystemIsGPT) { - EnableMenuItem (GetMenu (hwndDlg), IDM_CREATE_HIDDEN_OS, MF_GRAYED); + // disable hidden OS creation for GPT system encryption + if (bSystemIsGPT) + { + EnableMenuItem (GetMenu (hwndDlg), IDM_CREATE_HIDDEN_OS, MF_GRAYED); + } } - } - // Disable menu item for changing system header key derivation algorithm until it's implemented - EnableMenuItem (GetMenu (hwndDlg), IDM_CHANGE_SYS_HEADER_KEY_DERIV_ALGO, MF_GRAYED); + // Disable menu item for changing system header key derivation algorithm until it's implemented + EnableMenuItem (GetMenu (hwndDlg), IDM_CHANGE_SYS_HEADER_KEY_DERIV_ALGO, MF_GRAYED); + } try { LoadFavoriteVolumes(); @@ -369,33 +605,59 @@ static void InitMainDialog (HWND hwndDlg) { e.Show (NULL); } - // Resize the logo bitmap if the user has a non-default DPI - if (ScreenDPI != USER_DEFAULT_SCREEN_DPI - && hbmLogoBitmapRescaled == NULL) // If not re-called (e.g. after language pack change) + if (NeedPeriodicDeviceListUpdate) { - hbmLogoBitmapRescaled = RenderBitmap (MAKEINTRESOURCE (IDB_LOGO_288DPI), - GetDlgItem (hwndDlg, IDC_LOGO), - 0, 0, 0, 0, FALSE, TRUE); + // initialize the list of devices available for mounting as early as possible + UpdateMountableHostDeviceList (); } - BuildTree (hwndDlg, GetDlgItem (hwndDlg, IDC_DRIVELIST)); - - if (*szDriveLetter != 0) - { - SelectItem (GetDlgItem (hwndDlg, IDC_DRIVELIST), *szDriveLetter); - - if(nSelectedDriveIndex > SendMessage (GetDlgItem (hwndDlg, IDC_DRIVELIST), LVM_GETITEMCOUNT, 0, 0)/2) - SendMessage(GetDlgItem (hwndDlg, IDC_DRIVELIST), LVM_SCROLL, 0, 10000); - } + if (Silent) + LoadDriveLetters (hwndDlg, NULL, 0); else { - SendMessage(hwndDlg, WM_NEXTDLGCTL, (WPARAM) GetDlgItem (hwndDlg, IDC_DRIVELIST), 1L); - } + // Resize the logo bitmap if the user has a non-default DPI + if (ScreenDPI != USER_DEFAULT_SCREEN_DPI + && hbmLogoBitmapRescaled == NULL) // If not re-called (e.g. after language pack change) + { + hbmLogoBitmapRescaled = RenderBitmap (MAKEINTRESOURCE (IDB_LOGO_288DPI), + GetDlgItem (hwndDlg, IDC_LOGO), + 0, 0, 0, 0, FALSE, TRUE); + } - SendMessage (GetDlgItem (hwndDlg, IDC_NO_HISTORY), BM_SETCHECK, bHistory ? BST_UNCHECKED : BST_CHECKED, 0); - EnableDisableButtons (hwndDlg); + BuildTree (hwndDlg, GetDlgItem (hwndDlg, IDC_DRIVELIST)); + + if (*szDriveLetter != 0) + { + SelectItem (GetDlgItem (hwndDlg, IDC_DRIVELIST), *szDriveLetter); + + if(nSelectedDriveIndex > SendMessage (GetDlgItem (hwndDlg, IDC_DRIVELIST), LVM_GETITEMCOUNT, 0, 0)/2) + SendMessage(GetDlgItem (hwndDlg, IDC_DRIVELIST), LVM_SCROLL, 0, 10000); + } + else + { + SendMessage(hwndDlg, WM_NEXTDLGCTL, (WPARAM) GetDlgItem (hwndDlg, IDC_DRIVELIST), 1L); + } + + SendMessage (GetDlgItem (hwndDlg, IDC_NO_HISTORY), BM_SETCHECK, bHistory ? BST_UNCHECKED : BST_CHECKED, 0); + EnableDisableButtons (hwndDlg); + + // Ensure bottom buttons are visible if the user sets a large font size + RECT mainRectScreen, boxRectScreen; + ULONG mainHeigth, mainWidth, correctHeigth; + GetWindowRect (hwndDlg, &mainRectScreen); + GetWindowRect (GetDlgItem (hwndDlg, IDC_LOWER_BOX), &boxRectScreen); + + mainHeigth = mainRectScreen.bottom - mainRectScreen.top; + mainWidth = mainRectScreen.right - mainRectScreen.left; + correctHeigth = boxRectScreen.bottom - mainRectScreen.top + CompensateYDPI (5); + + if (mainHeigth < correctHeigth) + { + SetWindowPos (hwndDlg, NULL, 0, 0, mainWidth, correctHeigth , SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE); + } + } } void EnableDisableButtons (HWND hwndDlg) { @@ -415,9 +677,12 @@ void EnableDisableButtons (HWND hwndDlg) { case TC_MLIST_ITEM_NONSYS_VOL: { SetWindowTextW (hOKButton, GetString ("UNMOUNT_BUTTON")); + DisableSplitButton(hwndDlg, IDOK); EnableWindow (hOKButton, TRUE); + // Invalid the button IDOK so that it will be redrawn + InvalidateRect (hOKButton, NULL, TRUE); EnableMenuItem (GetMenu (hwndDlg), IDM_UNMOUNT_VOLUME, MF_ENABLED); EnableWindow (GetDlgItem (hwndDlg, IDC_VOLUME_PROPERTIES), TRUE); EnableMenuItem (GetMenu (hwndDlg), IDM_VOLUME_PROPERTIES, MF_ENABLED); @@ -425,17 +690,25 @@ void EnableDisableButtons (HWND hwndDlg) break; case TC_MLIST_ITEM_SYS_PARTITION: case TC_MLIST_ITEM_SYS_DRIVE: + EnableSplitButton(hwndDlg, IDOK); EnableWindow (hOKButton, FALSE); SetWindowTextW (hOKButton, GetString ("MOUNT_BUTTON")); + // Invalid the button IDOK so that it will be redrawn + InvalidateRect (hOKButton, NULL, TRUE); EnableWindow (GetDlgItem (hwndDlg, IDC_VOLUME_PROPERTIES), TRUE); EnableMenuItem (GetMenu (hwndDlg), IDM_UNMOUNT_VOLUME, MF_GRAYED); break; case TC_MLIST_ITEM_FREE: default: +#if !defined(VCEXPANDER) + EnableSplitButton(hwndDlg, IDOK); +#endif SetWindowTextW (hOKButton, GetString ("MOUNT_BUTTON")); + // Invalid the button IDOK so that it will be redrawn + InvalidateRect (hOKButton, NULL, TRUE); EnableWindow (GetDlgItem (hwndDlg, IDC_VOLUME_PROPERTIES), FALSE); EnableMenuItem (GetMenu (hwndDlg), IDM_VOLUME_PROPERTIES, MF_GRAYED); EnableMenuItem (GetMenu (hwndDlg), IDM_UNMOUNT_VOLUME, MF_GRAYED); } @@ -659,9 +932,12 @@ static wstring ResolveAmbiguousSelection (HWND hwndDlg, int *driveNoPtr) void LoadSettingsAndCheckModified (HWND hwndDlg, BOOL bOnlyCheckModified, BOOL* pbSettingsModified, BOOL* pbHistoryModified) { char langid[6] = {0}; if (!bOnlyCheckModified) + { EnableHwEncryption ((ReadDriverConfigurationFlags() & TC_DRIVER_CONFIG_DISABLE_HARDWARE_ENCRYPTION) ? FALSE : TRUE); + EnableCpuRng ((ReadDriverConfigurationFlags() & VC_DRIVER_CONFIG_ENABLE_CPU_RNG) ? TRUE : FALSE); + } WipeAlgorithmId savedWipeAlgorithm = TC_WIPE_NONE; if (!bOnlyCheckModified) @@ -722,8 +998,10 @@ void LoadSettingsAndCheckModified (HWND hwndDlg, BOOL bOnlyCheckModified, BOOL* ConfigReadCompareInt ("HideWaitingDialog", FALSE, &bHideWaitingDialog, bOnlyCheckModified, pbSettingsModified); ConfigReadCompareInt ("UseSecureDesktop", FALSE, &bUseSecureDesktop, bOnlyCheckModified, pbSettingsModified); + ConfigReadCompareInt ("UseLegacyMaxPasswordLength", FALSE, &bUseLegacyMaxPasswordLength, bOnlyCheckModified, pbSettingsModified); + ConfigReadCompareInt ("MountVolumesRemovable", FALSE, &defaultMountOptions.Removable, bOnlyCheckModified, pbSettingsModified); ConfigReadCompareInt ("MountVolumesReadOnly", FALSE, &defaultMountOptions.ReadOnly, bOnlyCheckModified, pbSettingsModified); if (!bOnlyCheckModified) @@ -733,13 +1011,15 @@ void LoadSettingsAndCheckModified (HWND hwndDlg, BOOL bOnlyCheckModified, BOOL* defaultMountOptions.ProtectedHidVolPim = 0; defaultMountOptions.PartitionInInactiveSysEncScope = FALSE; defaultMountOptions.RecoveryMode = FALSE; defaultMountOptions.UseBackupHeader = FALSE; + defaultMountOptions.SkipCachedPasswords = FALSE; mountOptions = defaultMountOptions; } ConfigReadCompareInt ("CloseSecurityTokenSessionsAfterMount", 0, &CloseSecurityTokenSessionsAfterMount, bOnlyCheckModified, pbSettingsModified); + ConfigReadCompareInt ("EMVSupportEnabled", 0, &EMVSupportEnabled, bOnlyCheckModified, pbSettingsModified); if (IsHiddenOSRunning()) ConfigReadCompareInt ("HiddenSystemLeakProtNotifStatus", TC_HIDDEN_OS_READ_ONLY_NOTIF_MODE_NONE, &HiddenSysLeakProtectionNotificationStatus, bOnlyCheckModified, pbSettingsModified); @@ -804,9 +1084,8 @@ void LoadSettingsAndCheckModified (HWND hwndDlg, BOOL bOnlyCheckModified, BOOL* } // Mount Options ConfigReadCompareInt ("DefaultPRF", 0, &DefaultVolumePkcs5, bOnlyCheckModified, pbSettingsModified); - ConfigReadCompareInt ("DefaultTrueCryptMode", FALSE, &DefaultVolumeTrueCryptMode, bOnlyCheckModified, pbSettingsModified); if (bOnlyCheckModified) { if (!IsNonInstallMode ()) @@ -828,10 +1107,8 @@ void LoadSettingsAndCheckModified (HWND hwndDlg, BOOL bOnlyCheckModified, BOOL* } if (DefaultVolumePkcs5 < 0 || DefaultVolumePkcs5 > LAST_PRF_ID) DefaultVolumePkcs5 = 0; - if (DefaultVolumeTrueCryptMode != TRUE && DefaultVolumeTrueCryptMode != FALSE) - DefaultVolumeTrueCryptMode = FALSE; } void LoadSettings ( HWND hwndDlg ) @@ -880,8 +1157,9 @@ void SaveSettings (HWND hwndDlg) ConfigWriteInt ("PreserveTimestamps", defaultMountOptions.PreserveTimestamp); ConfigWriteInt ("ShowDisconnectedNetworkDrives",bShowDisconnectedNetworkDrives); ConfigWriteInt ("HideWaitingDialog", bHideWaitingDialog); ConfigWriteInt ("UseSecureDesktop", bUseSecureDesktop); + ConfigWriteInt ("UseLegacyMaxPasswordLength", bUseLegacyMaxPasswordLength); ConfigWriteInt ("EnableBackgroundTask", bEnableBkgTask); ConfigWriteInt ("CloseBackgroundTaskOnNoVolumes", bCloseBkgTaskWhenNoVolumes); @@ -909,8 +1187,9 @@ void SaveSettings (HWND hwndDlg) ConfigWriteString ("LastSelectedDrive", szTmp); } ConfigWriteInt ("CloseSecurityTokenSessionsAfterMount", CloseSecurityTokenSessionsAfterMount); + ConfigWriteInt ("EMVSupportEnabled", EMVSupportEnabled); // Hotkeys ConfigWriteInt ("HotkeyModAutoMountDevices", Hotkeys[HK_AUTOMOUNT_DEVICES].vKeyModifiers); ConfigWriteInt ("HotkeyCodeAutoMountDevices", Hotkeys[HK_AUTOMOUNT_DEVICES].vKeyCode); @@ -940,9 +1219,8 @@ void SaveSettings (HWND hwndDlg) ConfigWriteStringW ("SecurityTokenLibrary", SecurityTokenLibraryPath[0] ? SecurityTokenLibraryPath : L""); // Mount Options ConfigWriteInt ("DefaultPRF", DefaultVolumePkcs5); - ConfigWriteInt ("DefaultTrueCryptMode", DefaultVolumeTrueCryptMode); ConfigWriteEnd (hwndDlg); } @@ -982,8 +1260,22 @@ static BOOL SysEncryptionOrDecryptionRequired (void) ) ); } +// Returns TRUE if system encryption master key is vulnerable +static BOOL SysEncryptionMasterKeyVulnerable (void) +{ + try + { + BootEncStatus = BootEncObj->GetStatus(); + return (BootEncStatus.DriveMounted || BootEncStatus.DriveEncrypted) && BootEncStatus.MasterKeyVulnerable; + } + catch (Exception &) + { + return FALSE; + } +} + // Returns TRUE if the system partition/drive is completely encrypted static BOOL SysDriveOrPartitionFullyEncrypted (BOOL bSilent) { /* If you update this function, revise SysDriveOrPartitionFullyEncrypted() in Tcformat.c as well. */ @@ -1364,8 +1656,12 @@ static void LaunchVolCreationWizard (HWND hwndDlg, const wchar_t *arg, BOOL bEle StringCbCatW (t, sizeof(t), formatExeName); if (!FileExists(t)) Error ("VOL_CREATION_WIZARD_NOT_FOUND", hwndDlg); // Display a user-friendly error message and advise what to do + else if (!VerifyModuleSignature (t)) + { + Error ("DIST_PACKAGE_CORRUPTED", hwndDlg); + } else { if (bElevation && !IsAdmin() && IsUacSupported()) @@ -1423,9 +1719,9 @@ static void LaunchVolExpander (HWND hwndDlg) StringCbCatW (t, sizeof(t), expanderExeName); if (!FileExists(t)) Error ("VOL_EXPANDER_NOT_FOUND", hwndDlg); // Display a user-friendly error message and advise what to do - else if (((int)ShellExecuteW (NULL, (!IsAdmin() && IsUacSupported()) ? L"runas" : L"open", t, NULL, NULL, SW_SHOW)) <= 32) + else if (((INT_PTR)ShellExecuteW (NULL, (!IsAdmin() && IsUacSupported()) ? L"runas" : L"open", t, NULL, NULL, SW_SHOW)) <= 32) { handleWin32Error (hwndDlg, SRC_POS); } } @@ -1436,9 +1732,9 @@ static void LaunchVolExpander (HWND hwndDlg) // drive>0 = update only the corresponding drive subitems void LoadDriveLetters (HWND hwndDlg, HWND hTree, int drive) { // Remember the top-most visible item - int lastTopMostVisibleItem = ListView_GetTopIndex (hTree); + int lastTopMostVisibleItem = (!Silent && hTree)? ListView_GetTopIndex (hTree) : 0; wchar_t *szDriveLetters[]= {L"A:", L"B:", L"C:", L"D:", L"E:", L"F:", L"G:", L"H:", L"I:", L"J:", L"K:", @@ -1478,19 +1774,23 @@ void LoadDriveLetters (HWND hwndDlg, HWND hTree, int drive) sizeof (driver), &driver, sizeof (driver), &dwResult, NULL); memcpy (&LastKnownMountList, &driver, sizeof (driver)); - if (bResult == FALSE) + if ((bResult == FALSE) || (driver.ulMountedDrives >= (1 << 26))) { KillTimer (MainDlg, TIMER_ID_MAIN); + KillTimer (hwndDlg, TIMER_ID_UPDATE_DEVICE_LIST); handleWin32Error (hTree, SRC_POS); AbortProcessSilent(); } LastKnownLogicalDrives = dwUsedDrives = GetUsedLogicalDrives (); if (dwUsedDrives == 0) Warning ("DRIVELETTERS", hwndDlg); + if (Silent) + return; + if(drive == 0) ListView_DeleteAllItems(hTree); if (bSysEnc) @@ -1582,9 +1882,9 @@ void LoadDriveLetters (HWND hwndDlg, HWND hTree, int drive) ListSubItemSet (hTree, listItem.iItem, 2, szTmpW); if (propSysEnc.ea >= EAGetFirst() && propSysEnc.ea <= EAGetCount()) { - EAGetName (szTmp, propSysEnc.ea, 1); + EAGetName (szTmp, ARRAYSIZE(szTmp),propSysEnc.ea, 1); } else { szTmp[0] = L'?'; @@ -1614,9 +1914,9 @@ void LoadDriveLetters (HWND hwndDlg, HWND hTree, int drive) if (ListView_GetItem (hTree, &tmp)) curDrive = HIWORD(tmp.lParam); } - if (driver.ulMountedDrives & (1 << i) + if (((driver.ulMountedDrives & (1 << i)) && (IsNullTerminateString (driver.wszVolume[i], TC_MAX_PATH))) || bSysEncPartition) { wchar_t szTmp[1024]; wchar_t szTmpW[1024]; @@ -1708,9 +2008,9 @@ void LoadDriveLetters (HWND hwndDlg, HWND hTree, int drive) GetSizeString (bSysEncPartition ? GetSysEncDeviceSize(TRUE) : driver.diskLength[i], szTmpW, sizeof(szTmpW)); ListSubItemSet (hTree, listItem.iItem, 2, szTmpW); - EAGetName (szTmp, bSysEncPartition ? propSysEnc.ea : driver.ea[i], 1); + EAGetName (szTmp, ARRAYSIZE(szTmp),bSysEncPartition ? propSysEnc.ea : driver.ea[i], 1); listItem.iSubItem = 3; ListView_SetItem (hTree, &listItem); if (bSysEncPartition) @@ -1738,26 +2038,20 @@ void LoadDriveLetters (HWND hwndDlg, HWND hTree, int drive) default: ws = L"?"; } - if (driver.truecryptMode[i]) - { - StringCbPrintfW (szTmpW, sizeof(szTmpW), L"TrueCrypt-%s", ws); - ListSubItemSet (hTree, listItem.iItem, 4, szTmpW); - } - else - ListSubItemSet (hTree, listItem.iItem, 4, ws); + ListSubItemSet (hTree, listItem.iItem, 4, ws); if (driver.volumeType[i] == PROP_VOL_TYPE_OUTER_VOL_WRITE_PREVENTED) // Normal/outer volume (hidden volume protected AND write denied) { if (!VolumeNotificationsList.bHidVolDamagePrevReported[i]) { - wchar_t szTmp[4096]; + wchar_t szMsgTmp[4096]; VolumeNotificationsList.bHidVolDamagePrevReported[i] = TRUE; - StringCbPrintfW (szTmp, sizeof(szTmp), GetString ("DAMAGE_TO_HIDDEN_VOLUME_PREVENTED"), i+L'A'); + StringCbPrintfW (szMsgTmp, sizeof(szMsgTmp), GetString ("DAMAGE_TO_HIDDEN_VOLUME_PREVENTED"), i+L'A'); SetForegroundWindow (GetParent(hTree)); - MessageBoxW (GetParent(hTree), szTmp, lpszTitle, MB_ICONWARNING | MB_SETFOREGROUND | MB_TOPMOST); + MessageBoxW (GetParent(hTree), szMsgTmp, lpszTitle, MB_ICONWARNING | MB_SETFOREGROUND | MB_TOPMOST); } } else { @@ -1871,9 +2165,8 @@ typedef struct Password *newPassword; int pkcs5; int pim; int wipePassCount; - BOOL truecryptMode; int* pnStatus; } ChangePwdThreadParam; void CALLBACK ChangePwdWaitThreadProc(void* pArg, HWND hwndDlg) @@ -1908,16 +2201,16 @@ void CALLBACK ChangePwdWaitThreadProc(void* pArg, HWND hwndDlg) else { // Non-system - *pThreadParam->pnStatus = ChangePwd (szFileName, pThreadParam->oldPassword, pThreadParam->old_pkcs5, pThreadParam->old_pim, pThreadParam->truecryptMode, pThreadParam->newPassword, pThreadParam->pkcs5, pThreadParam->pim, pThreadParam->wipePassCount, hwndDlg); + *pThreadParam->pnStatus = ChangePwd (szFileName, pThreadParam->oldPassword, pThreadParam->old_pkcs5, pThreadParam->old_pim, pThreadParam->newPassword, pThreadParam->pkcs5, pThreadParam->pim, pThreadParam->wipePassCount, hwndDlg); if (*pThreadParam->pnStatus == ERR_OS_ERROR && GetLastError () == ERROR_ACCESS_DENIED && IsUacSupported () && IsVolumeDeviceHosted (szFileName)) { - *pThreadParam->pnStatus = UacChangePwd (szFileName, pThreadParam->oldPassword, pThreadParam->old_pkcs5, pThreadParam->old_pim, pThreadParam->truecryptMode, pThreadParam->newPassword, pThreadParam->pkcs5, pThreadParam->pim, pThreadParam->wipePassCount, hwndDlg); + *pThreadParam->pnStatus = UacChangePwd (szFileName, pThreadParam->oldPassword, pThreadParam->old_pkcs5, pThreadParam->old_pim, pThreadParam->newPassword, pThreadParam->pkcs5, pThreadParam->pim, pThreadParam->wipePassCount, hwndDlg); } } } @@ -1990,18 +2283,15 @@ BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPAR HWND hComboBox = GetDlgItem (hwndDlg, IDC_PKCS5_OLD_PRF_ID); int i; WipeAlgorithmId headerWipeMode = TC_WIPE_3_DOD_5220; int EffectiveVolumePkcs5 = CmdVolumePkcs5; - BOOL EffectiveVolumeTrueCryptMode = CmdVolumeTrueCryptMode; int EffectiveVolumePim = CmdVolumePim; /* Priority is given to command line parameters * Default values used only when nothing specified in command line */ if (EffectiveVolumePkcs5 == 0) EffectiveVolumePkcs5 = DefaultVolumePkcs5; - if (!EffectiveVolumeTrueCryptMode) - EffectiveVolumeTrueCryptMode = DefaultVolumeTrueCryptMode; NewPimValuePtr = (int*) lParam; PimValueChangedWarning = FALSE; @@ -2017,11 +2307,11 @@ BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPAR SetWindowTextW (hwndDlg, GetString ("IDD_PASSWORDCHANGE_DLG")); LocalizeDialog (hwndDlg, "IDD_PASSWORDCHANGE_DLG"); - SendMessage (GetDlgItem (hwndDlg, IDC_OLD_PASSWORD), EM_LIMITTEXT, MAX_PASSWORD, 0); - SendMessage (GetDlgItem (hwndDlg, IDC_PASSWORD), EM_LIMITTEXT, MAX_PASSWORD, 0); - SendMessage (GetDlgItem (hwndDlg, IDC_VERIFY), EM_LIMITTEXT, MAX_PASSWORD, 0); + ToNormalPwdField (hwndDlg, IDC_OLD_PASSWORD); + ToNormalPwdField (hwndDlg, IDC_PASSWORD); + ToNormalPwdField (hwndDlg, IDC_VERIFY); SendMessage (GetDlgItem (hwndDlg, IDC_OLD_PIM), EM_LIMITTEXT, MAX_PIM, 0); SendMessage (GetDlgItem (hwndDlg, IDC_PIM), EM_LIMITTEXT, MAX_PIM, 0); EnableWindow (GetDlgItem (hwndDlg, IDOK), FALSE); @@ -2046,11 +2336,8 @@ BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPAR } SendMessage (hComboBox, CB_SETCURSEL, nSelectedIndex, 0); - /* check TrueCrypt Mode if it was set as default*/ - SetCheckBox (hwndDlg, IDC_TRUECRYPT_MODE, EffectiveVolumeTrueCryptMode); - /* set default PIM if set in the command line*/ if (EffectiveVolumePim > 0) { SetCheckBox (hwndDlg, IDC_PIM_ENABLE, TRUE); @@ -2147,19 +2434,15 @@ BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPAR }; if (bSysEncPwdChangeDlgMode) { - /* No support for changing the password of TrueCrypt system partition */ - SetCheckBox (hwndDlg, IDC_TRUECRYPT_MODE, FALSE); - EnableWindow (GetDlgItem (hwndDlg, IDC_TRUECRYPT_MODE), FALSE); - ToBootPwdField (hwndDlg, IDC_PASSWORD); ToBootPwdField (hwndDlg, IDC_VERIFY); ToBootPwdField (hwndDlg, IDC_OLD_PASSWORD); - if ((DWORD) GetKeyboardLayout (NULL) != 0x00000409 && (DWORD) GetKeyboardLayout (NULL) != 0x04090409) + if ((DWORD)(DWORD_PTR)GetKeyboardLayout (NULL) != 0x00000409 && (DWORD)(DWORD_PTR)GetKeyboardLayout (NULL) != 0x04090409) { - DWORD keybLayout = (DWORD) LoadKeyboardLayout (L"00000409", KLF_ACTIVATE); + DWORD keybLayout = (DWORD)(DWORD_PTR)LoadKeyboardLayout (L"00000409", KLF_ACTIVATE); if (keybLayout != 0x00000409 && keybLayout != 0x04090409) { Error ("CANT_CHANGE_KEYB_LAYOUT_FOR_SYS_ENCRYPTION", hwndDlg); @@ -2191,8 +2474,19 @@ BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPAR EnableWindow (GetDlgItem (hwndDlg, IDC_ENABLE_NEW_KEYFILES), FALSE); } CheckCapsLock (hwndDlg, FALSE); + + if (!bSecureDesktopOngoing) + { + PasswordEditDropTarget* pTarget = new PasswordEditDropTarget (); + if (pTarget->Register (hwndDlg)) + { + SetWindowLongPtr (hwndDlg, DWLP_USER, (LONG_PTR) pTarget); + } + else + delete pTarget; + } return 0; } @@ -2201,9 +2495,9 @@ BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPAR { case TIMER_ID_KEYB_LAYOUT_GUARD: if (bSysEncPwdChangeDlgMode) { - DWORD keybLayout = (DWORD) GetKeyboardLayout (NULL); + DWORD keybLayout = (DWORD)(DWORD_PTR)GetKeyboardLayout (NULL); /* Watch the keyboard layout */ if (keybLayout != 0x00000409 && keybLayout != 0x04090409) @@ -2221,9 +2515,9 @@ BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPAR SetWindowText (GetDlgItem (hwndDlg, IDC_OLD_PASSWORD), L""); SetWindowText (GetDlgItem (hwndDlg, IDC_PASSWORD), L""); SetWindowText (GetDlgItem (hwndDlg, IDC_VERIFY), L""); - keybLayout = (DWORD) LoadKeyboardLayout (L"00000409", KLF_ACTIVATE); + keybLayout = (DWORD)(DWORD_PTR)LoadKeyboardLayout (L"00000409", KLF_ACTIVATE); if (keybLayout != 0x00000409 && keybLayout != 0x04090409) { KillTimer (hwndDlg, TIMER_ID_KEYB_LAYOUT_GUARD); @@ -2270,9 +2564,9 @@ BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPAR // set the text colour in (HDC)lParam SetBkMode((HDC)wParam,TRANSPARENT); SetTextColor((HDC)wParam, RGB(255,0,0)); // NOTE: per documentation as pointed out by selbie, GetSolidBrush would leak a GDI handle. - return (BOOL)GetSysColorBrush(COLOR_MENU); + return (BOOL)(INT_PTR)GetSysColorBrush(COLOR_MENU); } } return 0; @@ -2308,9 +2602,9 @@ BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPAR } if (lw == IDC_PIM) { - if(GetPim (hwndDlg, IDC_OLD_PIM) != GetPim (hwndDlg, IDC_PIM)) + if(GetPim (hwndDlg, IDC_OLD_PIM, 0) != GetPim (hwndDlg, IDC_PIM, 0)) { PimValueChangedWarning = TRUE; SetDlgItemTextW (hwndDlg, IDC_PIM_HELP, GetString (bSysEncPwdChangeDlgMode? "PIM_SYSENC_CHANGE_WARNING" : "PIM_CHANGE_WARNING")); } @@ -2456,9 +2750,9 @@ BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPAR SendMessage (GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID), CB_GETCURSEL, 0, 0), 0); if (new_hash_algo_id != 0 && !bSystemIsGPT && !HashForSystemEncryption(new_hash_algo_id)) { - int new_hash_algo_id = DEFAULT_HASH_ALGORITHM_BOOT; + new_hash_algo_id = DEFAULT_HASH_ALGORITHM_BOOT; Info ("ALGO_NOT_SUPPORTED_FOR_SYS_ENCRYPTION", hwndDlg); SelectAlgo (GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID), &new_hash_algo_id); } } @@ -2467,16 +2761,8 @@ BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPAR return 1; } - if (lw == IDC_TRUECRYPT_MODE) - { - BOOL bEnablePim = GetCheckBox (hwndDlg, IDC_TRUECRYPT_MODE) ? FALSE: TRUE; - EnableWindow (GetDlgItem (hwndDlg, IDT_OLD_PIM), bEnablePim); - EnableWindow (GetDlgItem (hwndDlg, IDC_OLD_PIM), bEnablePim); - EnableWindow (GetDlgItem (hwndDlg, IDC_OLD_PIM_HELP), bEnablePim); - } - if (lw == IDC_SHOW_PASSWORD_CHPWD_ORI) { HandleShowPasswordFieldAction (hwndDlg, IDC_SHOW_PASSWORD_CHPWD_ORI, IDC_OLD_PASSWORD, IDC_OLD_PIM); return 1; @@ -2503,23 +2789,12 @@ BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPAR int old_pkcs5 = (int) SendMessage (GetDlgItem (hwndDlg, IDC_PKCS5_OLD_PRF_ID), CB_GETITEMDATA, SendMessage (GetDlgItem (hwndDlg, IDC_PKCS5_OLD_PRF_ID), CB_GETCURSEL, 0, 0), 0); int pkcs5 = (int) SendMessage (GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID), CB_GETITEMDATA, SendMessage (GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID), CB_GETCURSEL, 0, 0), 0); - BOOL truecryptMode = GetCheckBox (hwndDlg, IDC_TRUECRYPT_MODE); - int old_pim = GetPim (hwndDlg, IDC_OLD_PIM); - int pim = GetPim (hwndDlg, IDC_PIM); - - if (truecryptMode && !is_pkcs5_prf_supported (old_pkcs5, TRUE, PRF_BOOT_NO)) - { - Error ("ALGO_NOT_SUPPORTED_FOR_TRUECRYPT_MODE", hwndDlg); - return 1; - } - else if (truecryptMode && (old_pim != 0)) - { - Error ("PIM_NOT_SUPPORTED_FOR_TRUECRYPT_MODE", hwndDlg); - return 1; - } + int old_pim = GetPim (hwndDlg, IDC_OLD_PIM, 0); + int pim = GetPim (hwndDlg, IDC_PIM, 0); + int iMaxPasswordLength = (bUseLegacyMaxPasswordLength)? MAX_LEGACY_PASSWORD : MAX_PASSWORD; if (bSysEncPwdChangeDlgMode && !CheckPasswordCharEncoding (GetDlgItem (hwndDlg, IDC_PASSWORD), NULL)) { Error ("UNSUPPORTED_CHARS_IN_PWD", hwndDlg); @@ -2546,15 +2821,27 @@ BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPAR } else if (!(newKeyFilesParam.EnableKeyFiles && newKeyFilesParam.FirstKeyFile != NULL) && pwdChangeDlgMode == PCDM_CHANGE_PASSWORD) { - if (!CheckPasswordLength (hwndDlg, GetWindowTextLength(GetDlgItem (hwndDlg, IDC_PASSWORD)), pim, bSysEncPwdChangeDlgMode, FALSE, FALSE)) + int bootPRF = 0; + if (bSysEncPwdChangeDlgMode) + { + try + { + VOLUME_PROPERTIES_STRUCT properties; + BootEncObj->GetVolumeProperties(&properties); + bootPRF = properties.pkcs5; + } + catch(...) + {} + } + if (!CheckPasswordLength (hwndDlg, GetWindowTextLength(GetDlgItem (hwndDlg, IDC_PASSWORD)), pim, bSysEncPwdChangeDlgMode, bootPRF, FALSE, FALSE)) return 1; } GetVolumePath (hParent, szFileName, ARRAYSIZE (szFileName)); - if (GetPassword (hwndDlg, IDC_OLD_PASSWORD, (LPSTR) oldPassword.Text, sizeof (oldPassword.Text), TRUE)) + if (GetPassword (hwndDlg, IDC_OLD_PASSWORD, (LPSTR) oldPassword.Text, iMaxPasswordLength + 1, FALSE, TRUE)) oldPassword.Length = (unsigned __int32) strlen ((char *) oldPassword.Text); else { return 1; @@ -2570,9 +2857,9 @@ BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPAR pim = old_pim; break; default: - if (GetPassword (hwndDlg, IDC_PASSWORD, (LPSTR) newPassword.Text, sizeof (newPassword.Text), TRUE)) + if (GetPassword (hwndDlg, IDC_PASSWORD, (LPSTR) newPassword.Text, iMaxPasswordLength + 1, FALSE, TRUE)) newPassword.Length = (unsigned __int32) strlen ((char *) newPassword.Text); else return 1; } @@ -2599,9 +2886,8 @@ BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPAR changePwdParam.pkcs5 = pkcs5; changePwdParam.pim = pim; changePwdParam.wipePassCount = GetWipePassCount(headerWiperMode); changePwdParam.pnStatus = &nStatus; - changePwdParam.truecryptMode = truecryptMode; ShowWaitDialog(hwndDlg, TRUE, ChangePwdWaitThreadProc, &changePwdParam); err: @@ -2643,8 +2929,21 @@ err: } return 1; } return 0; + + case WM_NCDESTROY: + { + /* unregister drap-n-drop support */ + PasswordEditDropTarget* pTarget = (PasswordEditDropTarget*) GetWindowLongPtr (hwndDlg, DWLP_USER); + if (pTarget) + { + SetWindowLongPtr (hwndDlg, DWLP_USER, (LONG_PTR) 0); + pTarget->Revoke (); + pTarget->Release(); + } + } + return 0; } return 0; } @@ -2661,9 +2960,8 @@ BOOL CALLBACK PasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa WORD lw = LOWORD (wParam); static Password *szXPwd; static int *pkcs5; static int *pim; - static BOOL* truecryptMode; switch (msg) { case WM_INITDIALOG: @@ -2671,9 +2969,8 @@ BOOL CALLBACK PasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa int i, nIndex, defaultPrfIndex = 0; szXPwd = ((PasswordDlgParam *) lParam) -> password; pkcs5 = ((PasswordDlgParam *) lParam) -> pkcs5; pim = ((PasswordDlgParam *) lParam) -> pim; - truecryptMode = ((PasswordDlgParam *) lParam) -> truecryptMode; LocalizeDialog (hwndDlg, "IDD_PASSWORD_DLG"); DragAcceptFiles (hwndDlg, TRUE); if (PasswordDialogTitleStringId) @@ -2720,9 +3017,9 @@ BOOL CALLBACK PasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa /* make autodetection the default unless a specific PRF was specified in the command line */ SendMessage (hComboBox, CB_SETCURSEL, defaultPrfIndex, 0); - SendMessage (GetDlgItem (hwndDlg, IDC_PASSWORD), EM_LIMITTEXT, MAX_PASSWORD, 0); + ToNormalPwdField (hwndDlg, IDC_PASSWORD); SendMessage (GetDlgItem (hwndDlg, IDC_CACHE), BM_SETCHECK, bCacheInDriver ? BST_CHECKED:BST_UNCHECKED, 0); SendMessage (GetDlgItem (hwndDlg, IDC_PIM), EM_LIMITTEXT, MAX_PIM, 0); SetPim (hwndDlg, IDC_PIM, *pim); @@ -2749,16 +3046,8 @@ BOOL CALLBACK PasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa if (PasswordDialogDisableMountOptions) { EnableWindow (GetDlgItem (hwndDlg, IDC_CACHE), FALSE); EnableWindow (GetDlgItem (hwndDlg, IDC_MOUNT_OPTIONS), FALSE); - /* Disable TrueCrypt mode option in case of backup/restore header operation */ - SetCheckBox (hwndDlg, IDC_TRUECRYPT_MODE, FALSE); - EnableWindow (GetDlgItem (hwndDlg, IDC_TRUECRYPT_MODE), FALSE); - } - else if (*truecryptMode) - { - /* Check TrueCryptMode if it is enabled on the command line */ - SetCheckBox (hwndDlg, IDC_TRUECRYPT_MODE, TRUE); } if (!SetForegroundWindow (hwndDlg) && (FavoriteMountOnArrivalInProgress || LogOn)) { @@ -2774,8 +3063,24 @@ BOOL CALLBACK PasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa FlashWindowEx (&flash); SetWindowPos (hwndDlg, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); } + SetFocus (GetDlgItem (hwndDlg, IDC_PASSWORD)); + + /* Start the timer to check if we are foreground only if Secure Desktop is not used */ + /* Implement Text drag-n-drop in order to support droping password from KeePass directly only if Secure Desktop is not used */ + if (!bSecureDesktopOngoing) + { + SetTimer (hwndDlg, TIMER_ID_CHECK_FOREGROUND, TIMER_INTERVAL_CHECK_FOREGROUND, NULL); + + PasswordEditDropTarget* pTarget = new PasswordEditDropTarget (); + if (pTarget->Register (hwndDlg)) + { + SetWindowLongPtr (hwndDlg, DWLP_USER, (LONG_PTR) pTarget); + } + else + delete pTarget; + } } return 0; case TC_APPMSG_PREBOOT_PASSWORD_MODE: @@ -2809,20 +3114,28 @@ BOOL CALLBACK PasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa tmp [MAX_PASSWORD] = 0; SetWindowText (GetDlgItem (hwndDlg, IDC_PASSWORD), tmp); SetWindowText (GetDlgItem (hwndDlg, IDC_PASSWORD), L""); - StringCbPrintfW (OrigKeyboardLayout, sizeof(OrigKeyboardLayout),L"%08X", (DWORD) GetKeyboardLayout (NULL) & 0xFFFF); + if (!GetKeyboardLayoutNameW(OrigKeyboardLayout)) + { + StringCbPrintfW(OrigKeyboardLayout, sizeof(OrigKeyboardLayout), L"%08X", (DWORD)(DWORD_PTR)GetKeyboardLayout(NULL) & 0xFFFF); + } - DWORD keybLayout = (DWORD) LoadKeyboardLayout (L"00000409", KLF_ACTIVATE); + DWORD keybLayout = (DWORD) (DWORD_PTR) LoadKeyboardLayout (L"00000409", KLF_ACTIVATE); if (keybLayout != 0x00000409 && keybLayout != 0x04090409) { Error ("CANT_CHANGE_KEYB_LAYOUT_FOR_SYS_ENCRYPTION", hwndDlg); - EndDialog (hwndDlg, IDCANCEL); - return 1; + /* don't be too agressive on enforcing an English keyboard layout. E.g. on WindowsPE this call fails and + * then the user can only mount a system encrypted device using the command line by passing the password as a parameter + * (which might not be obvious for not so advanced users). + * + * Now, we informed the user that English keyboard is required, if it is not available the volume can just not be mounted. + * There should be no other drawback (as e.g., on the change password dialog, when you might change to a password which won't + * work on the pre-start environment. + */ } - - if (SetTimer (hwndDlg, TIMER_ID_KEYB_LAYOUT_GUARD, TIMER_INTERVAL_KEYB_LAYOUT_GUARD, NULL) == 0) + else if (SetTimer (hwndDlg, TIMER_ID_KEYB_LAYOUT_GUARD, TIMER_INTERVAL_KEYB_LAYOUT_GUARD, NULL) == 0) { Error ("CANNOT_SET_TIMER", hwndDlg); EndDialog (hwndDlg, IDCANCEL); return 1; @@ -2848,12 +3161,23 @@ BOOL CALLBACK PasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa case WM_TIMER: switch (wParam) { + case TIMER_ID_CHECK_FOREGROUND: + if (hwndDlg != ::GetForegroundWindow ()) + { + // we are not foreground after 500ms of creating the dialog + // try to force it for be foreground + BringToForeground (hwndDlg); + SetFocus (GetDlgItem (hwndDlg, IDC_PASSWORD)); + } + // one shot timer: stop it + KillTimer (hwndDlg, TIMER_ID_CHECK_FOREGROUND); + return 0; case TIMER_ID_KEYB_LAYOUT_GUARD: if (bPrebootPasswordDlgMode) { - DWORD keybLayout = (DWORD) GetKeyboardLayout (NULL); + DWORD keybLayout = (DWORD)(DWORD_PTR)GetKeyboardLayout (NULL); if (keybLayout != 0x00000409 && keybLayout != 0x04090409) { // Keyboard layout is not standard US @@ -2864,9 +3188,9 @@ BOOL CALLBACK PasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa tmp [MAX_PASSWORD] = 0; SetWindowText (GetDlgItem (hwndDlg, IDC_PASSWORD), tmp); SetWindowText (GetDlgItem (hwndDlg, IDC_PASSWORD), L""); - keybLayout = (DWORD) LoadKeyboardLayout (L"00000409", KLF_ACTIVATE); + keybLayout = (DWORD)(DWORD_PTR) LoadKeyboardLayout (L"00000409", KLF_ACTIVATE); if (keybLayout != 0x00000409 && keybLayout != 0x04090409) { KillTimer (hwndDlg, TIMER_ID_KEYB_LAYOUT_GUARD); @@ -2921,16 +3245,8 @@ BOOL CALLBACK PasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa HandleShowPasswordFieldAction (hwndDlg, IDC_SHOW_PASSWORD, IDC_PASSWORD, IDC_PIM); return 1; } - if (lw == IDC_TRUECRYPT_MODE) - { - BOOL bEnablePim = GetCheckBox (hwndDlg, IDC_TRUECRYPT_MODE) ? FALSE: TRUE; - EnableWindow (GetDlgItem (hwndDlg, IDT_PIM), bEnablePim); - EnableWindow (GetDlgItem (hwndDlg, IDC_PIM), bEnablePim); - EnableWindow (GetDlgItem (hwndDlg, IDC_PIM_HELP), bEnablePim); - } - if (lw == IDC_KEY_FILES) { KeyFilesDlgParam param; param.EnableKeyFiles = KeyFilesEnable; @@ -2961,38 +3277,21 @@ BOOL CALLBACK PasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa wchar_t tmp[MAX_PASSWORD+1]; if (lw == IDOK) { + int iMaxPasswordLength = (bUseLegacyMaxPasswordLength)? MAX_LEGACY_PASSWORD : MAX_PASSWORD; if (mountOptions.ProtectHiddenVolume && hidVolProtKeyFilesParam.EnableKeyFiles) KeyFilesApply (hwndDlg, &mountOptions.ProtectedHidVolPassword, hidVolProtKeyFilesParam.FirstKeyFile, wcslen (PasswordDlgVolume) > 0 ? PasswordDlgVolume : NULL); - if (GetPassword (hwndDlg, IDC_PASSWORD, (LPSTR) szXPwd->Text, MAX_PASSWORD + 1, TRUE)) + if (GetPassword (hwndDlg, IDC_PASSWORD, (LPSTR) szXPwd->Text, iMaxPasswordLength + 1, FALSE, TRUE)) szXPwd->Length = (unsigned __int32) strlen ((char *) szXPwd->Text); else return 1; bCacheInDriver = IsButtonChecked (GetDlgItem (hwndDlg, IDC_CACHE)); *pkcs5 = (int) SendMessage (GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID), CB_GETITEMDATA, SendMessage (GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID), CB_GETCURSEL, 0, 0), 0); - *truecryptMode = GetCheckBox (hwndDlg, IDC_TRUECRYPT_MODE); - - *pim = GetPim (hwndDlg, IDC_PIM); - /* check that PRF is supported in TrueCrypt Mode */ - if ( (*truecryptMode) - && ((!is_pkcs5_prf_supported (*pkcs5, TRUE, PRF_BOOT_NO)) || (mountOptions.ProtectHiddenVolume && !is_pkcs5_prf_supported (mountOptions.ProtectedHidVolPkcs5Prf, TRUE, PRF_BOOT_NO))) - ) - { - Error ("ALGO_NOT_SUPPORTED_FOR_TRUECRYPT_MODE", hwndDlg); - return 1; - } - - if ( (*truecryptMode) - && (*pim != 0) - ) - { - Error ("PIM_NOT_SUPPORTED_FOR_TRUECRYPT_MODE", hwndDlg); - return 1; - } + *pim = GetPim (hwndDlg, IDC_PIM, 0); } // Attempt to wipe password stored in the input field buffer wmemset (tmp, L'X', MAX_PASSWORD); @@ -3019,8 +3318,21 @@ BOOL CALLBACK PasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa return 1; } return 0; + case WM_NCDESTROY: + { + /* unregister drap-n-drop support */ + PasswordEditDropTarget* pTarget = (PasswordEditDropTarget*) GetWindowLongPtr (hwndDlg, DWLP_USER); + if (pTarget) + { + SetWindowLongPtr (hwndDlg, DWLP_USER, (LONG_PTR) 0); + pTarget->Revoke (); + pTarget->Release(); + } + } + return 0; + case WM_CONTEXTMENU: { RECT buttonRect; GetWindowRect (GetDlgItem (hwndDlg, IDC_KEY_FILES), &buttonRect); @@ -3137,8 +3449,11 @@ BOOL CALLBACK PreferencesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM SendMessage (GetDlgItem (hwndDlg, IDC_SECURE_DESKTOP_PASSWORD_ENTRY), BM_SETCHECK, bUseSecureDesktop ? BST_CHECKED:BST_UNCHECKED, 0); + SendMessage (GetDlgItem (hwndDlg, IDC_USE_LEGACY_MAX_PASSWORD_LENGTH), BM_SETCHECK, + bUseLegacyMaxPasswordLength ? BST_CHECKED:BST_UNCHECKED, 0); + SendMessage (GetDlgItem (hwndDlg, IDC_PREF_TEMP_CACHE_ON_MULTIPLE_MOUNT), BM_SETCHECK, bCacheDuringMultipleMount ? BST_CHECKED:BST_UNCHECKED, 0); SendMessage (GetDlgItem (hwndDlg, IDC_PREF_WIPE_CACHE_ON_EXIT), BM_SETCHECK, @@ -3253,8 +3568,9 @@ BOOL CALLBACK PreferencesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM bPreserveTimestamp = defaultMountOptions.PreserveTimestamp = IsButtonChecked (GetDlgItem (hwndDlg, IDC_PRESERVE_TIMESTAMPS)); bShowDisconnectedNetworkDrives = IsButtonChecked (GetDlgItem (hwndDlg, IDC_SHOW_DISCONNECTED_NETWORK_DRIVES)); bHideWaitingDialog = IsButtonChecked (GetDlgItem (hwndDlg, IDC_HIDE_WAITING_DIALOG)); bUseSecureDesktop = IsButtonChecked (GetDlgItem (hwndDlg, IDC_SECURE_DESKTOP_PASSWORD_ENTRY)); + bUseLegacyMaxPasswordLength = IsButtonChecked (GetDlgItem (hwndDlg, IDC_USE_LEGACY_MAX_PASSWORD_LENGTH)); bCacheDuringMultipleMount = IsButtonChecked (GetDlgItem (hwndDlg, IDC_PREF_TEMP_CACHE_ON_MULTIPLE_MOUNT)); bWipeCacheOnExit = IsButtonChecked (GetDlgItem (hwndDlg, IDC_PREF_WIPE_CACHE_ON_EXIT)); bWipeCacheOnAutoDismount = IsButtonChecked (GetDlgItem (hwndDlg, IDC_PREF_WIPE_CACHE_ON_AUTODISMOUNT)); bCacheInDriverDefault = bCacheInDriver = IsButtonChecked (GetDlgItem (hwndDlg, IDC_PREF_CACHE_PASSWORDS)); @@ -3325,9 +3641,9 @@ BOOL CALLBACK PreferencesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM BOOL CALLBACK MountOptionsDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { - static MountOptions *mountOptions; + static MountOptions *pMountOptions; WORD lw = LOWORD (wParam); switch (msg) @@ -3335,35 +3651,39 @@ BOOL CALLBACK MountOptionsDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM case WM_INITDIALOG: { BOOL protect; - mountOptions = (MountOptions *) lParam; + pMountOptions = (MountOptions *) lParam; LocalizeDialog (hwndDlg, "IDD_MOUNT_OPTIONS"); SendDlgItemMessage (hwndDlg, IDC_MOUNT_READONLY, BM_SETCHECK, - mountOptions->ReadOnly ? BST_CHECKED : BST_UNCHECKED, 0); + pMountOptions->ReadOnly ? BST_CHECKED : BST_UNCHECKED, 0); SendDlgItemMessage (hwndDlg, IDC_MOUNT_REMOVABLE, BM_SETCHECK, - mountOptions->Removable ? BST_CHECKED : BST_UNCHECKED, 0); - SendDlgItemMessage (hwndDlg, IDC_PROTECT_HIDDEN_VOL, BM_SETCHECK, - mountOptions->ProtectHiddenVolume ? BST_CHECKED : BST_UNCHECKED, 0); + pMountOptions->Removable ? BST_CHECKED : BST_UNCHECKED, 0); + SendDlgItemMessage (hwndDlg, IDC_DISABLE_MOUNT_MANAGER, BM_SETCHECK, + pMountOptions->DisableMountManager ? BST_CHECKED : BST_UNCHECKED, 0); SendDlgItemMessage (hwndDlg, IDC_PROTECT_HIDDEN_VOL, BM_SETCHECK, - mountOptions->ProtectHiddenVolume ? BST_CHECKED : BST_UNCHECKED, 0); + pMountOptions->ProtectHiddenVolume ? BST_CHECKED : BST_UNCHECKED, 0); - mountOptions->PartitionInInactiveSysEncScope = bPrebootPasswordDlgMode; + pMountOptions->PartitionInInactiveSysEncScope = bPrebootPasswordDlgMode; SendDlgItemMessage (hwndDlg, IDC_MOUNT_SYSENC_PART_WITHOUT_PBA, BM_SETCHECK, bPrebootPasswordDlgMode ? BST_CHECKED : BST_UNCHECKED, 0); SendDlgItemMessage (hwndDlg, IDC_USE_EMBEDDED_HEADER_BAK, BM_SETCHECK, - mountOptions->UseBackupHeader ? BST_CHECKED : BST_UNCHECKED, 0); + pMountOptions->UseBackupHeader ? BST_CHECKED : BST_UNCHECKED, 0); EnableWindow (GetDlgItem (hwndDlg, IDC_MOUNT_SYSENC_PART_WITHOUT_PBA), !bPrebootPasswordDlgMode); - SetDlgItemTextW (hwndDlg, IDC_VOLUME_LABEL, mountOptions->Label); + SetDlgItemTextW (hwndDlg, IDC_VOLUME_LABEL, pMountOptions->Label); SendDlgItemMessage (hwndDlg, IDC_VOLUME_LABEL, EM_LIMITTEXT, 32, 0); // 32 is the maximum possible length for a drive label in Windows + protect = IsButtonChecked (GetDlgItem (hwndDlg, IDC_DISABLE_MOUNT_MANAGER)); + EnableWindow (GetDlgItem (hwndDlg, IDC_VOLUME_LABEL), !protect); + EnableWindow (GetDlgItem (hwndDlg, IDT_VOLUME_LABEL), !protect); + /* Add PRF algorithm list for hidden volume password */ HWND hComboBox = GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID); SendMessage (hComboBox, CB_RESETCONTENT, 0, 0); @@ -3374,9 +3694,9 @@ BOOL CALLBACK MountOptionsDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM { nIndex = (int) SendMessage (hComboBox, CB_ADDSTRING, 0, (LPARAM) get_pkcs5_prf_name(i)); SendMessage (hComboBox, CB_SETITEMDATA, nIndex, (LPARAM) i); /* if a PRF was selected previously, select it */ - if (i == mountOptions->ProtectedHidVolPkcs5Prf) + if (i == pMountOptions->ProtectedHidVolPkcs5Prf) nSelectedIndex = nIndex; } SendMessage (hComboBox, CB_SETCURSEL, nSelectedIndex, 0); @@ -3398,24 +3718,24 @@ BOOL CALLBACK MountOptionsDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM EnableWindow (GetDlgItem (hwndDlg, IDC_PIM_ENABLE), protect); SetCheckBox (hwndDlg, IDC_KEYFILES_ENABLE_HIDVOL_PROT, hidVolProtKeyFilesParam.EnableKeyFiles); - SendDlgItemMessage (hwndDlg, IDC_PASSWORD_PROT_HIDVOL, EM_LIMITTEXT, MAX_PASSWORD, 0); + ToNormalPwdField (hwndDlg, IDC_PASSWORD_PROT_HIDVOL); SendDlgItemMessage (hwndDlg, IDC_PIM, EM_LIMITTEXT, MAX_PIM, 0); - if (mountOptions->ProtectedHidVolPassword.Length > 0) + if (pMountOptions->ProtectedHidVolPassword.Length > 0) { wchar_t szTmp[MAX_PASSWORD + 1]; - if (0 == MultiByteToWideChar (CP_UTF8, 0, (LPSTR) mountOptions->ProtectedHidVolPassword.Text, -1, szTmp, MAX_PASSWORD + 1)) + if (0 == MultiByteToWideChar (CP_UTF8, 0, (LPSTR) pMountOptions->ProtectedHidVolPassword.Text, -1, szTmp, MAX_PASSWORD + 1)) szTmp [0] = 0; SetWindowText (GetDlgItem (hwndDlg, IDC_PASSWORD_PROT_HIDVOL), szTmp); burn (szTmp, sizeof (szTmp)); } - SetPim (hwndDlg, IDC_PIM, mountOptions->ProtectedHidVolPim); + SetPim (hwndDlg, IDC_PIM, pMountOptions->ProtectedHidVolPim); /* make PIM field visible if a PIM value has been explicitely specified */ - if (mountOptions->ProtectedHidVolPim > 0) + if (pMountOptions->ProtectedHidVolPim > 0) { SetCheckBox (hwndDlg, IDC_PIM_ENABLE, TRUE); ShowWindow (GetDlgItem (hwndDlg, IDC_PIM_ENABLE), SW_HIDE); ShowWindow (GetDlgItem( hwndDlg, IDT_PIM), SW_SHOW); @@ -3424,8 +3744,19 @@ BOOL CALLBACK MountOptionsDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM } ToHyperlink (hwndDlg, IDC_LINK_HIDVOL_PROTECTION_INFO); + if (!bSecureDesktopOngoing) + { + PasswordEditDropTarget* pTarget = new PasswordEditDropTarget (); + if (pTarget->Register (hwndDlg)) + { + SetWindowLongPtr (hwndDlg, DWLP_USER, (LONG_PTR) pTarget); + } + else + delete pTarget; + } + } return 0; case WM_CONTEXTMENU: @@ -3486,9 +3817,9 @@ BOOL CALLBACK MountOptionsDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM } if (lw == IDC_LINK_HIDVOL_PROTECTION_INFO) { - Applink ("hiddenvolprotection", TRUE, ""); + Applink ("hiddenvolprotection"); } if (lw == IDCANCEL) { @@ -3506,36 +3837,38 @@ BOOL CALLBACK MountOptionsDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM if (lw == IDOK) { wchar_t tmp[MAX_PASSWORD+1]; - mountOptions->ReadOnly = IsButtonChecked (GetDlgItem (hwndDlg, IDC_MOUNT_READONLY)); - mountOptions->Removable = IsButtonChecked (GetDlgItem (hwndDlg, IDC_MOUNT_REMOVABLE)); - mountOptions->ProtectHiddenVolume = IsButtonChecked (GetDlgItem (hwndDlg, IDC_PROTECT_HIDDEN_VOL)); - mountOptions->PartitionInInactiveSysEncScope = IsButtonChecked (GetDlgItem (hwndDlg, IDC_MOUNT_SYSENC_PART_WITHOUT_PBA)); - mountOptions->UseBackupHeader = IsButtonChecked (GetDlgItem (hwndDlg, IDC_USE_EMBEDDED_HEADER_BAK)); + pMountOptions->ReadOnly = IsButtonChecked (GetDlgItem (hwndDlg, IDC_MOUNT_READONLY)); + pMountOptions->Removable = IsButtonChecked (GetDlgItem (hwndDlg, IDC_MOUNT_REMOVABLE)); + pMountOptions->DisableMountManager = IsButtonChecked (GetDlgItem (hwndDlg, IDC_DISABLE_MOUNT_MANAGER)); + pMountOptions->ProtectHiddenVolume = IsButtonChecked (GetDlgItem (hwndDlg, IDC_PROTECT_HIDDEN_VOL)); + pMountOptions->PartitionInInactiveSysEncScope = IsButtonChecked (GetDlgItem (hwndDlg, IDC_MOUNT_SYSENC_PART_WITHOUT_PBA)); + pMountOptions->UseBackupHeader = IsButtonChecked (GetDlgItem (hwndDlg, IDC_USE_EMBEDDED_HEADER_BAK)); - GetDlgItemTextW (hwndDlg, IDC_VOLUME_LABEL, mountOptions->Label, sizeof (mountOptions->Label) /sizeof (wchar_t)); + GetDlgItemTextW (hwndDlg, IDC_VOLUME_LABEL, pMountOptions->Label, sizeof (pMountOptions->Label) /sizeof (wchar_t)); - if (mountOptions->ProtectHiddenVolume) + if (pMountOptions->ProtectHiddenVolume) { + int iMaxPasswordLength = bUseLegacyMaxPasswordLength? MAX_LEGACY_PASSWORD : MAX_PASSWORD; GetPassword (hwndDlg, IDC_PASSWORD_PROT_HIDVOL, - (LPSTR) mountOptions->ProtectedHidVolPassword.Text, MAX_PASSWORD + 1, - FALSE); + (LPSTR) pMountOptions->ProtectedHidVolPassword.Text, iMaxPasswordLength + 1, + FALSE, FALSE); - mountOptions->ProtectedHidVolPassword.Length = (unsigned __int32) strlen ((char *) mountOptions->ProtectedHidVolPassword.Text); + pMountOptions->ProtectedHidVolPassword.Length = (unsigned __int32) strlen ((char *) pMountOptions->ProtectedHidVolPassword.Text); - mountOptions->ProtectedHidVolPkcs5Prf = (int) SendMessage (GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID), CB_GETITEMDATA, + pMountOptions->ProtectedHidVolPkcs5Prf = (int) SendMessage (GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID), CB_GETITEMDATA, SendMessage (GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID), CB_GETCURSEL, 0, 0), 0); - mountOptions->ProtectedHidVolPim = GetPim (hwndDlg, IDC_PIM); + pMountOptions->ProtectedHidVolPim = GetPim (hwndDlg, IDC_PIM, 0); } // Cleanup wmemset (tmp, L'X', MAX_PASSWORD); tmp[MAX_PASSWORD] = 0; SetWindowText (GetDlgItem (hwndDlg, IDC_PASSWORD_PROT_HIDVOL), tmp); - if ((mountOptions->ProtectHiddenVolume && !bEnableBkgTask) + if ((pMountOptions->ProtectHiddenVolume && !bEnableBkgTask) && (AskWarnYesNo ("HIDVOL_PROT_BKG_TASK_WARNING", hwndDlg) == IDYES)) { bEnableBkgTask = TRUE; TaskBarIconAdd (MainDlg); @@ -3544,9 +3877,9 @@ BOOL CALLBACK MountOptionsDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM EndDialog (hwndDlg, lw); return 1; } - if (lw == IDC_MOUNT_READONLY || lw == IDC_PROTECT_HIDDEN_VOL) + if (lw == IDC_MOUNT_READONLY || lw == IDC_PROTECT_HIDDEN_VOL || lw == IDC_DISABLE_MOUNT_MANAGER) { BOOL protect; if (lw == IDC_MOUNT_READONLY) @@ -3555,8 +3888,14 @@ BOOL CALLBACK MountOptionsDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM EnableWindow (GetDlgItem (hwndDlg, IDC_PROTECT_HIDDEN_VOL), !IsButtonChecked (GetDlgItem (hwndDlg, IDC_MOUNT_READONLY))); EnableWindow (GetDlgItem (hwndDlg, IDT_HIDDEN_VOL_PROTECTION), !IsButtonChecked (GetDlgItem (hwndDlg, IDC_MOUNT_READONLY))); } + if (lw == IDC_DISABLE_MOUNT_MANAGER) + { + EnableWindow (GetDlgItem (hwndDlg, IDC_VOLUME_LABEL), !IsButtonChecked (GetDlgItem (hwndDlg, IDC_DISABLE_MOUNT_MANAGER))); + EnableWindow (GetDlgItem (hwndDlg, IDT_VOLUME_LABEL), !IsButtonChecked (GetDlgItem (hwndDlg, IDC_DISABLE_MOUNT_MANAGER))); + } + protect = IsButtonChecked (GetDlgItem (hwndDlg, IDC_PROTECT_HIDDEN_VOL)); EnableWindow (GetDlgItem (hwndDlg, IDC_PASSWORD_PROT_HIDVOL), protect); EnableWindow (GetDlgItem (hwndDlg, IDT_HIDDEN_PROT_PASSWD), protect); @@ -3573,8 +3912,21 @@ BOOL CALLBACK MountOptionsDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM return 1; } return 0; + + case WM_NCDESTROY: + { + /* unregister drap-n-drop support */ + PasswordEditDropTarget* pTarget = (PasswordEditDropTarget*) GetWindowLongPtr (hwndDlg, DWLP_USER); + if (pTarget) + { + SetWindowLongPtr (hwndDlg, DWLP_USER, (LONG_PTR) 0); + pTarget->Revoke (); + pTarget->Release(); + } + } + return 0; } return 0; } @@ -3808,8 +4160,16 @@ BOOL CALLBACK VolumePropertiesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LP ListSubItemSet (list, i++, 1, GetString (bSysEncWholeDrive ? "SYSTEM_DRIVE" : IsHiddenOSRunning() ? "HIDDEN_SYSTEM_PARTITION" : "SYSTEM_PARTITION")); else ListSubItemSet (list, i++, 1, (wchar_t *) (prop.wszVolume[1] != L'?' ? prop.wszVolume : prop.wszVolume + 4)); + if (!bSysEnc && prop.mountDisabled) + { + // Virtual Device + StringCbPrintfW (szTmp, sizeof(szTmp), L"\\Device\\VeraCryptVolume%c", (wchar_t) prop.driveNo + L'A'); + ListItemAdd (list, i, GetString ("VIRTUAL_DEVICE")); + ListSubItemSet (list, i++, 1, szTmp); + } + if (!bSysEnc && IsVolumeDeviceHosted ((wchar_t *) (prop.wszVolume[1] != L'?' ? prop.wszVolume : prop.wszVolume + 4))) { // Volume ID std::wstring hexID = ArrayToHexWideString (prop.volumeID, sizeof (prop.volumeID)); @@ -3829,19 +4189,12 @@ BOOL CALLBACK VolumePropertiesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LP if (bSysEnc) ListSubItemSet (list, i++, 1, GetString (IsHiddenOSRunning() ? "TYPE_HIDDEN_SYSTEM_ADJECTIVE" : "SYSTEM_VOLUME_TYPE_ADJECTIVE")); else { - bool truecryptMode = prop.pkcs5Iterations == get_pkcs5_iteration_count(prop.pkcs5, 0, TRUE, prop.partitionInInactiveSysEncScope); s = prop.hiddenVolume ? GetString ("HIDDEN") : (prop.hiddenVolProtection != HIDVOL_PROT_STATUS_NONE ? GetString ("OUTER") : GetString ("NORMAL")); - if (truecryptMode) - { - StringCbPrintfW (sw, sizeof(sw), L"TrueCrypt - %s", s); - ListSubItemSet (list, i++, 1, sw); - } - else - ListSubItemSet (list, i++, 1, s); + ListSubItemSet (list, i++, 1, s); } if (!bSysEnc) { @@ -3877,23 +4230,23 @@ BOOL CALLBACK VolumePropertiesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LP ListSubItemSet (list, i, 1, L"?"); return 1; } - EAGetName (szTmp, prop.ea, 1); + EAGetName (szTmp, ARRAYSIZE(szTmp), prop.ea, 1); ListSubItemSet (list, i++, 1, szTmp); // Key size(s) { wchar_t name[128]; int size = EAGetKeySize (prop.ea); - EAGetName (name, prop.ea, 1); + EAGetName (name, ARRAYSIZE(name), prop.ea, 1); // Primary key ListItemAdd (list, i, GetString ("KEY_SIZE")); StringCbPrintfW (sw, sizeof(sw), L"%d %s", size * 8, GetString ("BITS")); ListSubItemSet (list, i++, 1, sw); - if (wcscmp (EAGetModeName (prop.ea, prop.mode, TRUE), L"XTS") == 0) + if (wcscmp (EAGetModeName (prop.mode), L"XTS") == 0) { // Secondary key (XTS) ListItemAdd (list, i, GetString ("SECONDARY_KEY_SIZE_XTS")); @@ -3909,9 +4262,9 @@ BOOL CALLBACK VolumePropertiesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LP ListSubItemSet (list, i++, 1, sw); // Mode ListItemAdd (list, i, GetString ("MODE_OF_OPERATION")); - ListSubItemSet (list, i++, 1, EAGetModeName (prop.ea, prop.mode, TRUE)); + ListSubItemSet (list, i++, 1, EAGetModeName (prop.mode)); // PKCS 5 PRF ListItemAdd (list, i, GetString ("PKCS5_PRF")); if (prop.volumePim == 0) @@ -3945,9 +4298,9 @@ BOOL CALLBACK VolumePropertiesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LP FileTimeToSystemTime (&ft, &st); GetDateFormatW (LOCALE_USER_DEFAULT, 0, &st, 0, sw, sizeof (sw)/2); swprintf (date, L"%s ", sw); GetTimeFormatW (LOCALE_USER_DEFAULT, 0, &st, 0, sw, sizeof (sw)/2); - wcscat (date, sw); + StringCchCatW (date, ARRAYSIZE(date), sw); ListSubItemSet (list, i++, 1, date); // Header date ListItemAdd (list, i, GetString ("VOLUME_HEADER_DATE")); @@ -3955,9 +4308,9 @@ BOOL CALLBACK VolumePropertiesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LP FileTimeToSystemTime (&ft, &st); GetDateFormatW (LOCALE_USER_DEFAULT, 0, &st, 0, sw, sizeof (sw)/2); swprintf (date, L"%s ", sw); GetTimeFormatW (LOCALE_USER_DEFAULT, 0, &st, 0, sw, sizeof (sw)/2); - wcscat (date, sw); + StringCchCatW (date, ARRAYSIZE(date), sw); GetLocalTime (&st); SystemTimeToFileTime (&st, &curFt); curFt64.HighPart = curFt.dwHighDateTime; @@ -4128,9 +4481,9 @@ BOOL CALLBACK TravelerDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa { // This the directory field. Make its background like normal edit HBRUSH hbr = GetSysColorBrush (COLOR_WINDOW); ::SelectObject(hdc, hbr); - return (BOOL) hbr; + return (BOOL)(INT_PTR)hbr; } } return 0; @@ -4179,9 +4532,9 @@ BOOL CALLBACK TravelerDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa { wchar_t dstPath[MAX_PATH * 2]; GetDlgItemText (hwndDlg, IDC_DIRECTORY, dstPath, ARRAYSIZE (dstPath)); - if (BrowseDirectories (hwndDlg, "SELECT_DEST_DIR", dstPath)) + if (BrowseDirectories (hwndDlg, "SELECT_DEST_DIR", dstPath, dstPath)) SetDlgItemText (hwndDlg, IDC_DIRECTORY, dstPath); return 1; } @@ -4194,9 +4547,9 @@ BOOL CALLBACK TravelerDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa if (lw == IDC_CREATE) { - BOOL copyWizard, copyExpander, bExplore, bCacheInDriver, bIncludePimInCache, bAutoRun, bAutoMount, bMountReadOnly; + BOOL copyWizard, copyExpander, openExplorer, cacheInDriver, includePimInCache, bAutoRun, bAutoMount, bMountReadOnly; WCHAR dstDir[MAX_PATH + 1]; WCHAR srcPath[1024 + MAX_PATH + 1]; WCHAR dstPath[2*MAX_PATH + 1]; WCHAR appDir[1024]; @@ -4212,11 +4565,11 @@ BOOL CALLBACK TravelerDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa drive = (int) SendDlgItemMessage (hwndDlg, IDC_DRIVELIST, CB_GETITEMDATA, drive, 0); copyWizard = IsButtonChecked (GetDlgItem (hwndDlg, IDC_COPY_WIZARD)); copyExpander = IsButtonChecked (GetDlgItem (hwndDlg, IDC_COPY_EXPANDER)); - bExplore = IsButtonChecked (GetDlgItem (hwndDlg, IDC_TRAVEL_OPEN_EXPLORER)); - bCacheInDriver = IsButtonChecked (GetDlgItem (hwndDlg, IDC_TRAV_CACHE_PASSWORDS)); - bIncludePimInCache = IsButtonChecked (GetDlgItem (hwndDlg, IDC_PREF_CACHE_PIM)); + openExplorer = IsButtonChecked (GetDlgItem (hwndDlg, IDC_TRAVEL_OPEN_EXPLORER)); + cacheInDriver = IsButtonChecked (GetDlgItem (hwndDlg, IDC_TRAV_CACHE_PASSWORDS)); + includePimInCache = IsButtonChecked (GetDlgItem (hwndDlg, IDC_PREF_CACHE_PIM)); bMountReadOnly = IsButtonChecked (GetDlgItem (hwndDlg, IDC_MOUNT_READONLY)); bAutoRun = !IsButtonChecked (GetDlgItem (hwndDlg, IDC_AUTORUN_DISABLE)); bAutoMount = IsButtonChecked (GetDlgItem (hwndDlg, IDC_AUTORUN_MOUNT)); @@ -4253,112 +4606,361 @@ BOOL CALLBACK TravelerDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa handleWin32Error (hwndDlg, SRC_POS); goto stop; } - // Main app 32-bit - if (Is64BitOs () && !IsNonInstallMode ()) - StringCbPrintfW (srcPath, sizeof(srcPath), L"%s\\VeraCrypt-x86.exe", appDir); - else - StringCbPrintfW (srcPath, sizeof(srcPath), L"%s\\VeraCrypt.exe", appDir); - StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\VeraCrypt.exe", dstDir); - if (!TCCopyFile (srcPath, dstPath)) + if (IsNonInstallMode ()) { - handleWin32Error (hwndDlg, SRC_POS); - goto stop; - } - - // Main app 64-bit - if (Is64BitOs () && !IsNonInstallMode ()) + // Main app 32-bit StringCbPrintfW (srcPath, sizeof(srcPath), L"%s\\VeraCrypt.exe", appDir); - else - StringCbPrintfW (srcPath, sizeof(srcPath), L"%s\\VeraCrypt-x64.exe", appDir); - StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\VeraCrypt-x64.exe", dstDir); - if (!TCCopyFile (srcPath, dstPath)) - { - handleWin32Error (hwndDlg, SRC_POS); - goto stop; - } + StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\VeraCrypt.exe", dstDir); + if (!VerifyModuleSignature (srcPath)) + { + Error ("DIST_PACKAGE_CORRUPTED", hwndDlg); + goto stop; + } + else if (!TCCopyFile (srcPath, dstPath)) + { + handleWin32Error (hwndDlg, SRC_POS); + goto stop; + } - // Wizard - if (copyWizard) - { - // Wizard 32-bit - if (Is64BitOs () && !IsNonInstallMode ()) - StringCbPrintfW (srcPath, sizeof(srcPath), L"%s\\VeraCrypt Format-x86.exe", appDir); - else - StringCbPrintfW (srcPath, sizeof(srcPath), L"%s\\VeraCrypt Format.exe", appDir); - StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\VeraCrypt Format.exe", dstDir); - if (!TCCopyFile (srcPath, dstPath)) + // Main app 64-bit + StringCbPrintfW (srcPath, sizeof(srcPath), L"%s\\VeraCrypt-x64.exe", appDir); + StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\VeraCrypt-x64.exe", dstDir); + if (!VerifyModuleSignature (srcPath)) + { + Error ("DIST_PACKAGE_CORRUPTED", hwndDlg); + goto stop; + } + else if (!TCCopyFile (srcPath, dstPath)) { handleWin32Error (hwndDlg, SRC_POS); goto stop; } - // Wizard 64-bit - if (Is64BitOs () && !IsNonInstallMode ()) + // Main app ARM 64-bit + StringCbPrintfW(srcPath, sizeof(srcPath), L"%s\\VeraCrypt-arm64.exe", appDir); + StringCbPrintfW(dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\VeraCrypt-arm64.exe", dstDir); + if (!VerifyModuleSignature(srcPath)) + { + Error("DIST_PACKAGE_CORRUPTED", hwndDlg); + goto stop; + } + else if (!TCCopyFile(srcPath, dstPath)) + { + handleWin32Error(hwndDlg, SRC_POS); + goto stop; + } + + // Wizard + if (copyWizard) + { + // Wizard 32-bit StringCbPrintfW (srcPath, sizeof(srcPath), L"%s\\VeraCrypt Format.exe", appDir); - else + StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\VeraCrypt Format.exe", dstDir); + if (!VerifyModuleSignature (srcPath)) + { + Error ("DIST_PACKAGE_CORRUPTED", hwndDlg); + goto stop; + } + else if (!TCCopyFile (srcPath, dstPath)) + { + handleWin32Error (hwndDlg, SRC_POS); + goto stop; + } + + // Wizard 64-bit StringCbPrintfW (srcPath, sizeof(srcPath), L"%s\\VeraCrypt Format-x64.exe", appDir); - StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\VeraCrypt Format-x64.exe", dstDir); - if (!TCCopyFile (srcPath, dstPath)) + StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\VeraCrypt Format-x64.exe", dstDir); + if (!VerifyModuleSignature (srcPath)) + { + Error ("DIST_PACKAGE_CORRUPTED", hwndDlg); + goto stop; + } + else if (!TCCopyFile (srcPath, dstPath)) + { + handleWin32Error (hwndDlg, SRC_POS); + goto stop; + } + + // Wizard ARM 64-bit + StringCbPrintfW(srcPath, sizeof(srcPath), L"%s\\VeraCrypt Format-arm64.exe", appDir); + StringCbPrintfW(dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\VeraCrypt Format-arm64.exe", dstDir); + if (!VerifyModuleSignature(srcPath)) + { + Error("DIST_PACKAGE_CORRUPTED", hwndDlg); + goto stop; + } + else if (!TCCopyFile(srcPath, dstPath)) + { + handleWin32Error(hwndDlg, SRC_POS); + goto stop; + } + } + + // Expander + if (copyExpander) + { + // Expander 32-bit + StringCbPrintfW (srcPath, sizeof(srcPath), L"%s\\VeraCryptExpander.exe", appDir); + StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\VeraCryptExpander.exe", dstDir); + if (!VerifyModuleSignature (srcPath)) + { + Error ("DIST_PACKAGE_CORRUPTED", hwndDlg); + goto stop; + } + else if (!TCCopyFile (srcPath, dstPath)) + { + handleWin32Error (hwndDlg, SRC_POS); + goto stop; + } + + // Expander 64-bit + StringCbPrintfW (srcPath, sizeof(srcPath), L"%s\\VeraCryptExpander-x64.exe", appDir); + StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\VeraCryptExpander-x64.exe", dstDir); + if (!VerifyModuleSignature (srcPath)) + { + Error ("DIST_PACKAGE_CORRUPTED", hwndDlg); + goto stop; + } + else if (!TCCopyFile (srcPath, dstPath)) + { + handleWin32Error (hwndDlg, SRC_POS); + goto stop; + } + + // Expander ARM 64-bit + StringCbPrintfW(srcPath, sizeof(srcPath), L"%s\\VeraCryptExpander-arm64.exe", appDir); + StringCbPrintfW(dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\VeraCryptExpander-arm64.exe", dstDir); + if (!VerifyModuleSignature(srcPath)) + { + Error("DIST_PACKAGE_CORRUPTED", hwndDlg); + goto stop; + } + else if (!TCCopyFile(srcPath, dstPath)) + { + handleWin32Error(hwndDlg, SRC_POS); + goto stop; + } + } + + // Driver + StringCbPrintfW (srcPath, sizeof(srcPath), L"%s\\veracrypt.sys", appDir); + StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\veracrypt.sys", dstDir); + if (!VerifyModuleSignature (srcPath)) + { + Error ("DIST_PACKAGE_CORRUPTED", hwndDlg); + goto stop; + } + else if (!TCCopyFile (srcPath, dstPath)) { handleWin32Error (hwndDlg, SRC_POS); goto stop; } - } - // Expander - if (copyExpander) - { - // Expander 32-bit - if (Is64BitOs () && !IsNonInstallMode ()) - StringCbPrintfW (srcPath, sizeof(srcPath), L"%s\\VeraCryptExpander-x86.exe", appDir); - else - StringCbPrintfW (srcPath, sizeof(srcPath), L"%s\\VeraCryptExpander.exe", appDir); - StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\VeraCryptExpander.exe", dstDir); - if (!TCCopyFile (srcPath, dstPath)) + // Driver x64 + StringCbPrintfW (srcPath, sizeof(srcPath), L"%s\\veracrypt-x64.sys", appDir); + StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\veracrypt-x64.sys", dstDir); + if (!VerifyModuleSignature (srcPath)) + { + Error ("DIST_PACKAGE_CORRUPTED", hwndDlg); + goto stop; + } + else if (!TCCopyFile (srcPath, dstPath)) { handleWin32Error (hwndDlg, SRC_POS); goto stop; } - // Expander 64-bit - if (Is64BitOs () && !IsNonInstallMode ()) - StringCbPrintfW (srcPath, sizeof(srcPath), L"%s\\VeraCryptExpander.exe", appDir); - else - StringCbPrintfW (srcPath, sizeof(srcPath), L"%s\\VeraCryptExpander-x64.exe", appDir); - StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\VeraCryptExpander-x64.exe", dstDir); - if (!TCCopyFile (srcPath, dstPath)) + // Driver ARM64 + StringCbPrintfW(srcPath, sizeof(srcPath), L"%s\\veracrypt-arm64.sys", appDir); + StringCbPrintfW(dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\veracrypt-arm64.sys", dstDir); + if (!VerifyModuleSignature(srcPath)) { - handleWin32Error (hwndDlg, SRC_POS); + Error("DIST_PACKAGE_CORRUPTED", hwndDlg); + goto stop; + } + else if (!TCCopyFile(srcPath, dstPath)) + { + handleWin32Error(hwndDlg, SRC_POS); goto stop; } } - - // Driver - StringCbPrintfW (srcPath, sizeof(srcPath), L"%s\\veracrypt.sys", appDir); - StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\veracrypt.sys", dstDir); - if (!TCCopyFile (srcPath, dstPath)) + else { - handleWin32Error (hwndDlg, SRC_POS); - goto stop; - } + int fileNo = 0; + BOOL bMsiX64Case = FALSE; + // get file from the Setup binary after checking its signature and its version + StringCbPrintfW (srcPath, sizeof(srcPath), L"%s\\VeraCrypt COMReg.exe", appDir); // MSI installation case + if (FileExists(srcPath)) + { + bMsiX64Case = TRUE; + } + else + StringCbPrintfW (srcPath, sizeof(srcPath), L"%s\\VeraCrypt Setup.exe", appDir); // EXE installation case - // Driver x64 - StringCbPrintfW (srcPath, sizeof(srcPath), L"%s\\veracrypt-x64.sys", appDir); - StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\veracrypt-x64.sys", dstDir); - if (!TCCopyFile (srcPath, dstPath)) - { - handleWin32Error (hwndDlg, SRC_POS); - goto stop; + FreeAllFileBuffers (); + + if (!VerifyPackageIntegrity (srcPath) || !SelfExtractInMemory (srcPath, TRUE) || (!bMsiX64Case && (Decompressed_Files_Count != NBR_COMPRESSED_FILES))) + { + MessageBoxW (hwndDlg, GetString ("DIST_PACKAGE_CORRUPTED"), lpszTitle, MB_ICONEXCLAMATION); + goto stop; + } + + for (fileNo = 0; fileNo < Decompressed_Files_Count; fileNo++) + { + wchar_t fileName [TC_MAX_PATH] = {0}; + + // Filename + StringCchCopyNW (fileName, ARRAYSIZE(fileName), Decompressed_Files[fileNo].fileName, Decompressed_Files[fileNo].fileNameLength); + + if (wcscmp (fileName, L"VeraCrypt.exe") == 0) + { + StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\VeraCrypt.exe", dstDir); + } + else if (wcscmp (fileName, L"VeraCrypt-x64.exe") == 0) + { + StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\VeraCrypt-x64.exe", dstDir); + } + else if (wcscmp(fileName, L"VeraCrypt-arm64.exe") == 0) + { + StringCbPrintfW(dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\VeraCrypt-arm64.exe", dstDir); + } + else if (wcscmp (fileName, L"veracrypt.sys") == 0) + { + StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\veracrypt.sys", dstDir); + } + else if (wcscmp (fileName, L"veracrypt-x64.sys") == 0) + { + StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\veracrypt-x64.sys", dstDir); + } + else if (wcscmp(fileName, L"veracrypt-arm64.sys") == 0) + { + StringCbPrintfW(dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\veracrypt-arm64.sys", dstDir); + } + else if (copyWizard && (wcscmp (fileName, L"VeraCrypt Format.exe") == 0)) + { + StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\VeraCrypt Format.exe", dstDir); + } + else if (copyWizard && (wcscmp (fileName, L"VeraCrypt Format-x64.exe") == 0)) + { + StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\VeraCrypt Format-x64.exe", dstDir); + } + else if (copyWizard && (wcscmp(fileName, L"VeraCrypt Format-arm64.exe") == 0)) + { + StringCbPrintfW(dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\VeraCrypt Format-arm64.exe", dstDir); + } + else if (copyExpander && (wcscmp (fileName, L"VeraCryptExpander.exe") == 0)) + { + StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\VeraCryptExpander.exe", dstDir); + } + else if (copyExpander && (wcscmp (fileName, L"VeraCryptExpander-x64.exe") == 0)) + { + StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\VeraCryptExpander-x64.exe", dstDir); + } + else if (copyExpander && (wcscmp(fileName, L"VeraCryptExpander-arm64.exe") == 0)) + { + StringCbPrintfW(dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\VeraCryptExpander-arm64.exe", dstDir); + } + else + continue; + + if (!SaveBufferToFile ( + (char *) Decompressed_Files[fileNo].fileContent, + dstPath, + Decompressed_Files[fileNo].fileLength, + FALSE, FALSE)) + { + wchar_t szTmp[512]; + + StringCbPrintfW (szTmp, sizeof (szTmp), GetString ("CANNOT_WRITE_FILE_X"), dstPath); + MessageBoxW (hwndDlg, szTmp, lpszTitle, MB_ICONERROR | MB_SETFOREGROUND | MB_TOPMOST); + goto stop; + } + } + + if (bMsiX64Case) + { + // Main app + StringCbPrintfW (srcPath, sizeof(srcPath), L"%s\\VeraCrypt.exe", appDir); + StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\VeraCrypt-x64.exe", dstDir); + if (!VerifyModuleSignature (srcPath)) + { + Error ("DIST_PACKAGE_CORRUPTED", hwndDlg); + goto stop; + } + else if (!TCCopyFile (srcPath, dstPath)) + { + handleWin32Error (hwndDlg, SRC_POS); + goto stop; + } + + // Wizard + if (copyWizard) + { + StringCbPrintfW (srcPath, sizeof(srcPath), L"%s\\VeraCrypt Format.exe", appDir); + StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\VeraCrypt Format-x64.exe", dstDir); + if (!VerifyModuleSignature (srcPath)) + { + Error ("DIST_PACKAGE_CORRUPTED", hwndDlg); + goto stop; + } + else if (!TCCopyFile (srcPath, dstPath)) + { + handleWin32Error (hwndDlg, SRC_POS); + goto stop; + } + } + + // Expander + if (copyExpander) + { + StringCbPrintfW (srcPath, sizeof(srcPath), L"%s\\VeraCryptExpander.exe", appDir); + StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\VeraCryptExpander-x64.exe", dstDir); + if (!VerifyModuleSignature (srcPath)) + { + Error ("DIST_PACKAGE_CORRUPTED", hwndDlg); + goto stop; + } + else if (!TCCopyFile (srcPath, dstPath)) + { + handleWin32Error (hwndDlg, SRC_POS); + goto stop; + } + } + + // Driver + StringCbPrintfW (srcPath, sizeof(srcPath), L"%s\\veracrypt.sys", appDir); + StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\veracrypt-x64.sys", dstDir); + if (!VerifyModuleSignature (srcPath)) + { + Error ("DIST_PACKAGE_CORRUPTED", hwndDlg); + goto stop; + } + else if (!TCCopyFile (srcPath, dstPath)) + { + handleWin32Error (hwndDlg, SRC_POS); + goto stop; + } + } } if (strcmp (GetPreferredLangId (), "en") != 0) { // Language pack - StringCbPrintfW (srcPath, sizeof(srcPath), L"%s\\Language.%hs.xml", appDir, GetPreferredLangId ()); - StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\Language.%hs.xml", dstDir, GetPreferredLangId ()); - TCCopyFile (srcPath, dstPath); + StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\Languages", dstDir); + if (!CreateDirectoryW (dstPath, NULL)) + { + handleWin32Error (hwndDlg, SRC_POS); + goto stop; + } + StringCbPrintfW (srcPath, sizeof(srcPath), L"%s\\Languages\\Language.%hs.xml", appDir, GetPreferredLangId ()); + StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\Languages\\Language.%hs.xml", dstDir, GetPreferredLangId ()); + if (!TCCopyFile (srcPath, dstPath)) + { + handleWin32Error (hwndDlg, SRC_POS); + goto stop; + } } // AutoRun StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\autorun.inf", dstDir); @@ -4378,10 +4980,10 @@ BOOL CALLBACK TravelerDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa } StringCbPrintfW (autoMount, sizeof(autoMount), L"VeraCrypt\\VeraCrypt.exe /q background%s%s%s%s /m rm /v %s", drive > 0 ? driveLetter : L"", - bExplore ? L" /e" : L"", - bCacheInDriver ? (bIncludePimInCache? L" /c p" : L" /c y") : L"", + openExplorer ? L" /e" : L"", + cacheInDriver ? (includePimInCache? L" /c p" : L" /c y") : L"", bMountReadOnly ? L" /m ro" : L"", volName); fwprintf (af, L"[autorun]\nlabel=%s\nicon=VeraCrypt\\VeraCrypt.exe\n", GetString ("TC_TRAVELER_DISK")); @@ -4395,8 +4997,9 @@ BOOL CALLBACK TravelerDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa } MessageBoxW (hwndDlg, GetString ("TRAVELER_DISK_CREATED"), lpszTitle, MB_ICONINFORMATION); stop: + FreeAllFileBuffers (); NormalCursor (); return 1; } return 0; @@ -4530,9 +5133,9 @@ LPARAM GetItemLong (HWND hTree, int itemNo) else return item.lParam; } -static int AskVolumePassword (HWND hwndDlg, Password *password, int *pkcs5, int *pim, BOOL* truecryptMode, char *titleStringId, BOOL enableMountOptions) +static int AskVolumePassword (HWND hwndDlg, Password *password, int *pkcs5, int *pim, char *titleStringId, BOOL enableMountOptions) { INT_PTR result; PasswordDlgParam dlgParam; @@ -4541,9 +5144,8 @@ static int AskVolumePassword (HWND hwndDlg, Password *password, int *pkcs5, int dlgParam.password = password; dlgParam.pkcs5 = pkcs5; dlgParam.pim = pim; - dlgParam.truecryptMode = truecryptMode; result = SecureDesktopDialogBoxParam (hInst, MAKEINTRESOURCEW (IDD_PASSWORD_DLG), hwndDlg, (DLGPROC) PasswordDlgProc, (LPARAM) &dlgParam); @@ -4552,9 +5154,8 @@ static int AskVolumePassword (HWND hwndDlg, Password *password, int *pkcs5, int { password->Length = 0; *pkcs5 = 0; *pim = -1; - *truecryptMode = FALSE; burn (&mountOptions.ProtectedHidVolPassword, sizeof (mountOptions.ProtectedHidVolPassword)); burn (&mountOptions.ProtectedHidVolPkcs5Prf, sizeof (mountOptions.ProtectedHidVolPkcs5Prf)); } @@ -4562,14 +5163,13 @@ static int AskVolumePassword (HWND hwndDlg, Password *password, int *pkcs5, int } // GUI actions -static BOOL Mount (HWND hwndDlg, int nDosDriveNo, wchar_t *szFileName, int pim, int pkcs5, int trueCryptMode) +static BOOL Mount (HWND hwndDlg, int nDosDriveNo, wchar_t *szVolFileName, int pim, int pkcs5) { BOOL status = FALSE; wchar_t fileName[MAX_PATH]; int mounted = 0, EffectiveVolumePkcs5 = 0; - BOOL EffectiveVolumeTrueCryptMode = FALSE; int EffectiveVolumePim = (pim < 0)? CmdVolumePim : pim; BOOL bEffectiveCacheDuringMultipleMount = bCmdCacheDuringMultipleMount? TRUE: bCacheDuringMultipleMount; BOOL bEffectiveTryEmptyPasswordWhenKeyfileUsed = bCmdTryEmptyPasswordWhenKeyfileUsedValid? bCmdTryEmptyPasswordWhenKeyfileUsed : bTryEmptyPasswordWhenKeyfileUsed; BOOL bUseCmdVolumePassword = CmdVolumePasswordValid && ((CmdVolumePassword.Length > 0) || (KeyFilesEnable && FirstKeyFile)); @@ -4583,25 +5183,8 @@ static BOOL Mount (HWND hwndDlg, int nDosDriveNo, wchar_t *szFileName, int pim, EffectiveVolumePkcs5 = CmdVolumePkcs5; else EffectiveVolumePkcs5 = DefaultVolumePkcs5; - if (trueCryptMode >= 0) - EffectiveVolumeTrueCryptMode = (trueCryptMode == 0)? FALSE : TRUE; - else if (CmdVolumeTrueCryptMode) - EffectiveVolumeTrueCryptMode = TRUE; - else - EffectiveVolumeTrueCryptMode = DefaultVolumeTrueCryptMode; - - if (EffectiveVolumeTrueCryptMode) - { - /* No PIM Mode if TrueCrypt Mode specified */ - EffectiveVolumePim = 0; - - /* valdate the effective PRF is compatible with TrueCrypt Mode */ - if (!is_pkcs5_prf_supported (EffectiveVolumePkcs5, TRUE, mountOptions.PartitionInInactiveSysEncScope? PRF_BOOT_MBR : PRF_BOOT_NO)) - EffectiveVolumePkcs5 = 0; - } - bPrebootPasswordDlgMode = mountOptions.PartitionInInactiveSysEncScope; if (nDosDriveNo == -1) nDosDriveNo = HIWORD (GetSelectedLong (GetDlgItem (MainDlg, IDC_DRIVELIST))) - L'A'; @@ -4609,18 +5192,17 @@ static BOOL Mount (HWND hwndDlg, int nDosDriveNo, wchar_t *szFileName, int pim, if (!MultipleMountOperationInProgress) { VolumePassword.Length = 0; VolumePkcs5 = 0; - VolumeTrueCryptMode = FALSE; VolumePim = -1; } - if (szFileName == NULL) + if (szVolFileName == NULL) { GetVolumePath (hwndDlg, fileName, ARRAYSIZE (fileName)); } else - StringCchCopyW (fileName, ARRAYSIZE (fileName), szFileName); + StringCchCopyW (fileName, ARRAYSIZE (fileName), szVolFileName); if (wcslen(fileName) == 0) { status = FALSE; @@ -4632,18 +5214,18 @@ static BOOL Mount (HWND hwndDlg, int nDosDriveNo, wchar_t *szFileName, int pim, status = FALSE; goto ret; } - szFileName = fileName; + szVolFileName = fileName; - if (IsMountedVolume (szFileName)) + if (IsMountedVolume (szVolFileName)) { Warning ("VOL_ALREADY_MOUNTED", hwndDlg); status = FALSE; goto ret; } - if (!VolumePathExists (szFileName)) + if (!VolumePathExists (szVolFileName)) { if (!MultipleMountOperationInProgress) handleWin32Error (hwndDlg, SRC_POS); @@ -4657,46 +5239,37 @@ static BOOL Mount (HWND hwndDlg, int nDosDriveNo, wchar_t *szFileName, int pim, if (!bUseCmdVolumePassword) { // First try cached passwords and if they fail ask user for a new one - if (EffectiveVolumeTrueCryptMode) - mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, NULL, EffectiveVolumePkcs5, 0, TRUE, bCacheInDriver, bIncludePimInCache, bForceMount, &mountOptions, Silent, FALSE); - else - mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, NULL, EffectiveVolumePkcs5, EffectiveVolumePim, FALSE, bCacheInDriver, bIncludePimInCache, bForceMount, &mountOptions, Silent, FALSE); + mounted = MountVolume (hwndDlg, nDosDriveNo, szVolFileName, NULL, EffectiveVolumePkcs5, EffectiveVolumePim, bCacheInDriver, bIncludePimInCache, bForceMount, &mountOptions, Silent, FALSE); // If keyfiles are enabled, test empty password first if (!mounted && KeyFilesEnable && FirstKeyFile && bEffectiveTryEmptyPasswordWhenKeyfileUsed) { Password emptyPassword = {0}; - KeyFilesApply (hwndDlg, &emptyPassword, FirstKeyFile, szFileName); + KeyFilesApply (hwndDlg, &emptyPassword, FirstKeyFile, szVolFileName); - if (EffectiveVolumeTrueCryptMode) - mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, &emptyPassword, EffectiveVolumePkcs5, 0, TRUE, bCacheInDriver, bIncludePimInCache, bForceMount, &mountOptions, Silent, FALSE); - else - mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, &emptyPassword, EffectiveVolumePkcs5, EffectiveVolumePim, FALSE, bCacheInDriver, bIncludePimInCache, bForceMount, &mountOptions, Silent, FALSE); + mounted = MountVolume (hwndDlg, nDosDriveNo, szVolFileName, &emptyPassword, EffectiveVolumePkcs5, EffectiveVolumePim, bCacheInDriver, bIncludePimInCache, bForceMount, &mountOptions, Silent, FALSE); burn (&emptyPassword, sizeof (emptyPassword)); } } // Test password and/or keyfiles used for the previous volume if (!mounted && bEffectiveCacheDuringMultipleMount && MultipleMountOperationInProgress && VolumePassword.Length != 0) { - // try TrueCrypt mode first as it is quick, only if no custom pim specified - if (EffectiveVolumeTrueCryptMode) - mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, &VolumePassword, EffectiveVolumePkcs5, 0, TRUE, bCacheInDriver, bIncludePimInCache, bForceMount, &mountOptions, Silent, FALSE); - else - mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, &VolumePassword, EffectiveVolumePkcs5, EffectiveVolumePim, FALSE, bCacheInDriver, bIncludePimInCache, bForceMount, &mountOptions, Silent, FALSE); + // if no PIM specified for favorite, we use also the PIM of the previous volume alongside its password. + mounted = MountVolume (hwndDlg, nDosDriveNo, szVolFileName, &VolumePassword, EffectiveVolumePkcs5, (EffectiveVolumePim < 0)? VolumePim : EffectiveVolumePim, bCacheInDriver, bIncludePimInCache, bForceMount, &mountOptions, Silent, FALSE); } NormalCursor (); if (mounted) { // Check for problematic file extensions (exe, dll, sys) - if (CheckFileExtension(szFileName)) + if (CheckFileExtension(szVolFileName)) Warning ("EXE_FILE_EXTENSION_MOUNT_WARNING", hwndDlg); } while (mounted == 0) @@ -4704,48 +5277,43 @@ static BOOL Mount (HWND hwndDlg, int nDosDriveNo, wchar_t *szFileName, int pim, if (bUseCmdVolumePassword) { VolumePassword = CmdVolumePassword; VolumePkcs5 = EffectiveVolumePkcs5; - VolumeTrueCryptMode = EffectiveVolumeTrueCryptMode; VolumePim = EffectiveVolumePim; } else if (!Silent) { int GuiPkcs5 = EffectiveVolumePkcs5; - BOOL GuiTrueCryptMode = EffectiveVolumeTrueCryptMode; int GuiPim = EffectiveVolumePim; - StringCbCopyW (PasswordDlgVolume, sizeof(PasswordDlgVolume), szFileName); + StringCbCopyW (PasswordDlgVolume, sizeof(PasswordDlgVolume), szVolFileName); - if (!AskVolumePassword (hwndDlg, &VolumePassword, &GuiPkcs5, &GuiPim, &GuiTrueCryptMode, NULL, TRUE)) + if (!AskVolumePassword (hwndDlg, &VolumePassword, &GuiPkcs5, &GuiPim, NULL, TRUE)) goto ret; else { VolumePkcs5 = GuiPkcs5; - VolumeTrueCryptMode = GuiTrueCryptMode; VolumePim = GuiPim; burn (&GuiPkcs5, sizeof(GuiPkcs5)); - burn (&GuiTrueCryptMode, sizeof(GuiTrueCryptMode)); burn (&GuiPim, sizeof(GuiPim)); } } WaitCursor (); if (KeyFilesEnable) - KeyFilesApply (hwndDlg, &VolumePassword, FirstKeyFile, szFileName); + KeyFilesApply (hwndDlg, &VolumePassword, FirstKeyFile, szVolFileName); - mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, &VolumePassword, VolumePkcs5, VolumePim, VolumeTrueCryptMode, bCacheInDriver, bIncludePimInCache, bForceMount, &mountOptions, Silent, !Silent); + mounted = MountVolume (hwndDlg, nDosDriveNo, szVolFileName, &VolumePassword, VolumePkcs5, VolumePim, bCacheInDriver, bIncludePimInCache, bForceMount, &mountOptions, Silent, !Silent); NormalCursor (); // Check for problematic file extensions (exe, dll, sys) - if (mounted > 0 && CheckFileExtension (szFileName)) + if (mounted > 0 && CheckFileExtension (szVolFileName)) Warning ("EXE_FILE_EXTENSION_MOUNT_WARNING", hwndDlg); if (!MultipleMountOperationInProgress) { burn (&VolumePassword, sizeof (VolumePassword)); burn (&VolumePkcs5, sizeof (VolumePkcs5)); - burn (&VolumeTrueCryptMode, sizeof (VolumeTrueCryptMode)); burn (&VolumePim, sizeof (VolumePim)); } burn (&mountOptions.ProtectedHidVolPassword, sizeof (mountOptions.ProtectedHidVolPassword)); @@ -4779,22 +5347,23 @@ ret: if (!MultipleMountOperationInProgress) { burn (&VolumePassword, sizeof (VolumePassword)); burn (&VolumePkcs5, sizeof (VolumePkcs5)); - burn (&VolumeTrueCryptMode, sizeof (VolumeTrueCryptMode)); burn (&VolumePim, sizeof (VolumePim)); } burn (&mountOptions.ProtectedHidVolPassword, sizeof (mountOptions.ProtectedHidVolPassword)); burn (&mountOptions.ProtectedHidVolPkcs5Prf, sizeof (mountOptions.ProtectedHidVolPkcs5Prf)); + mountOptions.SkipCachedPasswords = FALSE; + RestoreDefaultKeyFilesParam (); if (UsePreferences) bCacheInDriver = bCacheInDriverDefault; if (status && CloseSecurityTokenSessionsAfterMount && !MultipleMountOperationInProgress) - SecurityToken::CloseAllSessions(); + SecurityToken::CloseAllSessions(); // TODO Use Token return status; } @@ -4804,9 +5373,16 @@ static BOOL Dismount (HWND hwndDlg, int nDosDriveNo) BOOL status = FALSE; WaitCursor (); if (nDosDriveNo == -2) + { nDosDriveNo = (char) (HIWORD (GetSelectedLong (GetDlgItem (hwndDlg, IDC_DRIVELIST))) - L'A'); + if (nDosDriveNo < 0 || nDosDriveNo >= 26) + { + NormalCursor (); + return FALSE; + } + } if (bCloseDismountedWindows) { CloseVolumeExplorerWindows (hwndDlg, nDosDriveNo); @@ -4818,11 +5394,8 @@ static BOOL Dismount (HWND hwndDlg, int nDosDriveNo) if (bBeep) MessageBeep (0xFFFFFFFF); RefreshMainDlg (hwndDlg); - - if (nCurrentOS == WIN_2000 && RemoteSession && !IsAdmin ()) - LoadDriveLetters (hwndDlg, GetDlgItem (hwndDlg, IDC_DRIVELIST), 0); } NormalCursor (); return status; @@ -4835,9 +5408,9 @@ void __cdecl mountThreadFunction (void *hwndDlgArg) // Disable parent dialog during processing to avoid user interaction EnableWindow(hwndDlg, FALSE); finally_do_arg2 (HWND, hwndDlg, BOOL, bIsForeground, { EnableWindow(finally_arg, TRUE); if (finally_arg2) BringToForeground (finally_arg); bPrebootPasswordDlgMode = FALSE;}); - Mount (hwndDlg, -1, 0, -1, -1, -1); + Mount (hwndDlg, -1, 0, -1, -1); } typedef struct { @@ -4927,14 +5500,14 @@ static BOOL DismountAll (HWND hwndDlg, BOOL forceUnmount, BOOL interact, int dis retry: WaitCursor(); - DeviceIoControl (hDriver, TC_IOCTL_GET_MOUNTED_VOLUMES, &mountList, sizeof (mountList), &mountList, sizeof (mountList), &dwResult, NULL); + status = DeviceIoControl (hDriver, TC_IOCTL_GET_MOUNTED_VOLUMES, &mountList, sizeof (mountList), &mountList, sizeof (mountList), &dwResult, NULL); - if (mountList.ulMountedDrives == 0) + if (!status || (mountList.ulMountedDrives == 0) || (mountList.ulMountedDrives >= (1 << 26))) { NormalCursor(); - return TRUE; + return status && (mountList.ulMountedDrives == 0)? TRUE : FALSE; } BroadcastDeviceChange (DBT_DEVICEREMOVEPENDING, 0, mountList.ulMountedDrives); @@ -4974,26 +5547,29 @@ retry: if (!dismountAllThreadParam.bReturn) return FALSE; memset (&mountList, 0, sizeof (mountList)); - DeviceIoControl (hDriver, TC_IOCTL_GET_MOUNTED_VOLUMES, &mountList, sizeof (mountList), &mountList, sizeof (mountList), &dwResult, NULL); - - // remove any custom label from registry - for (i = 0; i < 26; i++) + if ( DeviceIoControl (hDriver, TC_IOCTL_GET_MOUNTED_VOLUMES, &mountList, sizeof (mountList), &mountList, sizeof (mountList), &dwResult, NULL) + && (mountList.ulMountedDrives < (1 << 26)) + ) { - if ((prevMountList.ulMountedDrives & (1 << i)) && (!(mountList.ulMountedDrives & (1 << i))) && wcslen (prevMountList.wszLabel[i])) + // remove any custom label from registry + if (prevMountList.ulMountedDrives) { - UpdateDriveCustomLabel (i, prevMountList.wszLabel[i], FALSE); + for (i = 0; i < 26; i++) + { + if ((prevMountList.ulMountedDrives & (1 << i)) && (!(mountList.ulMountedDrives & (1 << i))) && IsNullTerminateString (prevMountList.wszLabel[i], 33) && wcslen (prevMountList.wszLabel[i])) + { + UpdateDriveCustomLabel (i, prevMountList.wszLabel[i], FALSE); + } + } } } BroadcastDeviceChange (DBT_DEVICEREMOVECOMPLETE, 0, prevMountList.ulMountedDrives & ~mountList.ulMountedDrives); RefreshMainDlg (hwndDlg); - if (nCurrentOS == WIN_2000 && RemoteSession && !IsAdmin ()) - LoadDriveLetters (hwndDlg, GetDlgItem (hwndDlg, IDC_DRIVELIST), 0); - NormalCursor(); if (unmount.nReturnCode != 0) { @@ -5007,27 +5583,28 @@ retry: forceUnmount = TRUE; goto retry; } - if (IsOSAtLeast (WIN_7)) + // Undo SHCNE_DRIVEREMOVED + if ( DeviceIoControl (hDriver, TC_IOCTL_GET_MOUNTED_VOLUMES, NULL, 0, &mountList, sizeof (mountList), &dwResult, NULL) + && mountList.ulMountedDrives + && (mountList.ulMountedDrives < (1 << 26)) + ) { - // Undo SHCNE_DRIVEREMOVED - DeviceIoControl (hDriver, TC_IOCTL_GET_MOUNTED_VOLUMES, NULL, 0, &mountList, sizeof (mountList), &dwResult, NULL); - for (i = 0; i < 26; i++) { if (mountList.ulMountedDrives & (1 << i)) { - wchar_t root[] = { (wchar_t) i + L'A', L':', L'\\', 0 }; + wchar_t root[] = { (wchar_t) (i + L'A'), L':', L'\\', 0 }; SHChangeNotify (SHCNE_DRIVEADD, SHCNF_PATH, root, NULL); } } } return FALSE; } - if (interact) + if (interact && !Silent) MessageBoxW (hwndDlg, GetString ("UNMOUNT_FAILED"), lpszTitle, MB_ICONERROR); } else { @@ -5045,20 +5622,18 @@ static BOOL MountAllDevicesThreadCode (HWND hwndDlg, BOOL bPasswordPrompt) BOOL shared = FALSE, status = FALSE, bHeaderBakRetry = FALSE; int mountedVolCount = 0; vector <HostDevice> devices; int EffectiveVolumePkcs5 = CmdVolumePkcs5; - BOOL EffectiveVolumeTrueCryptMode = CmdVolumeTrueCryptMode; /* Priority is given to command line parameters * Default values used only when nothing specified in command line */ if (EffectiveVolumePkcs5 == 0) EffectiveVolumePkcs5 = DefaultVolumePkcs5; - if (!EffectiveVolumeTrueCryptMode) - EffectiveVolumeTrueCryptMode = DefaultVolumeTrueCryptMode; VolumePassword.Length = 0; mountOptions = defaultMountOptions; + mountOptions.SkipCachedPasswords = FALSE; bPrebootPasswordDlgMode = FALSE; VolumePim = -1; if (selDrive == -1) @@ -5074,29 +5649,25 @@ static BOOL MountAllDevicesThreadCode (HWND hwndDlg, BOOL bPasswordPrompt) { if (!CmdVolumePasswordValid && bPasswordPrompt) { int GuiPkcs5 = EffectiveVolumePkcs5; - BOOL GuiTrueCryptMode = EffectiveVolumeTrueCryptMode; int GuiPim = CmdVolumePim; PasswordDlgVolume[0] = '\0'; - if (!AskVolumePassword (hwndDlg, &VolumePassword, &GuiPkcs5, &GuiPim, &GuiTrueCryptMode, NULL, TRUE)) + if (!AskVolumePassword (hwndDlg, &VolumePassword, &GuiPkcs5, &GuiPim, NULL, TRUE)) goto ret; else { VolumePkcs5 = GuiPkcs5; - VolumeTrueCryptMode = GuiTrueCryptMode; VolumePim = GuiPim; burn (&GuiPkcs5, sizeof(GuiPkcs5)); - burn (&GuiTrueCryptMode, sizeof(GuiTrueCryptMode)); burn (&GuiPim, sizeof(GuiPim)); } } else if (CmdVolumePasswordValid) { bPasswordPrompt = FALSE; VolumePassword = CmdVolumePassword; VolumePkcs5 = EffectiveVolumePkcs5; - VolumeTrueCryptMode = EffectiveVolumeTrueCryptMode; VolumePim = CmdVolumePim; } WaitCursor(); @@ -5114,13 +5685,13 @@ static BOOL MountAllDevicesThreadCode (HWND hwndDlg, BOOL bPasswordPrompt) { vector <HostDevice> partitions = drive.Partitions; partitions.insert (partitions.begin(), drive); - foreach (const HostDevice &device, partitions) + for (const HostDevice &device: partitions) { - wchar_t szFileName[TC_MAX_PATH]; - StringCbCopyW (szFileName, sizeof (szFileName), device.Path.c_str()); - BOOL mounted = IsMountedVolume (szFileName); + wchar_t szPartPath[TC_MAX_PATH]; + StringCbCopyW (szPartPath, sizeof (szPartPath), device.Path.c_str()); + BOOL mounted = IsMountedVolume (szPartPath); // Skip other partitions of the disk if partition0 (whole disk) is mounted if (!device.IsPartition && mounted) break; @@ -5178,10 +5749,10 @@ static BOOL MountAllDevicesThreadCode (HWND hwndDlg, BOOL bPasswordPrompt) goto ret; } // First try user password then cached passwords - if ((mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, &VolumePassword, VolumePkcs5, VolumePim, VolumeTrueCryptMode, bCacheInDriver, bIncludePimInCache, bForceMount, &mountOptions, TRUE, FALSE)) > 0 - || ((VolumePassword.Length > 0) && ((mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, NULL, VolumePkcs5, VolumePim, VolumeTrueCryptMode, bCacheInDriver, bIncludePimInCache, bForceMount, &mountOptions, TRUE, FALSE)) > 0))) + if ((mounted = MountVolume (hwndDlg, nDosDriveNo, szPartPath, &VolumePassword, VolumePkcs5, VolumePim, bCacheInDriver, bIncludePimInCache, bForceMount, &mountOptions, TRUE, FALSE)) > 0 + || ((VolumePassword.Length > 0) && ((mounted = MountVolume (hwndDlg, nDosDriveNo, szPartPath, NULL, VolumePkcs5, VolumePim, bCacheInDriver, bIncludePimInCache, bForceMount, &mountOptions, TRUE, FALSE)) > 0))) { // A volume has been successfully mounted ResetWrongPwdRetryCount (); @@ -5258,9 +5829,8 @@ static BOOL MountAllDevicesThreadCode (HWND hwndDlg, BOOL bPasswordPrompt) if (!bHeaderBakRetry) { burn (&VolumePassword, sizeof (VolumePassword)); burn (&VolumePkcs5, sizeof (VolumePkcs5)); - burn (&VolumeTrueCryptMode, sizeof (VolumeTrueCryptMode)); burn (&VolumePim, sizeof (VolumePim)); burn (&mountOptions.ProtectedHidVolPassword, sizeof (mountOptions.ProtectedHidVolPassword)); burn (&mountOptions.ProtectedHidVolPkcs5Prf, sizeof (mountOptions.ProtectedHidVolPkcs5Prf)); } @@ -5282,16 +5852,15 @@ static BOOL MountAllDevicesThreadCode (HWND hwndDlg, BOOL bPasswordPrompt) Info ("HIDVOL_PROT_WARN_AFTER_MOUNT", hwndDlg); } if (status && CloseSecurityTokenSessionsAfterMount) - SecurityToken::CloseAllSessions(); + SecurityToken::CloseAllSessions(); // TODO Use Token ret: MultipleMountOperationInProgress = FALSE; burn (&VolumePassword, sizeof (VolumePassword)); burn (&VolumePkcs5, sizeof (VolumePkcs5)); - burn (&VolumeTrueCryptMode, sizeof (VolumeTrueCryptMode)); burn (&VolumePim, sizeof (VolumePim)); burn (&mountOptions.ProtectedHidVolPassword, sizeof (mountOptions.ProtectedHidVolPassword)); burn (&mountOptions.ProtectedHidVolPkcs5Prf, sizeof (mountOptions.ProtectedHidVolPkcs5Prf)); @@ -5328,9 +5897,12 @@ static BOOL MountAllDevices (HWND hwndDlg, BOOL bPasswordPrompt) MountAllDevicesThreadParam param; param.bPasswordPrompt = bPasswordPrompt; param.bRet = FALSE; - ShowWaitDialog (hwndDlg, FALSE, mountAllDevicesThreadProc, ¶m); + if (Silent) + mountAllDevicesThreadProc (¶m, hwndDlg); + else + ShowWaitDialog (hwndDlg, FALSE, mountAllDevicesThreadProc, ¶m); return param.bRet; } @@ -5449,9 +6021,12 @@ static void ChangeSysEncPassword (HWND hwndDlg, BOOL bOnlyChangeKDF) } if (CreateSysEncMutex ()) // If no instance of the wizard is currently taking care of system encryption { - StringCbPrintfW (OrigKeyboardLayout, sizeof(OrigKeyboardLayout), L"%08X", (DWORD) GetKeyboardLayout (NULL) & 0xFFFF); + if (!GetKeyboardLayoutNameW(OrigKeyboardLayout)) + { + StringCbPrintfW(OrigKeyboardLayout, sizeof(OrigKeyboardLayout), L"%08X", (DWORD)(DWORD_PTR)GetKeyboardLayout(NULL) & 0xFFFF); + } bSysEncPwdChangeDlgMode = TRUE; if (bOnlyChangeKDF) @@ -5718,10 +6293,8 @@ static void DecryptNonSysDevice (HWND hwndDlg, BOOL bResolveAmbiguousSelection, DecryptSystemDevice (hwndDlg); return; } - WaitCursor(); - // Make sure the user is not attempting to decrypt a partition on an entirely encrypted system drive. if (IsNonSysPartitionOnSysDrive (scPath.c_str ()) == 1) { if (WholeSysDriveEncryption (TRUE)) @@ -5737,10 +6310,8 @@ static void DecryptNonSysDevice (HWND hwndDlg, BOOL bResolveAmbiguousSelection, else if (TCBootLoaderOnInactiveSysEncDrive ((wchar_t *) scPath.c_str ())) { // The system drive MAY be entirely encrypted (external access without PBA) and the potentially encrypted OS is not running - NormalCursor (); - Warning ("CANT_DECRYPT_PARTITION_ON_ENTIRELY_ENCRYPTED_SYS_DRIVE_UNSURE", hwndDlg); // We allow the user to continue as we don't know if the drive is really an encrypted system drive. // If it is, the user has been warned and he will not be able to start decrypting, because the @@ -5967,8 +6538,16 @@ static void ShowSystemEncryptionStatus (HWND hwndDlg) if (GetAsyncKeyState (VK_SHIFT) < 0 && GetAsyncKeyState (VK_CONTROL) < 0) { // Ctrl+Shift held (for debugging purposes) + int64 encryptedRatio = 0; + if (BootEncStatus.DriveEncrypted + && (BootEncStatus.ConfiguredEncryptedAreaStart >= 0) + && (BootEncStatus.ConfiguredEncryptedAreaEnd >= BootEncStatus.ConfiguredEncryptedAreaStart) + ) + { + encryptedRatio = (BootEncStatus.EncryptedAreaEnd + 1 - BootEncStatus.EncryptedAreaStart) * 100I64 / (BootEncStatus.ConfiguredEncryptedAreaEnd + 1 - BootEncStatus.ConfiguredEncryptedAreaStart); + } DebugMsgBox ("Debugging information for system encryption:\n\nDeviceFilterActive: %d\nBootLoaderVersion: %x\nSetupInProgress: %d\nSetupMode: %d\nVolumeHeaderPresent: %d\nDriveMounted: %d\nDriveEncrypted: %d\n" "HiddenSystem: %d\nHiddenSystemPartitionStart: %I64d\n" "ConfiguredEncryptedAreaStart: %I64d\nConfiguredEncryptedAreaEnd: %I64d\nEncryptedAreaStart: %I64d\nEncryptedAreaEnd: %I64d\nEncrypted: %I64d%%", @@ -5984,9 +6563,9 @@ static void ShowSystemEncryptionStatus (HWND hwndDlg) BootEncStatus.ConfiguredEncryptedAreaStart, BootEncStatus.ConfiguredEncryptedAreaEnd, BootEncStatus.EncryptedAreaStart, BootEncStatus.EncryptedAreaEnd, - !BootEncStatus.DriveEncrypted ? 0 : (BootEncStatus.EncryptedAreaEnd + 1 - BootEncStatus.EncryptedAreaStart) * 100I64 / (BootEncStatus.ConfiguredEncryptedAreaEnd + 1 - BootEncStatus.ConfiguredEncryptedAreaStart)); + encryptedRatio); } if (!BootEncStatus.DriveEncrypted && !BootEncStatus.DriveMounted) { @@ -6009,9 +6588,9 @@ static void ResumeInterruptedNonSysInplaceEncProcess (BOOL bDecrypt) } BOOL SelectContainer (HWND hwndDlg) { - if (BrowseFiles (hwndDlg, "OPEN_VOL_TITLE", szFileName, bHistory, FALSE, NULL) == FALSE) + if (BrowseFiles (hwndDlg, "OPEN_VOL_TITLE", szFileName, bHistory, FALSE) == FALSE) return FALSE; AddComboItem (GetDlgItem (hwndDlg, IDC_VOLUME), szFileName, bHistory); EnableDisableButtons (hwndDlg); @@ -6065,14 +6644,17 @@ static void Benchmark (HWND hwndDlg) static BOOL CheckMountList (HWND hwndDlg, BOOL bForceTaskBarUpdate) { - MOUNT_LIST_STRUCT current; + MOUNT_LIST_STRUCT current = {0}; static BootEncryptionStatus newBootEncStatus; static BOOL lastbUseDifferentTrayIconIfVolMounted = bUseDifferentTrayIconIfVolMounted; static uint32 lastUlMountedDrives = 0; - GetMountList (¤t); + if (!GetMountList (¤t)) + { + return bForceTaskBarUpdate; + } if ((bForceTaskBarUpdate || current.ulMountedDrives != lastUlMountedDrives || bUseDifferentTrayIconIfVolMounted != lastbUseDifferentTrayIconIfVolMounted) && TaskBarIconMutex != NULL) { @@ -6337,14 +6919,14 @@ void DisplayDriveListContextMenu (HWND hwndDlg, LPARAM lParam) switch (menuItem) { case IDPM_SELECT_FILE_AND_MOUNT: if (SelectContainer (hwndDlg)) - MountSelectedVolume (hwndDlg, FALSE); + MountSelectedVolume (hwndDlg, FALSE, FALSE); break; case IDPM_SELECT_DEVICE_AND_MOUNT: if (SelectPartition (hwndDlg)) - MountSelectedVolume (hwndDlg, FALSE); + MountSelectedVolume (hwndDlg, FALSE, FALSE); break; case IDPM_CHECK_FILESYS: case IDPM_REPAIR_FILESYS: @@ -6394,8 +6976,9 @@ void DisplayDriveListContextMenu (HWND hwndDlg, LPARAM lParam) } else { mountOptions = defaultMountOptions; + mountOptions.SkipCachedPasswords = FALSE; bPrebootPasswordDlgMode = FALSE; if (CheckMountList (hwndDlg, FALSE)) _beginthread(mountThreadFunction, 0, hwndDlg); @@ -6417,8 +7000,43 @@ void DisplayDriveListContextMenu (HWND hwndDlg, LPARAM lParam) break; } } +// broadcast signal to WAITFOR.EXE MailSlot to notify any waiting instance that we are exiting +static void SignalExitCode (int exitCode) +{ + if (ExitMailSlotSpecified) + { + HANDLE hFile; + hFile = CreateFile (ExitMailSlotName, + GENERIC_WRITE, + FILE_SHARE_READ, + (LPSECURITY_ATTRIBUTES) NULL, + OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, + (HANDLE) NULL); + if ((hFile == INVALID_HANDLE_VALUE) && (GetLastError () == ERROR_FILE_NOT_FOUND)) + { + // MailSlot not found, wait 1 second and try again in case we exited too quickly + Sleep (1000); + hFile = CreateFile (ExitMailSlotName, + GENERIC_WRITE, + FILE_SHARE_READ, + (LPSECURITY_ATTRIBUTES) NULL, + OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, + (HANDLE) NULL); + } + if (hFile != INVALID_HANDLE_VALUE) + { + char szMsg[64]; + DWORD cbWritten; + StringCbPrintfA (szMsg, sizeof (szMsg), "VeraCrypt Exit %d", exitCode); + WriteFile(hFile, szMsg, (DWORD) (strlen (szMsg) +1), &cbWritten, (LPOVERLAPPED) NULL); + CloseHandle (hFile); + } + } +} /* Except in response to the WM_INITDIALOG and WM_ENDSESSION messages, the dialog box procedure should return nonzero if it processes a message, and zero if it does not. */ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) @@ -6447,13 +7065,17 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa bPreserveTimestamp = defaultMountOptions.PreserveTimestamp = TRUE; bShowDisconnectedNetworkDrives = FALSE; bHideWaitingDialog = FALSE; bUseSecureDesktop = FALSE; + bUseLegacyMaxPasswordLength = FALSE; ResetWrongPwdRetryCount (); ExtractCommandLine (hwndDlg, (wchar_t *) lParam); + if (Silent && !Quit) + Silent = FALSE; + try { BootEncObj->SetParentWindow (hwndDlg); BootEncStatus = BootEncObj->GetStatus(); @@ -6477,11 +7099,27 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa { // General preferences LoadSettings (hwndDlg); + // Save language to XML configuration file if it has been selected in the setup + // so that other VeraCrypt programs will pick it up + if (bLanguageSetInSetup) + SaveSettings (hwndDlg); + + // Keyfiles LoadDefaultKeyFilesParam (); RestoreDefaultKeyFilesParam (); + + // if maximum password length is set to legacy value, abort if password in command line is longer + if (bUseLegacyMaxPasswordLength && CmdVolumePasswordValid && (CmdVolumePassword.Length > MAX_LEGACY_PASSWORD)) + AbortProcess ("COMMAND_LINE_ERROR"); + } + + if (EnableMemoryProtection) + { + /* Protect this process memory from being accessed by non-admin users */ + ActivateMemoryProtection (); } if (ComServerMode) { @@ -6567,9 +7205,8 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa else if (szFileName[0] != 0 && !IsMountedVolume (szFileName)) { BOOL mounted = FALSE; int EffectiveVolumePkcs5 = CmdVolumePkcs5; - BOOL EffectiveVolumeTrueCryptMode = CmdVolumeTrueCryptMode; BOOL bEffectiveTryEmptyPasswordWhenKeyfileUsed = bCmdTryEmptyPasswordWhenKeyfileUsedValid? bCmdTryEmptyPasswordWhenKeyfileUsed : bTryEmptyPasswordWhenKeyfileUsed; if (!VolumePathExists (szFileName)) { @@ -6581,10 +7218,8 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa * Default values used only when nothing specified in command line */ if (EffectiveVolumePkcs5 == 0) EffectiveVolumePkcs5 = DefaultVolumePkcs5; - if (!EffectiveVolumeTrueCryptMode) - EffectiveVolumeTrueCryptMode = DefaultVolumeTrueCryptMode; // Command line password or keyfiles if (CmdVolumePassword.Length != 0 || (FirstCmdKeyFile && (CmdVolumePasswordValid || bEffectiveTryEmptyPasswordWhenKeyfileUsed))) { @@ -6593,58 +7228,54 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa if (FirstCmdKeyFile) KeyFilesApply (hwndDlg, &CmdVolumePassword, FirstCmdKeyFile, szFileName); mounted = MountVolume (hwndDlg, szDriveLetter[0] - L'A', - szFileName, &CmdVolumePassword, EffectiveVolumePkcs5, CmdVolumePim, EffectiveVolumeTrueCryptMode, bCacheInDriver, bIncludePimInCache, bForceMount, + szFileName, &CmdVolumePassword, EffectiveVolumePkcs5, CmdVolumePim, bCacheInDriver, bIncludePimInCache, bForceMount, &mountOptions, Silent, reportBadPasswd); burn (&CmdVolumePassword, sizeof (CmdVolumePassword)); } else { // Cached password - mounted = MountVolume (hwndDlg, szDriveLetter[0] - L'A', szFileName, NULL, EffectiveVolumePkcs5, CmdVolumePim, EffectiveVolumeTrueCryptMode, bCacheInDriver, bIncludePimInCache, bForceMount, &mountOptions, Silent, FALSE); + mounted = MountVolume (hwndDlg, szDriveLetter[0] - L'A', szFileName, NULL, EffectiveVolumePkcs5, CmdVolumePim, bCacheInDriver, bIncludePimInCache, bForceMount, &mountOptions, Silent, FALSE); } if (FirstCmdKeyFile) { KeyFileRemoveAll (&FirstKeyFile); - FirstKeyFile = FirstCmdKeyFile; + KeyFileCloneAll (FirstCmdKeyFile, &FirstKeyFile); KeyFilesEnable = TRUE; } // Ask user for password while (!mounted && !Silent) { int GuiPkcs5 = EffectiveVolumePkcs5; int GuiPim = CmdVolumePim; - BOOL GuiTrueCryptMode = EffectiveVolumeTrueCryptMode; VolumePassword.Length = 0; StringCbCopyW (PasswordDlgVolume, sizeof(PasswordDlgVolume),szFileName); - if (!AskVolumePassword (hwndDlg, &VolumePassword, &GuiPkcs5, &GuiPim, &GuiTrueCryptMode, NULL, TRUE)) + if (!AskVolumePassword (hwndDlg, &VolumePassword, &GuiPkcs5, &GuiPim, NULL, TRUE)) break; else { VolumePkcs5 = GuiPkcs5; VolumePim = GuiPim; - VolumeTrueCryptMode = GuiTrueCryptMode; burn (&GuiPkcs5, sizeof(GuiPkcs5)); burn (&GuiPim, sizeof(GuiPim)); - burn (&GuiTrueCryptMode, sizeof(GuiTrueCryptMode)); } WaitCursor (); if (KeyFilesEnable && FirstKeyFile) KeyFilesApply (hwndDlg, &VolumePassword, FirstKeyFile, szFileName); - mounted = MountVolume (hwndDlg, szDriveLetter[0] - L'A', szFileName, &VolumePassword, VolumePkcs5, VolumePim, VolumeTrueCryptMode, bCacheInDriver, bIncludePimInCache, bForceMount, &mountOptions, FALSE, TRUE); + mounted = MountVolume (hwndDlg, szDriveLetter[0] - L'A', szFileName, &VolumePassword, VolumePkcs5, VolumePim, bCacheInDriver, bIncludePimInCache, bForceMount, &mountOptions, FALSE, TRUE); burn (&VolumePassword, sizeof (VolumePassword)); burn (&VolumePkcs5, sizeof (VolumePkcs5)); burn (&VolumePim, sizeof (VolumePim)); - burn (&VolumeTrueCryptMode, sizeof (VolumeTrueCryptMode)); burn (&mountOptions.ProtectedHidVolPassword, sizeof (mountOptions.ProtectedHidVolPassword)); burn (&mountOptions.ProtectedHidVolPkcs5Prf, sizeof (mountOptions.ProtectedHidVolPkcs5Prf)); NormalCursor (); @@ -6664,12 +7295,12 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa if (bExplore) OpenVolumeExplorerWindow (szDriveLetter[0] - L'A'); - RefreshMainDlg(hwndDlg); if(!Silent) { + RefreshMainDlg(hwndDlg); // Check for problematic file extensions (exe, dll, sys) if (CheckFileExtension (szFileName)) Warning ("EXE_FILE_EXTENSION_MOUNT_WARNING", hwndDlg); } @@ -6719,9 +7350,11 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa MOUNT_LIST_STRUCT mountList; DWORD bytesReturned; if (DeviceIoControl (hDriver, TC_IOCTL_GET_MOUNTED_VOLUMES, NULL, 0, &mountList, sizeof (mountList), &bytesReturned, NULL) + && ((mountList.ulMountedDrives < (1 << 26)) && (mountList.ulMountedDrives & (1 << cmdUnmountDrive)) == 0) + ) { Error ("NO_VOLUME_MOUNTED_TO_DRIVE", hwndDlg); exitCode = 1; } @@ -6741,9 +7374,12 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa // Quit if (Quit) { if (TaskBarIconMutex == NULL) + { + SignalExitCode (exitCode); exit (exitCode); + } MainWindowHidden = TRUE; LoadSettings (hwndDlg); @@ -6753,10 +7389,20 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa if (!bEnableBkgTask) { if (TaskBarIconMutex) TaskBarIconRemove (hwndDlg); + SignalExitCode (exitCode); exit (exitCode); } + else + { + if (Silent) + { + Silent = FALSE; + InitMainDialog (hwndDlg); + RefreshMainDlg(hwndDlg); + } + } } // No command line arguments or only /volume => bring active instance // to foreground if available @@ -6798,8 +7444,9 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa Silent = FALSE; GetMountList (&LastKnownMountList); SetTimer (hwndDlg, TIMER_ID_MAIN, TIMER_INTERVAL_MAIN, NULL); + SetTimer (hwndDlg, TIMER_ID_UPDATE_DEVICE_LIST, TIMER_INTERVAL_UPDATE_DEVICE_LIST, NULL); taskBarCreatedMsg = RegisterWindowMessage (L"TaskbarCreated"); AllowMessageInUIPI (taskBarCreatedMsg); @@ -6809,12 +7456,14 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa /* Check system encryption status */ if (!Quit) // Do not care about system encryption or in-place encryption if we were launched from the system startup sequence (the wizard was added to it too). { + BOOL bActionPerformed = FALSE; if (SysEncryptionOrDecryptionRequired ()) { if (!MutexExistsOnSystem (TC_MUTEX_NAME_SYSENC)) // If no instance of the wizard is currently taking care of system encryption { + bActionPerformed = TRUE; // We shouldn't block the mutex at this point if (SystemEncryptionStatus == SYSENC_STATUS_PRETEST || AskWarnYesNo ("SYSTEM_ENCRYPTION_RESUME_PROMPT", hwndDlg) == IDYES) @@ -6839,14 +7488,24 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa if (bInPlaceEncNonSysPending && !NonSysInplaceEncInProgressElsewhere()) { BOOL bDecrypt = FALSE; if (AskNonSysInPlaceEncryptionResume(hwndDlg, &bDecrypt) == IDYES) + { + bActionPerformed = TRUE; ResumeInterruptedNonSysInplaceEncProcess (bDecrypt); + } + } + + if (!bActionPerformed) + { + // display warning if the master key is vulnerable + if (SysEncryptionMasterKeyVulnerable()) + WarningTopMost ("ERR_SYSENC_XTS_MASTERKEY_VULNERABLE", hwndDlg); } } if (TaskBarIconMutex != NULL) - RegisterWtsNotification(hwndDlg); + RegisterWtsAndPowerNotification(hwndDlg); DoPostInstallTasks (hwndDlg); ResetCurrentDirectory (); } return 0; @@ -6906,9 +7565,9 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa if (bWipeCacheOnAutoDismount) { DeviceIoControl (hDriver, TC_IOCTL_WIPE_PASSWORD_CACHE, NULL, 0, NULL, 0, &dwResult, NULL); - SecurityToken::CloseAllSessions(); + SecurityToken::CloseAllSessions(); // TODO Use Token } DismountAll (hwndDlg, bForceAutoDismount, TRUE, UNMOUNT_MAX_AUTO_RETRIES, UNMOUNT_AUTO_RETRY_DELAY); } @@ -6929,9 +7588,9 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa DismountAll (hwndDlg, bForceAutoDismount, FALSE, 1, 0); } TaskBarIconRemove (hwndDlg); - UnregisterWtsNotification(hwndDlg); + UnregisterWtsAndPowerNotification(hwndDlg); } EndMainDlg (hwndDlg); localcleanup (); return 0; @@ -6945,208 +7604,216 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa if (bWipeCacheOnAutoDismount) { DeviceIoControl (hDriver, TC_IOCTL_WIPE_PASSWORD_CACHE, NULL, 0, NULL, 0, &dwResult, NULL); - SecurityToken::CloseAllSessions(); + SecurityToken::CloseAllSessions(); // TODO Use Token } DismountAll (hwndDlg, bForceAutoDismount, TRUE, UNMOUNT_MAX_AUTO_RETRIES, UNMOUNT_AUTO_RETRY_DELAY); } return 0; case WM_TIMER: { - // Check mount list and update GUI if needed - CheckMountList (hwndDlg, FALSE); - - // Cache status - if (IsPasswordCacheEmpty() == IsWindowEnabled (GetDlgItem (hwndDlg, IDC_WIPE_CACHE))) - EnableWindow (GetDlgItem (hwndDlg, IDC_WIPE_CACHE), !IsPasswordCacheEmpty()); - - // Check driver warning flags - DWORD bytesOut; - GetWarningFlagsRequest warnings; - if (DeviceIoControl (hDriver, TC_IOCTL_GET_WARNING_FLAGS, NULL, 0, &warnings, sizeof (warnings), &bytesOut, NULL)) + if (wParam == TIMER_ID_UPDATE_DEVICE_LIST) { - if (warnings.SystemFavoriteVolumeDirty) - WarningTopMost ("SYS_FAVORITE_VOLUME_DIRTY", hwndDlg); - - if (warnings.PagingFileCreationPrevented) - WarningTopMost ("PAGING_FILE_CREATION_PREVENTED", hwndDlg); + if (NeedPeriodicDeviceListUpdate) + UpdateMountableHostDeviceList (); } - - if (TaskBarIconMutex != NULL) + else { + // Check mount list and update GUI if needed + CheckMountList (hwndDlg, FALSE); - // Idle auto-dismount - if (MaxVolumeIdleTime > 0) - DismountIdleVolumes (); + // Cache status + if (IsPasswordCacheEmpty() == IsWindowEnabled (GetDlgItem (hwndDlg, IDC_WIPE_CACHE))) + EnableWindow (GetDlgItem (hwndDlg, IDC_WIPE_CACHE), !IsPasswordCacheEmpty()); - // Screen saver auto-dismount - if (bDismountOnScreenSaver) + // Check driver warning flags + DWORD bytesOut; + GetWarningFlagsRequest warnings; + if (DeviceIoControl (hDriver, TC_IOCTL_GET_WARNING_FLAGS, NULL, 0, &warnings, sizeof (warnings), &bytesOut, NULL)) { - static BOOL previousState = FALSE; - BOOL running = FALSE; - SystemParametersInfo (SPI_GETSCREENSAVERRUNNING, 0, &running, 0); - - if (running && !previousState) - { - DWORD dwResult; - previousState = TRUE; - - if (bWipeCacheOnAutoDismount) - { - DeviceIoControl (hDriver, TC_IOCTL_WIPE_PASSWORD_CACHE, NULL, 0, NULL, 0, &dwResult, NULL); - SecurityToken::CloseAllSessions(); - } + if (warnings.SystemFavoriteVolumeDirty) + WarningTopMost ("SYS_FAVORITE_VOLUME_DIRTY", hwndDlg); - DismountAll (hwndDlg, bForceAutoDismount, FALSE, UNMOUNT_MAX_AUTO_RETRIES, UNMOUNT_AUTO_RETRY_DELAY); - } - else - { - previousState = running; - } + if (warnings.PagingFileCreationPrevented) + WarningTopMost ("PAGING_FILE_CREATION_PREVENTED", hwndDlg); } - // Auto-mount favorite volumes on arrival -#if TIMER_INTERVAL_MAIN != 500 -#error TIMER_INTERVAL_MAIN != 500 -#endif - static int favoritesAutoMountTimerDivisor = 0; - if ((++favoritesAutoMountTimerDivisor & 1) && !FavoritesOnArrivalMountRequired.empty()) + if (TaskBarIconMutex != NULL) { - static bool reentry = false; - if (reentry) - break; - reentry = true; + // Idle auto-dismount + if (MaxVolumeIdleTime > 0) + DismountIdleVolumes (); - foreach (FavoriteVolume favorite, FavoritesOnArrivalMountRequired) + // Screen saver auto-dismount + if (bDismountOnScreenSaver) { - if (favorite.UseVolumeID) + static BOOL previousState = FALSE; + BOOL running = FALSE; + SystemParametersInfo (SPI_GETSCREENSAVERRUNNING, 0, &running, 0); + + if (running && !previousState) { - if (IsMountedVolumeID (favorite.VolumeID)) - continue; + DWORD dwResult; + previousState = TRUE; - std::wstring volDevPath = FindDeviceByVolumeID (favorite.VolumeID); - if (volDevPath.length() > 0) + if (bWipeCacheOnAutoDismount) { - favorite.Path = volDevPath; - favorite.DisconnectedDevice = false; + DeviceIoControl (hDriver, TC_IOCTL_WIPE_PASSWORD_CACHE, NULL, 0, NULL, 0, &dwResult, NULL); + SecurityToken::CloseAllSessions(); // TODO Use Token } - else - continue; - } - else if (!favorite.VolumePathId.empty()) - { - if (IsMountedVolume (favorite.Path.c_str())) - continue; - wchar_t volDevPath[TC_MAX_PATH]; - if (QueryDosDevice (favorite.VolumePathId.substr (4, favorite.VolumePathId.size() - 5).c_str(), volDevPath, TC_MAX_PATH) == 0) - continue; - - favorite.DisconnectedDevice = false; + DismountAll (hwndDlg, bForceAutoDismount, FALSE, UNMOUNT_MAX_AUTO_RETRIES, UNMOUNT_AUTO_RETRY_DELAY); } - else if (favorite.Path.find (L"\\\\?\\Volume{") == 0) + else { - wstring resolvedPath = VolumeGuidPathToDevicePath (favorite.Path); - if (resolvedPath.empty()) - continue; - - favorite.DisconnectedDevice = false; - favorite.VolumePathId = favorite.Path; - favorite.Path = resolvedPath; + previousState = running; } + } - if (IsMountedVolume (favorite.Path.c_str())) - continue; + // Auto-mount favorite volumes on arrival + #if TIMER_INTERVAL_MAIN != 500 + #error TIMER_INTERVAL_MAIN != 500 + #endif + static int favoritesAutoMountTimerDivisor = 0; + if ((++favoritesAutoMountTimerDivisor & 1) && !FavoritesOnArrivalMountRequired.empty()) + { + static bool reentry = false; + if (reentry) + break; - if (!IsVolumeDeviceHosted (favorite.Path.c_str())) - { - if (!FileExists (favorite.Path.c_str())) - continue; - } - else if (favorite.VolumePathId.empty()) - continue; + reentry = true; - bool mountedAndNotDisconnected = false; - foreach (FavoriteVolume mountedFavorite, FavoritesMountedOnArrivalStillConnected) + for (FavoriteVolume favorite: FavoritesOnArrivalMountRequired) { - if (favorite.Path == mountedFavorite.Path) + if (favorite.UseVolumeID) { - mountedAndNotDisconnected = true; - break; + if (IsMountedVolumeID (favorite.VolumeID)) + continue; + + std::wstring volDevPath = FindDeviceByVolumeID (favorite.VolumeID, FALSE); + if (volDevPath.length() > 0) + { + favorite.Path = volDevPath; + favorite.DisconnectedDevice = false; + } + else + continue; } - } + else if (!favorite.VolumePathId.empty()) + { + if (IsMountedVolume (favorite.Path.c_str())) + continue; - if (!mountedAndNotDisconnected) - { - FavoriteMountOnArrivalInProgress = TRUE; - MountFavoriteVolumes (hwndDlg, FALSE, FALSE, FALSE, favorite); - FavoriteMountOnArrivalInProgress = FALSE; + wchar_t volDevPath[TC_MAX_PATH]; + if (QueryDosDevice (favorite.VolumePathId.substr (4, favorite.VolumePathId.size() - 5).c_str(), volDevPath, TC_MAX_PATH) == 0) + continue; - FavoritesMountedOnArrivalStillConnected.push_back (favorite); - } - } + favorite.DisconnectedDevice = false; + } + else if (favorite.Path.find (L"\\\\?\\Volume{") == 0) + { + wstring resolvedPath = VolumeGuidPathToDevicePath (favorite.Path); + if (resolvedPath.empty()) + continue; - bool deleted; - for (list <FavoriteVolume>::iterator favorite = FavoritesMountedOnArrivalStillConnected.begin(); - favorite != FavoritesMountedOnArrivalStillConnected.end(); - deleted ? favorite : ++favorite) - { - deleted = false; + favorite.DisconnectedDevice = false; + favorite.VolumePathId = favorite.Path; + favorite.Path = resolvedPath; + } - if (IsMountedVolume (favorite->Path.c_str())) - continue; + if (IsMountedVolume (favorite.Path.c_str())) + continue; - if (!IsVolumeDeviceHosted (favorite->Path.c_str())) - { - if (FileExists (favorite->Path.c_str())) + if (!IsVolumeDeviceHosted (favorite.Path.c_str())) + { + if (!FileExists (favorite.Path.c_str())) + continue; + } + else if (favorite.VolumePathId.empty()) continue; - } - wchar_t volDevPath[TC_MAX_PATH]; - if (favorite->VolumePathId.size() > 5 - && QueryDosDevice (favorite->VolumePathId.substr (4, favorite->VolumePathId.size() - 5).c_str(), volDevPath, TC_MAX_PATH) != 0) - { - continue; + bool mountedAndNotDisconnected = false; + for (FavoriteVolume mountedFavorite: FavoritesMountedOnArrivalStillConnected) + { + if (favorite.Path == mountedFavorite.Path) + { + mountedAndNotDisconnected = true; + break; + } + } + + if (!mountedAndNotDisconnected) + { + FavoriteMountOnArrivalInProgress = TRUE; + MountFavoriteVolumes (hwndDlg, FALSE, FALSE, FALSE, favorite); + FavoriteMountOnArrivalInProgress = FALSE; + + FavoritesMountedOnArrivalStillConnected.push_back (favorite); + } } - // set DisconnectedDevice field on FavoritesOnArrivalMountRequired element - foreach (FavoriteVolume onArrivalFavorite, FavoritesOnArrivalMountRequired) + bool deleted; + for (list <FavoriteVolume>::iterator favorite = FavoritesMountedOnArrivalStillConnected.begin(); + favorite != FavoritesMountedOnArrivalStillConnected.end(); + deleted ? favorite : ++favorite) { - if (onArrivalFavorite.Path == favorite->Path) + deleted = false; + + if (IsMountedVolume (favorite->Path.c_str())) + continue; + + if (!IsVolumeDeviceHosted (favorite->Path.c_str())) { - onArrivalFavorite.DisconnectedDevice = true; - break; + if (FileExists (favorite->Path.c_str())) + continue; } + + wchar_t volDevPath[TC_MAX_PATH]; + if (favorite->VolumePathId.size() > 5 + && QueryDosDevice (favorite->VolumePathId.substr (4, favorite->VolumePathId.size() - 5).c_str(), volDevPath, TC_MAX_PATH) != 0) + { + continue; + } + + // set DisconnectedDevice field on FavoritesOnArrivalMountRequired element + foreach (FavoriteVolume onArrivalFavorite, FavoritesOnArrivalMountRequired) + { + if (onArrivalFavorite.Path == favorite->Path) + { + onArrivalFavorite.DisconnectedDevice = true; + break; + } + } + + favorite = FavoritesMountedOnArrivalStillConnected.erase (favorite); + deleted = true; } - favorite = FavoritesMountedOnArrivalStillConnected.erase (favorite); - deleted = true; + reentry = false; } - - reentry = false; } - } - // Exit background process in non-install mode or if no volume mounted - // and no other instance active - if (LastKnownMountList.ulMountedDrives == 0 - && MainWindowHidden -#ifndef _DEBUG - && (bCloseBkgTaskWhenNoVolumes || IsNonInstallMode ()) - && !SysEncDeviceActive (TRUE) -#endif - && GetDriverRefCount () < 2) - { - TaskBarIconRemove (hwndDlg); - UnregisterWtsNotification(hwndDlg); - EndMainDlg (hwndDlg); + // Exit background process in non-install mode or if no volume mounted + // and no other instance active + if (LastKnownMountList.ulMountedDrives == 0 + && MainWindowHidden + #ifndef _DEBUG + && (bCloseBkgTaskWhenNoVolumes || IsNonInstallMode ()) + && !SysEncDeviceActive (TRUE) + #endif + && GetDriverRefCount () < 2) + { + TaskBarIconRemove (hwndDlg); + UnregisterWtsAndPowerNotification(hwndDlg); + EndMainDlg (hwndDlg); + } } - } - return 1; + return 1; + } case TC_APPMSG_TASKBAR_ICON: { switch (lParam) @@ -7186,18 +7853,20 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa for (n = 0; n < 2; n++) { for (i = 0; i < 26; i++) { - if (LastKnownMountList.ulMountedDrives & (1 << i)) + if ((LastKnownMountList.ulMountedDrives & (1 << i)) && IsNullTerminateString (LastKnownMountList.wszVolume[i], TC_MAX_PATH)) { wchar_t s[1024]; wchar_t *vol = (wchar_t *) LastKnownMountList.wszVolume[i]; if (wcsstr (vol, L"\\??\\")) vol += 4; // first check label used for mounting. If empty, look for it in favorites. bool useInExplorer = false; - wstring label = (wchar_t *) LastKnownMountList.wszLabel[i]; + wstring label; + if (IsNullTerminateString (LastKnownMountList.wszLabel[i], 33)) + label = (wchar_t *) LastKnownMountList.wszLabel[i]; if (label.empty()) label = GetFavoriteVolumeLabel (vol, useInExplorer); StringCbPrintfW (s, sizeof(s), L"%s %c: (%s)", @@ -7252,9 +7921,9 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa ChangeMainWindowVisibility (); } else if (sel == IDM_HOMEPAGE_SYSTRAY) { - Applink ("home", TRUE, ""); + Applink ("home"); } else if (sel == IDCANCEL) { if ((LastKnownMountList.ulMountedDrives == 0 @@ -7264,9 +7933,9 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa // Close all other TC windows EnumWindows (CloseTCWindowsEnum, 0); TaskBarIconRemove (hwndDlg); - UnregisterWtsNotification(hwndDlg); + UnregisterWtsAndPowerNotification(hwndDlg); SendMessage (hwndDlg, WM_COMMAND, sel, 0); } } else @@ -7285,9 +7954,9 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa case TC_APPMSG_CLOSE_BKG_TASK: if (TaskBarIconMutex != NULL) TaskBarIconRemove (hwndDlg); - UnregisterWtsNotification(hwndDlg); + UnregisterWtsAndPowerNotification(hwndDlg); return 1; case TC_APPMSG_SYSENC_CONFIG_UPDATE: @@ -7305,58 +7974,59 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa // Check if any host device has been removed and force dismount of volumes accordingly PDEV_BROADCAST_HDR hdr = (PDEV_BROADCAST_HDR) lParam; int m; - GetMountList (&LastKnownMountList); - - if (wParam == DBT_DEVICEREMOVECOMPLETE && hdr->dbch_devicetype == DBT_DEVTYP_VOLUME) + if (GetMountList (&LastKnownMountList)) { - // File-hosted volumes - PDEV_BROADCAST_VOLUME vol = (PDEV_BROADCAST_VOLUME) lParam; - int i; - - for (i = 0; i < 26; i++) + if (wParam == DBT_DEVICEREMOVECOMPLETE && hdr->dbch_devicetype == DBT_DEVTYP_VOLUME) { - if ((vol->dbcv_unitmask & (1 << i)) && !(GetUsedLogicalDrives() & (1 << i))) + // File-hosted volumes + PDEV_BROADCAST_VOLUME vol = (PDEV_BROADCAST_VOLUME) lParam; + int i; + + for (i = 0; i < 26; i++) { - for (m = 0; m < 26; m++) + if (LastKnownMountList.ulMountedDrives && (vol->dbcv_unitmask & (1 << i)) && !(GetUsedLogicalDrives() & (1 << i))) { - if (LastKnownMountList.ulMountedDrives & (1 << m)) + for (m = 0; m < 26; m++) { - wchar_t *vol = (wchar_t *) LastKnownMountList.wszVolume[m]; + if ((LastKnownMountList.ulMountedDrives & (1 << m)) && IsNullTerminateString (LastKnownMountList.wszVolume[m], TC_MAX_PATH)) + { + wchar_t *wszVol = (wchar_t *) LastKnownMountList.wszVolume[m]; - if (wcsstr (vol, L"\\??\\") == vol) - vol += 4; + if (wcsstr (wszVol, L"\\??\\") == wszVol) + vol += 4; - if (vol[1] == L':' && i == (vol[0] - (vol[0] <= L'Z' ? L'A' : L'a'))) - { - UnmountVolume (hwndDlg, m, TRUE); - WarningBalloon ("HOST_DEVICE_REMOVAL_DISMOUNT_WARN_TITLE", "HOST_DEVICE_REMOVAL_DISMOUNT_WARN", hwndDlg); + if (wszVol[1] == L':' && i == (wszVol[0] - (wszVol[0] <= L'Z' ? L'A' : L'a'))) + { + UnmountVolume (hwndDlg, m, TRUE); + WarningBalloon ("HOST_DEVICE_REMOVAL_DISMOUNT_WARN_TITLE", "HOST_DEVICE_REMOVAL_DISMOUNT_WARN", hwndDlg); + } } } } } } - } - // Device-hosted volumes - for (m = 0; m < 26; m++) - { - if (LastKnownMountList.ulMountedDrives & (1 << m)) + // Device-hosted volumes + for (m = 0; m < 26; m++) { - wchar_t *vol = (wchar_t *) LastKnownMountList.wszVolume[m]; - - if (wcsstr (vol, L"\\??\\") == vol) - vol += 4; - - if (IsVolumeDeviceHosted (vol)) + if ((LastKnownMountList.ulMountedDrives & (1 << m)) && IsNullTerminateString (LastKnownMountList.wszVolume[m], TC_MAX_PATH)) { - OPEN_TEST_STRUCT ots = {0}; + wchar_t *vol = (wchar_t *) LastKnownMountList.wszVolume[m]; + + if (wcsstr (vol, L"\\??\\") == vol) + vol += 4; - if (!OpenDevice (vol, &ots, FALSE, FALSE, NULL)) + if (IsVolumeDeviceHosted (vol)) { - UnmountVolume (hwndDlg, m, TRUE); - WarningBalloon ("HOST_DEVICE_REMOVAL_DISMOUNT_WARN_TITLE", "HOST_DEVICE_REMOVAL_DISMOUNT_WARN", hwndDlg); + OPEN_TEST_STRUCT ots = {0}; + + if (!OpenDevice (vol, &ots, FALSE, FALSE)) + { + UnmountVolume (hwndDlg, m, TRUE); + WarningBalloon ("HOST_DEVICE_REMOVAL_DISMOUNT_WARN_TITLE", "HOST_DEVICE_REMOVAL_DISMOUNT_WARN", hwndDlg); + } } } } } @@ -7397,16 +8067,33 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa LPARAM state = GetItemLong (GetDlgItem (hwndDlg, IDC_DRIVELIST), ((LPNMITEMACTIVATE)lParam)->iItem ); nSelectedDriveIndex = ((LPNMITEMACTIVATE)lParam)->iItem; if (LOWORD(state) == TC_MLIST_ITEM_NONSYS_VOL || LOWORD(state) == TC_MLIST_ITEM_SYS_PARTITION) { - // Open explorer window for mounted volume - WaitCursor (); - OpenVolumeExplorerWindow (HIWORD(state) - L'A'); - NormalCursor (); + VOLUME_PROPERTIES_STRUCT prop; + DWORD dwResult; + + memset (&prop, 0, sizeof(prop)); + prop.driveNo = HIWORD (state) - L'A'; + + if (DeviceIoControl (hDriver, TC_IOCTL_GET_VOLUME_PROPERTIES, &prop, sizeof (prop), &prop, sizeof (prop), &dwResult, NULL) + && dwResult + && prop.mountDisabled + ) + { + Warning ("MOUNTED_VOLUME_NOT_ASSOCIATED", hwndDlg); + } + else + { + // Open explorer window for mounted volume + WaitCursor (); + OpenVolumeExplorerWindow (HIWORD(state) - L'A'); + NormalCursor (); + } } else if (LOWORD (GetSelectedLong (GetDlgItem (hwndDlg, IDC_DRIVELIST))) == TC_MLIST_ITEM_FREE) { mountOptions = defaultMountOptions; + mountOptions.SkipCachedPasswords = FALSE; bPrebootPasswordDlgMode = FALSE; if (GetAsyncKeyState (VK_CONTROL) < 0) { @@ -7418,9 +8105,9 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa else mountOptions.ProtectedHidVolPkcs5Prf = CmdVolumePkcs5; mountOptions.ProtectedHidVolPim = CmdVolumePim; - if (IDCANCEL == DialogBoxParamW (hInst, + if (IDCANCEL == SecureDesktopDialogBoxParam (hInst, MAKEINTRESOURCEW (IDD_MOUNT_OPTIONS), hwndDlg, (DLGPROC) MountOptionsDlgProc, (LPARAM) &mountOptions)) return 1; @@ -7454,8 +8141,22 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa return 1; } } } +#if !defined(VCEXPANDER) + else + { + LPNMHDR pnmh = (LPNMHDR)lParam; + + if (pnmh->idFrom == IDOK && pnmh->code == BCN_DROPDOWN) + { + // Create a popup menu for the split button + HMENU hmenu = CreateMountNoCacheDropdownMenu(); + HandleMountButtonDropdown(pnmh->hwndFrom, hwndDlg, hmenu); + DestroyMenu(hmenu); + } + } +#endif return 0; case WM_ERASEBKGND: return 0; @@ -7500,11 +8201,11 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa MessageBoxW (hwndDlg, GetString ("SELECT_FREE_DRIVE"), L"VeraCrypt", MB_ICONEXCLAMATION); return 1; } - if ((lw == IDOK || lw == IDM_MOUNT_VOLUME || lw == IDM_MOUNT_VOLUME_OPTIONS)) + if ((lw == IDOK || lw == IDM_MOUNT_VOLUME || lw == IDM_MOUNT_VOLUME_OPTIONS || lw == IDM_MOUNIT_NO_CACHE)) { - MountSelectedVolume (hwndDlg, lw == IDM_MOUNT_VOLUME_OPTIONS); + MountSelectedVolume (hwndDlg, lw == IDM_MOUNT_VOLUME_OPTIONS, lw == IDM_MOUNIT_NO_CACHE); return 1; } if (lw == IDC_UNMOUNTALL || lw == IDM_UNMOUNTALL) @@ -7575,8 +8276,9 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa if (CheckSysEncMountWithoutPBA (hwndDlg, L"", FALSE)) { mountOptions = defaultMountOptions; mountOptions.PartitionInInactiveSysEncScope = TRUE; + mountOptions.SkipCachedPasswords = FALSE; bPrebootPasswordDlgMode = TRUE; if (CheckMountList (hwndDlg, FALSE)) _beginthread(mountThreadFunction, 0, hwndDlg); @@ -7860,9 +8562,9 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa { WaitCursor(); finally_do ({ NormalCursor(); }); - SecurityToken::CloseAllSessions(); + SecurityToken::CloseAllSessions(); // TODO Use Token } InfoBalloon (NULL, "ALL_TOKEN_SESSIONS_CLOSED", hwndDlg); @@ -7879,9 +8581,9 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa } if (lw == IDM_DONATE) { - Applink ("donate", TRUE, ""); + Applink ("donate"); return 1; } if (lw == IDM_LICENSE) @@ -7891,19 +8593,19 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa } if (lw == IDM_WEBSITE) { - Applink ("website", TRUE, ""); + Applink ("website"); return 1; } else if (lw == IDM_HOMEPAGE) { - Applink ("homepage", TRUE, ""); + Applink ("homepage"); return 1; } else if (lw == IDM_ONLINE_TUTORIAL) { - Applink ("tutorial", TRUE, ""); + Applink ("tutorial"); return 1; } else if (lw == IDM_ONLINE_HELP) { @@ -7911,29 +8613,29 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa return 1; } else if (lw == IDM_FAQ) { - Applink ("faq", TRUE, ""); + Applink ("faq"); return 1; } else if (lw == IDM_TC_DOWNLOADS) { - Applink ("downloads", TRUE, ""); + Applink ("downloads"); return 1; } else if (lw == IDM_NEWS) { - Applink ("news", TRUE, ""); + Applink ("news"); return 1; } else if (lw == IDM_VERSION_HISTORY) { - Applink ("history", TRUE, ""); + Applink ("history"); return 1; } else if (lw == IDM_CONTACT) { - Applink ("contact", FALSE, ""); + Applink ("contact"); return 1; } if (lw == IDM_PREFERENCES) @@ -7944,14 +8646,14 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa { if (bEnableBkgTask) { TaskBarIconAdd (hwndDlg); - RegisterWtsNotification(hwndDlg); + RegisterWtsAndPowerNotification(hwndDlg); } else { TaskBarIconRemove (hwndDlg); - UnregisterWtsNotification(hwndDlg); + UnregisterWtsAndPowerNotification(hwndDlg); if (MainWindowHidden) EndMainDlg (hwndDlg); } } @@ -8219,14 +8921,12 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa DWORD driveMap = GetUsedLogicalDrives (); WaitCursor (); - if (!(nCurrentOS == WIN_2000 && RemoteSession)) - { - BroadcastDeviceChange (DBT_DEVICEREMOVECOMPLETE, 0, ~driveMap); - Sleep (100); - BroadcastDeviceChange (DBT_DEVICEARRIVAL, 0, driveMap); - } + + BroadcastDeviceChange (DBT_DEVICEREMOVECOMPLETE, 0, ~driveMap); + Sleep (100); + BroadcastDeviceChange (DBT_DEVICEARRIVAL, 0, driveMap); LoadDriveLetters (hwndDlg, GetDlgItem (hwndDlg, IDC_DRIVELIST), 0); if (nSelectedDriveIndex >= 0) @@ -8240,9 +8940,10 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa } if (lw == IDM_MOUNT_FAVORITE_VOLUMES) { - _beginthread(mountFavoriteVolumeThreadFunction, 0, NULL); + if (0 == _InterlockedCompareExchange(&FavoriteMountOnGoing, 1, 0)) + _beginthread(mountFavoriteVolumeThreadFunction, 0, NULL); return 1; } if (lw == IDM_RESUME_INTERRUPTED_PROC) @@ -8313,23 +9014,26 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa { std::wstring volName; WaitCursor(); if (FavoriteVolumes[favoriteIndex].UseVolumeID) - volName = FindDeviceByVolumeID (FavoriteVolumes[favoriteIndex].VolumeID); + volName = FindDeviceByVolumeID (FavoriteVolumes[favoriteIndex].VolumeID, FALSE); else volName = FavoriteVolumes[favoriteIndex].Path; OpenVolumeExplorerWindow (GetMountedVolumeDriveNo ((wchar_t*) FavoriteVolumes[favoriteIndex].Path.c_str())); NormalCursor(); } else { - mountFavoriteVolumeThreadParam* pParam = (mountFavoriteVolumeThreadParam*) calloc(1, sizeof(mountFavoriteVolumeThreadParam)); - pParam->systemFavorites = FALSE; - pParam->logOnMount = FALSE; - pParam->hotKeyMount = FALSE; - pParam->favoriteVolumeToMount = &FavoriteVolumes[favoriteIndex]; + if (0 == _InterlockedCompareExchange(&FavoriteMountOnGoing, 1, 0)) + { + mountFavoriteVolumeThreadParam* pParam = (mountFavoriteVolumeThreadParam*) calloc(1, sizeof(mountFavoriteVolumeThreadParam)); + pParam->systemFavorites = FALSE; + pParam->logOnMount = FALSE; + pParam->hotKeyMount = FALSE; + pParam->favoriteVolumeToMount = &FavoriteVolumes[favoriteIndex]; - _beginthread(mountFavoriteVolumeThreadFunction, 0, pParam); + _beginthread(mountFavoriteVolumeThreadFunction, 0, pParam); + } } } return 1; @@ -8358,8 +9062,12 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa ShowWindow (hwndDlg, SW_SHOW); ShowWindow (hwndDlg, SW_RESTORE); return 1; + case VC_APPMSG_CREATE_RESCUE_DISK: + CreateRescueDisk (hwndDlg); + return 1; + case WM_COPYDATA: { PCOPYDATASTRUCT cd = (PCOPYDATASTRUCT)lParam; if (memcmp (&cd->dwData, WM_COPY_SET_VOLUME_NAME, 4) == 0) @@ -8412,11 +9120,13 @@ void ExtractCommandLine (HWND hwndDlg, wchar_t *lpszCommandLine) { wchar_t **lpszCommandLineArgs = NULL; /* Array of command line arguments */ int nNoCommandLineArgs; /* The number of arguments in the array */ wchar_t tmpPath[MAX_PATH * 2]; + wchar_t CmdRawPassword[MAX_PASSWORD + 1]; /* Raw value of password passed from command line */ /* Defaults */ mountOptions.PreserveTimestamp = TRUE; + mountOptions.SkipCachedPasswords = FALSE; if (_wcsicmp (lpszCommandLine, L"-Embedding") == 0) { ComServerMode = TRUE; @@ -8452,13 +9162,15 @@ void ExtractCommandLine (HWND hwndDlg, wchar_t *lpszCommandLine) OptionTokenPin, OptionVolume, CommandWipeCache, OptionPkcs5, - OptionTrueCryptMode, OptionPim, OptionTryEmptyPassword, OptionNoWaitDlg, OptionSecureDesktop, + OptionDisableDeviceUpdate, + OptionEnableMemoryProtection, + OptionSignalExit, }; argument args[]= { @@ -8479,14 +9191,16 @@ void ExtractCommandLine (HWND hwndDlg, wchar_t *lpszCommandLine) { OptionQuit, L"/quit", L"/q", FALSE }, { OptionSilent, L"/silent", L"/s", FALSE }, { OptionTokenLib, L"/tokenlib", NULL, FALSE }, { OptionTokenPin, L"/tokenpin", NULL, FALSE }, - { OptionTrueCryptMode, L"/truecrypt", L"/tc", FALSE }, { OptionVolume, L"/volume", L"/v", FALSE }, { CommandWipeCache, L"/wipecache", L"/w", FALSE }, { OptionTryEmptyPassword, L"/tryemptypass", NULL, FALSE }, { OptionNoWaitDlg, L"/nowaitdlg", NULL, FALSE }, { OptionSecureDesktop, L"/secureDesktop", NULL, FALSE }, + { OptionDisableDeviceUpdate, L"/disableDeviceUpdate", NULL, FALSE }, + { OptionEnableMemoryProtection, L"/protectMemory", NULL, FALSE }, + { OptionSignalExit, L"/signalExit", NULL, FALSE }, }; argumentspec as; @@ -8575,8 +9289,31 @@ void ExtractCommandLine (HWND hwndDlg, wchar_t *lpszCommandLine) } } break; + case OptionDisableDeviceUpdate: + { + DisablePeriodicDeviceListUpdate = TRUE; + } + break; + + case OptionEnableMemoryProtection: + { + EnableMemoryProtection = TRUE; + } + break; + + case OptionSignalExit: + if (HAS_ARGUMENT == GetArgumentValue (lpszCommandLineArgs, &i, + nNoCommandLineArgs, tmpPath, ARRAYSIZE (tmpPath))) + { + StringCbPrintfW (ExitMailSlotName, sizeof (ExitMailSlotName), L"\\\\.\\mailslot\\WAITFOR.EXE\\%s", tmpPath); + ExitMailSlotSpecified = TRUE; + } + else + AbortProcess ("COMMAND_LINE_ERROR"); + break; + case OptionCache: { wchar_t szTmp[16] = {0}; bCacheInDriver = TRUE; @@ -8720,8 +9457,12 @@ void ExtractCommandLine (HWND hwndDlg, wchar_t *lpszCommandLine) { // get the label StringCbCopyW (mountOptions.Label, sizeof (mountOptions.Label), &szTmp[6]); } + else if (!_wcsicmp (szTmp, L"noattach")) + { + mountOptions.DisableMountManager = TRUE; + } else AbortProcess ("COMMAND_LINE_ERROR"); CmdMountOptions = mountOptions; @@ -8733,21 +9474,22 @@ void ExtractCommandLine (HWND hwndDlg, wchar_t *lpszCommandLine) break; case OptionPassword: { - wchar_t szTmp[MAX_PASSWORD + 1]; if (HAS_ARGUMENT == GetArgumentValue (lpszCommandLineArgs, &i, nNoCommandLineArgs, - szTmp, ARRAYSIZE (szTmp))) + CmdRawPassword, ARRAYSIZE (CmdRawPassword))) { - int iLen = WideCharToMultiByte (CP_UTF8, 0, szTmp, -1, (char*) CmdVolumePassword.Text, MAX_PASSWORD + 1, NULL, NULL); - burn (szTmp, sizeof (szTmp)); + int iLen = WideCharToMultiByte (CP_UTF8, 0, CmdRawPassword, -1, (char*) CmdVolumePassword.Text, MAX_PASSWORD + 1, NULL, NULL); if (iLen > 0) { CmdVolumePassword.Length = (unsigned __int32) (iLen - 1); CmdVolumePasswordValid = TRUE; } else + { + burn (CmdRawPassword, sizeof (CmdRawPassword)); AbortProcess ("COMMAND_LINE_ERROR"); + } } else AbortProcess ("COMMAND_LINE_ERROR"); } @@ -8807,9 +9549,9 @@ void ExtractCommandLine (HWND hwndDlg, wchar_t *lpszCommandLine) break; case OptionTokenPin: { - wchar_t szTmp[SecurityToken::MaxPasswordLength + 1] = {0}; + wchar_t szTmp[SecurityToken::MaxPasswordLength + 1] = {0}; // TODO Use Token if (GetArgumentValue (lpszCommandLineArgs, &i, nNoCommandLineArgs, szTmp, ARRAYSIZE (szTmp)) == HAS_ARGUMENT) { if (0 == WideCharToMultiByte (CP_UTF8, 0, szTmp, -1, CmdTokenPin, TC_MAX_PATH, nullptr, nullptr)) AbortProcess ("COMMAND_LINE_ERROR"); @@ -8840,10 +9582,10 @@ void ExtractCommandLine (HWND hwndDlg, wchar_t *lpszCommandLine) if (_wcsicmp(szTmp, L"sha512") == 0) CmdVolumePkcs5 = SHA512; else if (_wcsicmp(szTmp, L"sha256") == 0) CmdVolumePkcs5 = SHA256; - else if (_wcsicmp(szTmp, L"ripemd160") == 0) - CmdVolumePkcs5 = RIPEMD160; + else if ((_wcsicmp(szTmp, L"blake2s") == 0) || (_wcsicmp(szTmp, L"blake2s-256") == 0)) + CmdVolumePkcs5 = BLAKE2S; else { /* match using internal hash names */ CmdVolumePkcs5 = HashGetIdByName (szTmp); @@ -8877,12 +9619,8 @@ void ExtractCommandLine (HWND hwndDlg, wchar_t *lpszCommandLine) AbortProcess ("COMMAND_LINE_ERROR"); } break; - case OptionTrueCryptMode: - CmdVolumeTrueCryptMode = TRUE; - break; - // no option = file name if there is only one argument default: { if (nNoCommandLineArgs == 1) @@ -8899,8 +9637,30 @@ void ExtractCommandLine (HWND hwndDlg, wchar_t *lpszCommandLine) } } } + if (CmdVolumePasswordValid && CmdMountOptionsValid && bPrebootPasswordDlgMode) + { + /* truncate the password to 64 first characer in case of System Encryption */ + if (lstrlen (CmdRawPassword) > MAX_LEGACY_PASSWORD) + { + int iLen; + wmemset (&CmdRawPassword[MAX_LEGACY_PASSWORD], 0, MAX_PASSWORD + 1 - MAX_LEGACY_PASSWORD); + iLen = WideCharToMultiByte (CP_UTF8, 0, CmdRawPassword, -1, (char*) CmdVolumePassword.Text, MAX_PASSWORD + 1, NULL, NULL); + if (iLen > 0) + { + CmdVolumePassword.Length = (unsigned __int32) (iLen - 1); + } + else + { + burn (CmdRawPassword, sizeof (CmdRawPassword)); + AbortProcess ("COMMAND_LINE_ERROR"); + } + } + } + + burn (CmdRawPassword, sizeof (CmdRawPassword)); + /* Free up the command line arguments */ while (--nNoCommandLineArgs >= 0) { free (lpszCommandLineArgs[nNoCommandLineArgs]); @@ -8912,8 +9672,76 @@ void ExtractCommandLine (HWND hwndDlg, wchar_t *lpszCommandLine) static SERVICE_STATUS SystemFavoritesServiceStatus; static SERVICE_STATUS_HANDLE SystemFavoritesServiceStatusHandle; +static HANDLE SystemFavoriteServiceStopEvent = NULL; +static HDEVNOTIFY SystemFavoriteServiceNotify = NULL; + +DEFINE_GUID(OCL_GUID_DEVCLASS_SOFTWARECOMPONENT, 0x5c4c3332, 0x344d, 0x483c, 0x87, 0x39, 0x25, 0x9e, 0x93, 0x4c, 0x9c, 0xc8); + +// This functions returns a vector containing all devices currently connected to the system +void BuildDeviceList(std::vector<CDevice>& devices) +{ + devices.clear(); + + // Get device info set for all devices + HDEVINFO hDevInfo = SetupDiGetClassDevs(NULL, NULL, NULL, DIGCF_ALLCLASSES | DIGCF_PRESENT); + if (hDevInfo != INVALID_HANDLE_VALUE) + { + SP_DEVINFO_DATA deviceInfoData; + deviceInfoData.cbSize = sizeof(SP_DEVINFO_DATA); + + // Enumerate through all devices in set + for (DWORD i = 0; SetupDiEnumDeviceInfo(hDevInfo, i, &deviceInfoData); i++) + { + // Get device path + WCHAR szDeviceID[MAX_PATH]; + if (CR_SUCCESS == CM_Get_Device_IDW(deviceInfoData.DevInst, szDeviceID, MAX_PATH, 0)) + { + // Add to vector + devices.push_back(CDevice(szDeviceID)); + } + } + + SetupDiDestroyDeviceInfoList(hDevInfo); // Cleanup + } +} + +// This function build a device ID value from the dbcc_name field of a DEV_BROADCAST_DEVICEINTERFACE structure +// In case of error, the device ID is set to an empty string +// Algorithm taken from https://www.codeproject.com/Articles/14500/Detecting-Hardware-Insertion-and-or-Removal#premain174347 +void GetDeviceID(PDEV_BROADCAST_DEVICEINTERFACE pDevInf, WCHAR* szDevId) +{ + szDevId[0] = L'\0'; + if (lstrlen(pDevInf->dbcc_name) < 4) return; + if (lstrlen(pDevInf->dbcc_name) - 4 >= MAX_PATH) return; + + StringCchCopyW(szDevId, MAX_PATH, pDevInf->dbcc_name + 4); + + // find last occurrence of '#' + wchar_t *idx = wcsrchr(szDevId, L'#'); + if(!idx) + { + szDevId[0] = L'\0'; + return; + } + + // truncate string at last '#' + *idx = L'\0'; + + // replace '#' with '\\' and convert string to upper case + for (wchar_t *p = szDevId; *p; ++p) + { + if (*p == L'#') + { + *p = L'\\'; + } + else + { + *p = towupper((unsigned)*p); + } + } +} static void SystemFavoritesServiceLogMessage (const wstring &errorMessage, WORD wType) { HANDLE eventSource = RegisterEventSource (NULL, TC_SYSTEM_FAVORITES_SERVICE_NAME); @@ -8951,48 +9779,276 @@ static void SystemFavoritesServiceSetStatus (DWORD status, DWORD waitHint = 0) SetServiceStatus (SystemFavoritesServiceStatusHandle, &SystemFavoritesServiceStatus); } +static void SystemFavoritesServiceUpdateLoaderProcessing (BOOL bForce) +{ + SystemFavoritesServiceLogInfo (L"SystemFavoritesServiceUpdateLoaderProcessing called"); + if (bForce || !(BootEncObj->ReadServiceConfigurationFlags () & VC_SYSTEM_FAVORITES_SERVICE_CONFIG_DONT_UPDATE_LOADER)) + { + SystemFavoritesServiceLogInfo (L"SystemFavoritesServiceUpdateLoaderProcessing processing"); + try + { + BootEncryption::UpdateSetupConfigFile (true); + SystemFavoritesServiceLogInfo (L"SystemFavoritesServiceUpdateLoaderProcessing: UpdateSetupConfigFile called"); + if (!BootEncStatus.HiddenSystem) + { + // re-install our bootloader again in case the update process has removed it. + bool bForceSetNextBoot = false; + bool bSetBootentry = true; + bool bForceFirstBootEntry = true; + bool bPostOOBE = true; + if (bForce) + bPostOOBE = false; + else + { + uint32 flags = BootEncObj->ReadServiceConfigurationFlags (); + if (flags & VC_SYSTEM_FAVORITES_SERVICE_CONFIG_FORCE_SET_BOOTNEXT) + bForceSetNextBoot = true; + if (flags & VC_SYSTEM_FAVORITES_SERVICE_CONFIG_DONT_SET_BOOTENTRY) + bSetBootentry = false; + if (flags & VC_SYSTEM_FAVORITES_SERVICE_CONFIG_DONT_FORCE_FIRST_BOOTENTRY) + bForceFirstBootEntry = false; + } + BootEncryption bootEnc (NULL, bPostOOBE, bSetBootentry, bForceFirstBootEntry, bForceSetNextBoot); + SystemFavoritesServiceLogInfo (L"SystemFavoritesServiceUpdateLoaderProcessing: InstallBootLoader calling"); + bootEnc.InstallBootLoader (true); + SystemFavoritesServiceLogInfo (L"SystemFavoritesServiceUpdateLoaderProcessing: InstallBootLoader called"); + } + } + catch (...) + { + } + } +} -static VOID WINAPI SystemFavoritesServiceCtrlHandler (DWORD control) +// Global vector containing all devices previsouly knwon to the system +std::vector<CDevice> g_Devices; + +static DWORD WINAPI SystemFavoritesServiceCtrlHandler ( DWORD dwControl, + DWORD dwEventType, + LPVOID lpEventData, + LPVOID lpContext) { - if (control == SERVICE_CONTROL_STOP) + switch (dwControl) + { + case SERVICE_CONTROL_PRESHUTDOWN: + case SERVICE_CONTROL_STOP: SystemFavoritesServiceSetStatus (SERVICE_STOP_PENDING); - else + + SystemFavoritesServiceUpdateLoaderProcessing (FALSE); + + /* clear VC_DRIVER_CONFIG_CLEAR_KEYS_ON_NEW_DEVICE_INSERTION flag */ + SetDriverConfigurationFlag (VC_DRIVER_CONFIG_CLEAR_KEYS_ON_NEW_DEVICE_INSERTION, FALSE); + SetEvent (SystemFavoriteServiceStopEvent); + SystemFavoritesServiceSetStatus (SERVICE_STOP_PENDING); + + break; + case SERVICE_CONTROL_POWEREVENT: + { + /* perform fixing of bootloader and SetupConfig.ini when the system resumes from sleep */ + if (dwEventType == PBT_APMRESUMEAUTOMATIC) + { + SystemFavoritesServiceUpdateLoaderProcessing (FALSE); + } + } + break; + case SERVICE_CONTROL_SESSIONCHANGE: + { + /* perform fixing of bootloader and SetupConfig.ini when the user logs in or when he unlocks his locked session */ + if ((dwEventType == WTS_SESSION_UNLOCK) || (dwEventType == WTS_SESSION_LOGON)) + { + SystemFavoritesServiceUpdateLoaderProcessing (FALSE); + } + } + break; + case VC_SERVICE_CONTROL_BUILD_DEVICE_LIST: + { + /* build a list of all devices currently connected to the system */ + /* ignore if clear keys configuration is already set */ + if (!(ReadDriverConfigurationFlags() & VC_DRIVER_CONFIG_CLEAR_KEYS_ON_NEW_DEVICE_INSERTION)) + { + SystemFavoritesServiceLogInfo (L"VC_SERVICE_CONTROL_BUILD_DEVICE_LIST received"); + g_Devices.clear (); + BuildDeviceList (g_Devices); + } + } + break; + case SERVICE_CONTROL_DEVICEEVENT: + if (DBT_DEVICEARRIVAL == dwEventType) + { + DEV_BROADCAST_HDR* pHdr = (DEV_BROADCAST_HDR *) lpEventData; + if (pHdr->dbch_devicetype != DBT_DEVTYP_VOLUME && pHdr->dbch_devicetype != DBT_DEVTYP_HANDLE) + { + if (ReadDriverConfigurationFlags() & VC_DRIVER_CONFIG_CLEAR_KEYS_ON_NEW_DEVICE_INSERTION) + { + BOOL bClearKeys = TRUE; + SystemFavoritesServiceLogInfo (L"SERVICE_CONTROL_DEVICEEVENT - DBT_DEVICEARRIVAL received"); + if (pHdr->dbch_devicetype == DBT_DEVTYP_DEVICEINTERFACE) + { + DEV_BROADCAST_DEVICEINTERFACE* pInf = (DEV_BROADCAST_DEVICEINTERFACE*) pHdr; + + if (IsEqualGUID (pInf->dbcc_classguid, OCL_GUID_DEVCLASS_SOFTWARECOMPONENT) + || IsEqualGUID (pInf->dbcc_classguid, GUID_DEVCLASS_VOLUME) + || IsEqualGUID (pInf->dbcc_classguid, GUID_DEVCLASS_VOLUMESNAPSHOT) + ) + { + bClearKeys = FALSE; + } + else + { + WCHAR szDevId[MAX_PATH]; + GetDeviceID(pInf, szDevId); + // device ID must contain "VID_" and "PID_" to be valid and it must not start with "SWD\" or "ROOT\" + if (wcsstr(szDevId, L"VID_") && wcsstr(szDevId, L"PID_") && wcsstr(szDevId, L"SWD\\") != szDevId && wcsstr(szDevId, L"ROOT\\") != szDevId) + { + CDevice dev(szDevId); + // look for the device in the list of devices already known to us and if it is there, then don't clear keys + if (std::find(g_Devices.begin(), g_Devices.end(), dev) != g_Devices.end()) + { + bClearKeys = FALSE; + } + else + { + // trace the device ID of the new device in the log + WCHAR szMsg[2*MAX_PATH]; + StringCbPrintfW(szMsg, sizeof(szMsg), L"SERVICE_CONTROL_DEVICEEVENT - New device ID: %s", szDevId); + SystemFavoritesServiceLogInfo (szMsg); + } + } + else + { + bClearKeys = FALSE; + } + } + } + + if (bClearKeys) + { + DWORD cbBytesReturned = 0; + + DeviceIoControl (hDriver, VC_IOCTL_EMERGENCY_CLEAR_ALL_KEYS, NULL, 0, NULL, 0, &cbBytesReturned, NULL); + } + else + { + SystemFavoritesServiceLogInfo (L"SERVICE_CONTROL_DEVICEEVENT - DBT_DEVICEARRIVAL ignored"); + } + } + } + } + break; + default: SystemFavoritesServiceSetStatus (SystemFavoritesServiceStatus.dwCurrentState); + break; + } + + return NO_ERROR; } +static LONG WINAPI SystemFavoritesServiceExceptionHandler (EXCEPTION_POINTERS *ep) +{ + SetUnhandledExceptionFilter (NULL); + + if (!(ReadDriverConfigurationFlags() & TC_DRIVER_CONFIG_CACHE_BOOT_PASSWORD)) + WipeCache (NULL, TRUE); + + UnhandledExceptionFilter (ep); + return EXCEPTION_EXECUTE_HANDLER; +} + +static void SystemFavoritesServiceInvalidParameterHandler (const wchar_t *expression, const wchar_t *function, const wchar_t *file, unsigned int line, uintptr_t reserved) +{ + TC_THROW_FATAL_EXCEPTION; +} static VOID WINAPI SystemFavoritesServiceMain (DWORD argc, LPTSTR *argv) { BOOL status = FALSE; + DEV_BROADCAST_DEVICEINTERFACE hdr; + BOOL bSkipMount = FALSE; + BOOL bUpdateLoader = FALSE; + DWORD i; memset (&SystemFavoritesServiceStatus, 0, sizeof (SystemFavoritesServiceStatus)); SystemFavoritesServiceStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS; + SystemFavoritesServiceStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP; + SystemFavoritesServiceStatus.dwControlsAccepted |= SERVICE_ACCEPT_PRESHUTDOWN | SERVICE_ACCEPT_SESSIONCHANGE | SERVICE_ACCEPT_POWEREVENT; + + for (i = 1; i < argc; i++) + { + if (0 == _wcsicmp (argv[i], VC_SYSTEM_FAVORITES_SERVICE_ARG_SKIP_MOUNT)) + bSkipMount = TRUE; + else if (0 == _wcsicmp (argv[i], VC_SYSTEM_FAVORITES_SERVICE_ARG_UPDATE_LOADER)) + bUpdateLoader = TRUE; + } - SystemFavoritesServiceStatusHandle = RegisterServiceCtrlHandler (TC_SYSTEM_FAVORITES_SERVICE_NAME, SystemFavoritesServiceCtrlHandler); + ZeroMemory (&hdr, sizeof(hdr)); + hdr.dbcc_size = sizeof (hdr); + hdr.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE; + + SystemFavoritesServiceStatusHandle = RegisterServiceCtrlHandlerEx (TC_SYSTEM_FAVORITES_SERVICE_NAME, SystemFavoritesServiceCtrlHandler, NULL); if (!SystemFavoritesServiceStatusHandle) return; - SystemFavoritesServiceSetStatus (SERVICE_START_PENDING, 120000); + SystemFavoriteServiceStopEvent = CreateEvent (NULL, FALSE, FALSE, NULL); + if (!SystemFavoriteServiceStopEvent) + return; + + SystemFavoriteServiceNotify = RegisterDeviceNotification (SystemFavoritesServiceStatusHandle, &hdr,DEVICE_NOTIFY_SERVICE_HANDLE | DEVICE_NOTIFY_ALL_INTERFACE_CLASSES); - SystemFavoritesServiceLogInfo (wstring (L"Starting System Favorites mounting process")); + SetUnhandledExceptionFilter (SystemFavoritesServiceExceptionHandler); + _set_invalid_parameter_handler (SystemFavoritesServiceInvalidParameterHandler); - try + if (bUpdateLoader) { - status = MountFavoriteVolumes (NULL, TRUE); + SystemFavoritesServiceSetStatus (SERVICE_START_PENDING, 120000); + SystemFavoritesServiceUpdateLoaderProcessing (TRUE); } - catch (...) { } - if (status) + if (!bSkipMount) { - SystemFavoritesServiceLogInfo (wstring (L"System Favorites mounting process finished")); + InitGlobalLocks (); + SystemFavoritesServiceSetStatus (SERVICE_START_PENDING, 120000); + + SystemFavoritesServiceLogInfo (wstring (L"Initializing list of host devices")); + + SystemFavoritesServiceLogInfo (wstring (L"Starting System Favorites mounting process")); + + try + { + status = MountFavoriteVolumes (NULL, TRUE); + } + catch (...) { } + + if (status) + { + SystemFavoritesServiceLogInfo (wstring (L"System Favorites mounting process finished")); + } + else + { + SystemFavoritesServiceLogError (wstring (L"System Favorites mounting process failed.")); + } + + FinalizeGlobalLocks (); + + if (!(ReadDriverConfigurationFlags() & TC_DRIVER_CONFIG_CACHE_BOOT_PASSWORD)) + WipeCache (NULL, TRUE); + + SystemFavoritesServiceUpdateLoaderProcessing (FALSE); } - else + + SystemFavoritesServiceSetStatus (SERVICE_RUNNING); + + WaitForSingleObject (SystemFavoriteServiceStopEvent, INFINITE); + + if (SystemFavoriteServiceNotify) { - SystemFavoritesServiceLogError (wstring (L"System Favorites mounting process failed.")); + UnregisterDeviceNotification (SystemFavoriteServiceNotify); + SystemFavoriteServiceNotify = NULL; } - SystemFavoritesServiceSetStatus (SERVICE_RUNNING); + CloseHandle (SystemFavoriteServiceStopEvent); + SystemFavoriteServiceStopEvent = NULL; + SystemFavoritesServiceSetStatus (SERVICE_STOPPED); } @@ -9003,14 +10059,26 @@ static BOOL StartSystemFavoritesService () DeviceChangeBroadcastDisabled = TRUE; bShowDisconnectedNetworkDrives = TRUE; bHideWaitingDialog = TRUE; bUseSecureDesktop = FALSE; + bUseLegacyMaxPasswordLength = FALSE; InitOSVersionInfo(); if (DriverAttach() != ERR_SUCCESS) return FALSE; + try + { + BootEncObj = new BootEncryption (NULL); + BootEncStatus = BootEncObj->GetStatus(); + bSystemIsGPT = BootEncObj->GetSystemDriveConfiguration().SystemPartition.IsGPT; + } + catch (Exception &) + { + BootEncStatus.DriveMounted = FALSE; + } + SERVICE_TABLE_ENTRY serviceTable[2]; serviceTable[0].lpServiceName = TC_SYSTEM_FAVORITES_SERVICE_NAME; serviceTable[0].lpServiceProc = SystemFavoritesServiceMain; @@ -9018,10 +10086,13 @@ static BOOL StartSystemFavoritesService () serviceTable[1].lpServiceProc = NULL; BOOL result = StartServiceCtrlDispatcher (serviceTable); - if (!(ReadDriverConfigurationFlags() & TC_DRIVER_CONFIG_CACHE_BOOT_PASSWORD)) - WipeCache (NULL, TRUE); + if (BootEncObj != NULL) + { + delete BootEncObj; + BootEncObj = NULL; + } return result; } @@ -9033,17 +10104,34 @@ int WINAPI wWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, wchar_t *lpsz if (argv && argc == 2 && wstring (TC_SYSTEM_FAVORITES_SERVICE_CMDLINE_OPTION) == argv[1]) return StartSystemFavoritesService() ? 0 : 1; + if (argv && argc == 2 && wstring (VC_WINDOWS_UPGRADE_POSTOOBE_CMDLINE_OPTION) == argv[1]) + { + InitOSVersionInfo(); + try + { + BootEncryption::UpdateSetupConfigFile (true); + // re-install our bootloader again in case the upgrade process has removed it. + BootEncryption bootEnc (NULL, true); + bootEnc.InstallBootLoader (true); + } + catch (...) + { + } + return 0; + } + int status; atexit (localcleanup); SetProcessShutdownParameters (0x100, 0); + DeobfuscateMagEndMarker (); VirtualLock (&VolumePassword, sizeof (VolumePassword)); VirtualLock (&CmdVolumePassword, sizeof (CmdVolumePassword)); VirtualLock (&mountOptions, sizeof (mountOptions)); VirtualLock (&defaultMountOptions, sizeof (defaultMountOptions)); - VirtualLock (&szFileName, sizeof(szFileName)); + VirtualLock (&szFileName, sizeof(szFileName)); DetectX86Features (); try @@ -9079,9 +10167,8 @@ int WINAPI wWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, wchar_t *lpsz /* Create the main dialog box */ DialogBoxParamW (hInstance, MAKEINTRESOURCEW (IDD_MOUNT_DLG), NULL, (DLGPROC) MainDialogProc, (LPARAM) lpszCommandLine); - FinalizeApp (); /* Terminate */ return 0; } #endif @@ -9117,9 +10204,9 @@ BOOL TaskBarIconAdd (HWND hwnd) ScreenDPI >= 120 ? 0 : 16, ScreenDPI >= 120 ? 0 : 16, (ScreenDPI >= 120 ? LR_DEFAULTSIZE : 0) | LR_SHARED - | (nCurrentOS != WIN_2000 ? LR_DEFAULTCOLOR : LR_VGACOLOR)); // Windows 2000 cannot display more than 16 fixed colors in notification tray + | LR_DEFAULTCOLOR); StringCbCopyW (tnid.szTip, sizeof(tnid.szTip), L"VeraCrypt"); return Shell_NotifyIconW (NIM_ADD, &tnid); @@ -9169,9 +10256,9 @@ BOOL TaskBarIconChange (HWND hwnd, int iconId) ScreenDPI >= 120 ? 0 : 16, ScreenDPI >= 120 ? 0 : 16, (ScreenDPI >= 120 ? LR_DEFAULTSIZE : 0) | LR_SHARED - | (nCurrentOS != WIN_2000 ? LR_DEFAULTCOLOR : LR_VGACOLOR)); // Windows 2000 cannot display more than 16 fixed colors in notification tray + | LR_DEFAULTCOLOR); return Shell_NotifyIcon (NIM_MODIFY, &tnid); } @@ -9232,9 +10319,9 @@ void DismountIdleVolumes () if (bWipeCacheOnAutoDismount) { DeviceIoControl (hDriver, TC_IOCTL_WIPE_PASSWORD_CACHE, NULL, 0, NULL, 0, &dwResult, NULL); - SecurityToken::CloseAllSessions(); + SecurityToken::CloseAllSessions(); // TODO Use Token } } } } @@ -9276,9 +10363,9 @@ static BOOL MountFavoriteVolumeBase (HWND hwnd, const FavoriteVolume &favorite, ZeroMemory (mountOptions.Label, sizeof (mountOptions.Label)); if (favorite.UseVolumeID && !IsRepeatedByteArray (0, favorite.VolumeID, sizeof (favorite.VolumeID))) { - effectiveVolumePath = FindDeviceByVolumeID (favorite.VolumeID); + effectiveVolumePath = FindDeviceByVolumeID (favorite.VolumeID, (ServiceMode && systemFavorites)? TRUE : FALSE); } else effectiveVolumePath = favorite.Path; @@ -9328,9 +10415,9 @@ static BOOL MountFavoriteVolumeBase (HWND hwnd, const FavoriteVolume &favorite, mountOptions.ProtectedHidVolPkcs5Prf = DefaultVolumePkcs5; else mountOptions.ProtectedHidVolPkcs5Prf = CmdVolumePkcs5; mountOptions.ProtectedHidVolPim = CmdVolumePim; - if (DialogBoxParamW (hInst, MAKEINTRESOURCEW (IDD_MOUNT_OPTIONS), hwnd, (DLGPROC) MountOptionsDlgProc, (LPARAM) &mountOptions) == IDCANCEL) + if (Silent || (SecureDesktopDialogBoxParam (hInst, MAKEINTRESOURCEW (IDD_MOUNT_OPTIONS), hwnd, (DLGPROC) MountOptionsDlgProc, (LPARAM) &mountOptions) == IDCANCEL)) { status = FALSE; goto skipMount; } @@ -9340,9 +10427,9 @@ static BOOL MountFavoriteVolumeBase (HWND hwnd, const FavoriteVolume &favorite, if (ServiceMode) SystemFavoritesServiceLogInfo (wstring (L"Mounting system favorite \"") + effectiveVolumePath + L"\""); - status = Mount (hwnd, drive, (wchar_t *) effectiveVolumePath.c_str(), favorite.Pim, favorite.Pkcs5, favorite.TrueCryptMode); + status = Mount (hwnd, drive, (wchar_t *) effectiveVolumePath.c_str(), favorite.Pim, favorite.Pkcs5); if (ServiceMode) { // Update the service status to avoid being killed @@ -9416,8 +10503,9 @@ BOOL MountFavoriteVolumes (HWND hwnd, BOOL systemFavorites, BOOL logOnMount, BOO LoadDriveLetters (MainDlg, GetDlgItem (MainDlg, IDC_DRIVELIST), 0); } mountOptions = defaultMountOptions; + mountOptions.SkipCachedPasswords = FALSE; VolumePassword.Length = 0; MultipleMountOperationInProgress = (favoriteVolumeToMount.Path.empty() || FavoriteMountOnArrivalInProgress); @@ -9442,9 +10530,9 @@ BOOL MountFavoriteVolumes (HWND hwnd, BOOL systemFavorites, BOOL logOnMount, BOO favorite != favorites.end(); favorite++) { if (favorite->UseVolumeID) { - std::wstring path = FindDeviceByVolumeID (favorite->VolumeID); + std::wstring path = FindDeviceByVolumeID (favorite->VolumeID, TRUE); if (path.empty ()) { favorite->DisconnectedDevice = true; } @@ -9517,9 +10605,9 @@ BOOL MountFavoriteVolumes (HWND hwnd, BOOL systemFavorites, BOOL logOnMount, BOO // check if the favorite is here and get its path wstring resolvedPath; if (favorite->UseVolumeID) { - resolvedPath = FindDeviceByVolumeID (favorite->VolumeID); + resolvedPath = FindDeviceByVolumeID (favorite->VolumeID, TRUE); } else resolvedPath = VolumeGuidPathToDevicePath (favorite->Path); if (!resolvedPath.empty()) @@ -9557,12 +10645,11 @@ BOOL MountFavoriteVolumes (HWND hwnd, BOOL systemFavorites, BOOL logOnMount, BOO MultipleMountOperationInProgress = FALSE; burn (&VolumePassword, sizeof (VolumePassword)); burn (&VolumePkcs5, sizeof (VolumePkcs5)); burn (&VolumePim, sizeof (VolumePim)); - burn (&VolumeTrueCryptMode, sizeof (VolumeTrueCryptMode)); if (bRet && CloseSecurityTokenSessionsAfterMount) - SecurityToken::CloseAllSessions(); + SecurityToken::CloseAllSessions(); // TODO Use Token return bRet; } @@ -9585,8 +10672,9 @@ void CALLBACK mountFavoriteVolumeCallbackFunction (void *pArg, HWND hwnd) void __cdecl mountFavoriteVolumeThreadFunction (void *pArg) { ShowWaitDialog (MainDlg, FALSE, mountFavoriteVolumeCallbackFunction, pArg); + _InterlockedExchange(&FavoriteMountOnGoing, 0); } static void SaveDefaultKeyFilesParam (HWND hwnd) { @@ -9713,30 +10801,33 @@ static void HandleHotKey (HWND hwndDlg, WPARAM wParam) if (bPlaySoundOnSuccessfulHkDismount) MessageBeep (0xFFFFFFFF); } TaskBarIconRemove (hwndDlg); - UnregisterWtsNotification(hwndDlg); + UnregisterWtsAndPowerNotification(hwndDlg); EndMainDlg (hwndDlg); break; case HK_MOUNT_FAVORITE_VOLUMES: { - mountFavoriteVolumeThreadParam* pParam = (mountFavoriteVolumeThreadParam*) calloc(1, sizeof(mountFavoriteVolumeThreadParam)); - pParam->systemFavorites = FALSE; - pParam->logOnMount = FALSE; - pParam->hotKeyMount = TRUE; - pParam->favoriteVolumeToMount = NULL; + if (0 == _InterlockedCompareExchange(&FavoriteMountOnGoing, 1, 0)) + { + mountFavoriteVolumeThreadParam* pParam = (mountFavoriteVolumeThreadParam*) calloc(1, sizeof(mountFavoriteVolumeThreadParam)); + pParam->systemFavorites = FALSE; + pParam->logOnMount = FALSE; + pParam->hotKeyMount = TRUE; + pParam->favoriteVolumeToMount = NULL; - _beginthread(mountFavoriteVolumeThreadFunction, 0, pParam); + _beginthread(mountFavoriteVolumeThreadFunction, 0, pParam); + } } break; case HK_SHOW_HIDE_MAIN_WINDOW: ChangeMainWindowVisibility (); break; case HK_CLOSE_SECURITY_TOKEN_SESSIONS: - SecurityToken::CloseAllSessions(); + SecurityToken::CloseAllSessions(); // TODO Use Token InfoBalloon (NULL, "ALL_TOKEN_SESSIONS_CLOSED", hwndDlg); break; @@ -9766,10 +10857,10 @@ int BackupVolumeHeader (HWND hwndDlg, BOOL bRequireConfirmation, const wchar_t * OpenVolumeContext volume; OpenVolumeContext hiddenVolume; Password hiddenVolPassword; int hiddenVolPkcs5 = 0, hiddenVolPim = 0; - CRYPTOPP_ALIGN_DATA(16) byte temporaryKey[MASTER_KEYDATA_SIZE]; - CRYPTOPP_ALIGN_DATA(16) byte originalK2[MASTER_KEYDATA_SIZE]; + CRYPTOPP_ALIGN_DATA(16) uint8 temporaryKey[MASTER_KEYDATA_SIZE]; + CRYPTOPP_ALIGN_DATA(16) uint8 originalK2[MASTER_KEYDATA_SIZE]; int EffectiveVolumePkcs5 = CmdVolumePkcs5; int EffectiveVolumePim = CmdVolumePim; /* Priority is given to command line parameters @@ -9826,9 +10917,9 @@ int BackupVolumeHeader (HWND hwndDlg, BOOL bRequireConfirmation, const wchar_t * while (TRUE) { int GuiPkcs5 = ((EffectiveVolumePkcs5 > 0) && (*askPkcs5 == 0))? EffectiveVolumePkcs5 : *askPkcs5; int GuiPim = ((EffectiveVolumePim > 0) && (*askPim <= 0))? EffectiveVolumePim : *askPim; - if (!AskVolumePassword (hwndDlg, askPassword, &GuiPkcs5, &GuiPim, &VolumeTrueCryptMode, type == TC_VOLUME_TYPE_HIDDEN ? "ENTER_HIDDEN_VOL_PASSWORD" : "ENTER_NORMAL_VOL_PASSWORD", FALSE)) + if (!AskVolumePassword (hwndDlg, askPassword, &GuiPkcs5, &GuiPim, type == TC_VOLUME_TYPE_HIDDEN ? "ENTER_HIDDEN_VOL_PASSWORD" : "ENTER_NORMAL_VOL_PASSWORD", FALSE)) { nStatus = ERR_SUCCESS; goto ret; } @@ -9844,9 +10935,9 @@ int BackupVolumeHeader (HWND hwndDlg, BOOL bRequireConfirmation, const wchar_t * if (KeyFilesEnable && FirstKeyFile) KeyFilesApply (hwndDlg, askPassword, FirstKeyFile, lpszVolume); - nStatus = OpenVolume (askVol, lpszVolume, askPassword, *askPkcs5, *askPim, VolumeTrueCryptMode, FALSE, bPreserveTimestamp, FALSE); + nStatus = OpenVolume (askVol, lpszVolume, askPassword, *askPkcs5, *askPim, FALSE, bPreserveTimestamp, FALSE); NormalCursor(); if (nStatus == ERR_SUCCESS) @@ -9901,9 +10992,9 @@ noHidden: && (MessageBoxW (hwndDlg, szTmp, lpszTitle, YES_NO|MB_ICONQUESTION|MB_DEFBUTTON1) == IDNO)) goto ret; /* Select backup file */ - if (!BrowseFiles (hwndDlg, "OPEN_TITLE", szFileName, bHistory, TRUE, NULL)) + if (!BrowseFiles (hwndDlg, "OPEN_TITLE", szFileName, bHistory, TRUE)) goto ret; /* Conceive the backup file */ if ((fBackup = _wopen(szFileName, _O_CREAT|_O_TRUNC|_O_WRONLY|_O_BINARY, _S_IREAD|_S_IWRITE)) == -1) @@ -9913,9 +11004,9 @@ noHidden: } // Backup headers - byte backup[TC_VOLUME_HEADER_GROUP_SIZE]; + uint8 backup[TC_VOLUME_HEADER_GROUP_SIZE]; bool legacyVolume = volume.CryptoInfo->LegacyVolume ? true : false; int backupFileSize = legacyVolume ? TC_VOLUME_HEADER_SIZE_LEGACY * 2 : TC_VOLUME_HEADER_GROUP_SIZE; @@ -9945,31 +11036,31 @@ noHidden: nStatus = ERR_PARAMETER_INCORRECT; goto error; } - if (EAInit (volume.CryptoInfo->ea, temporaryKey, volume.CryptoInfo->ks) != ERR_SUCCESS || !EAInitMode (volume.CryptoInfo)) + if (EAInit (volume.CryptoInfo->ea, temporaryKey, volume.CryptoInfo->ks) != ERR_SUCCESS || !EAInitMode (volume.CryptoInfo, volume.CryptoInfo->k2)) { nStatus = ERR_PARAMETER_INCORRECT; goto error; } EncryptBuffer (backup, backupFileSize, volume.CryptoInfo); memcpy (volume.CryptoInfo->k2, originalK2, sizeof (volume.CryptoInfo->k2)); - if (EAInit (volume.CryptoInfo->ea, volume.CryptoInfo->master_keydata, volume.CryptoInfo->ks) != ERR_SUCCESS || !EAInitMode (volume.CryptoInfo)) + if (EAInit (volume.CryptoInfo->ea, volume.CryptoInfo->master_keydata, volume.CryptoInfo->ks) != ERR_SUCCESS || !EAInitMode (volume.CryptoInfo, volume.CryptoInfo->k2)) { nStatus = ERR_PARAMETER_INCORRECT; goto error; } // Store header encrypted with a new key - nStatus = ReEncryptVolumeHeader (hwndDlg, (char *) backup, FALSE, volume.CryptoInfo, &VolumePassword, VolumePim, FALSE); + nStatus = ReEncryptVolumeHeader (hwndDlg, backup, FALSE, volume.CryptoInfo, &VolumePassword, VolumePim, FALSE); if (nStatus != ERR_SUCCESS) goto error; if (hiddenVolume.VolumeIsOpen) { - nStatus = ReEncryptVolumeHeader (hwndDlg, (char *) backup + (legacyVolume ? TC_VOLUME_HEADER_SIZE_LEGACY : TC_VOLUME_HEADER_SIZE), + nStatus = ReEncryptVolumeHeader (hwndDlg, backup + (legacyVolume ? TC_VOLUME_HEADER_SIZE_LEGACY : TC_VOLUME_HEADER_SIZE), FALSE, hiddenVolume.CryptoInfo, &hiddenVolPassword, hiddenVolPim, FALSE); if (nStatus != ERR_SUCCESS) goto error; @@ -10002,9 +11093,8 @@ error: burn (&VolumePassword, sizeof (VolumePassword)); burn (&VolumePkcs5, sizeof (VolumePkcs5)); burn (&VolumePim, sizeof (VolumePim)); - burn (&VolumeTrueCryptMode, sizeof (VolumeTrueCryptMode)); burn (&hiddenVolPassword, sizeof (hiddenVolPassword)); burn (temporaryKey, sizeof (temporaryKey)); burn (originalK2, sizeof (originalK2)); @@ -10019,9 +11109,9 @@ error: int RestoreVolumeHeader (HWND hwndDlg, const wchar_t *lpszVolume) { int nDosLinkCreated = -1, nStatus = ERR_OS_ERROR; wchar_t szDiskFile[TC_MAX_PATH], szCFDevice[TC_MAX_PATH]; - wchar_t szFileName[TC_MAX_PATH]; + wchar_t szHeaderFileName[TC_MAX_PATH]; wchar_t szDosDevice[TC_MAX_PATH]; void *dev = INVALID_HANDLE_VALUE; DWORD dwError; BOOL bDevice; @@ -10114,9 +11204,9 @@ int RestoreVolumeHeader (HWND hwndDlg, const wchar_t *lpszVolume) { int GuiPkcs5 = ((EffectiveVolumePkcs5 > 0) && (VolumePkcs5 == 0))? EffectiveVolumePkcs5 : VolumePkcs5; int GuiPim = ((EffectiveVolumePim > 0) && (VolumePim <= 0))? EffectiveVolumePim : VolumePim; StringCbCopyW (PasswordDlgVolume, sizeof(PasswordDlgVolume), lpszVolume); - if (!AskVolumePassword (hwndDlg, &VolumePassword, &GuiPkcs5, &GuiPim, &VolumeTrueCryptMode, NULL, FALSE)) + if (!AskVolumePassword (hwndDlg, &VolumePassword, &GuiPkcs5, &GuiPim, NULL, FALSE)) { nStatus = ERR_SUCCESS; goto ret; } @@ -10132,9 +11222,9 @@ int RestoreVolumeHeader (HWND hwndDlg, const wchar_t *lpszVolume) if (KeyFilesEnable && FirstKeyFile) KeyFilesApply (hwndDlg, &VolumePassword, FirstKeyFile, lpszVolume); - nStatus = OpenVolume (&volume, lpszVolume, &VolumePassword, VolumePkcs5, VolumePim, VolumeTrueCryptMode,TRUE, bPreserveTimestamp, TRUE); + nStatus = OpenVolume (&volume, lpszVolume, &VolumePassword, VolumePkcs5, VolumePim,TRUE, bPreserveTimestamp, TRUE); NormalCursor(); if (nStatus == ERR_SUCCESS) @@ -10153,9 +11243,9 @@ int RestoreVolumeHeader (HWND hwndDlg, const wchar_t *lpszVolume) goto error; } // Create a new header with a new salt - char buffer[TC_VOLUME_HEADER_EFFECTIVE_SIZE]; + unsigned char buffer[TC_VOLUME_HEADER_EFFECTIVE_SIZE]; nStatus = ReEncryptVolumeHeader (hwndDlg, buffer, FALSE, volume.CryptoInfo, &VolumePassword, VolumePim, FALSE); if (nStatus != 0) goto error; @@ -10166,9 +11256,9 @@ int RestoreVolumeHeader (HWND hwndDlg, const wchar_t *lpszVolume) nStatus = ERR_OS_ERROR; goto error; } - if (!WriteEffectiveVolumeHeader (volume.IsDevice, volume.HostFileHandle, (byte *) buffer)) + if (!WriteEffectiveVolumeHeader (volume.IsDevice, volume.HostFileHandle, (uint8 *) buffer)) { nStatus = ERR_OS_ERROR; goto error; } @@ -10185,16 +11275,16 @@ int RestoreVolumeHeader (HWND hwndDlg, const wchar_t *lpszVolume) goto ret; } /* Select backup file */ - if (!BrowseFiles (hwndDlg, "OPEN_TITLE", szFileName, bHistory, FALSE, NULL)) + if (!BrowseFiles (hwndDlg, "OPEN_TITLE", szHeaderFileName, bHistory, FALSE)) { nStatus = ERR_SUCCESS; goto ret; } /* Open the backup file */ - fBackup = CreateFile (szFileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); + fBackup = CreateFile (szHeaderFileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); if (fBackup == INVALID_HANDLE_VALUE) { nStatus = ERR_OS_ERROR; goto error; @@ -10226,8 +11316,23 @@ int RestoreVolumeHeader (HWND hwndDlg, const wchar_t *lpszVolume) { nStatus = ERR_OS_ERROR; goto error; } + else if (!bDevice && bPreserveTimestamp) + { + // ensure that Last Access timestamp is not modified + ftLastAccessTime.dwHighDateTime = 0xFFFFFFFF; + ftLastAccessTime.dwLowDateTime = 0xFFFFFFFF; + + SetFileTime (dev, NULL, &ftLastAccessTime, NULL); + + /* Remember the container modification/creation date and time. */ + + if (GetFileTime ((HANDLE) dev, &ftCreationTime, &ftLastAccessTime, &ftLastWriteTime) == 0) + bTimeStampValid = FALSE; + else + bTimeStampValid = TRUE; + } // Determine volume host size if (bDevice) { @@ -10242,18 +11347,42 @@ int RestoreVolumeHeader (HWND hwndDlg, const wchar_t *lpszVolume) hostSize = diskInfo.PartitionLength.QuadPart; } else { - DISK_GEOMETRY driveInfo; + BYTE dgBuffer[256]; - bResult = DeviceIoControl (dev, IOCTL_DISK_GET_DRIVE_GEOMETRY, NULL, 0, - &driveInfo, sizeof (driveInfo), &dwResult, NULL); + bResult = DeviceIoControl (dev, IOCTL_DISK_GET_DRIVE_GEOMETRY_EX, NULL, 0, + dgBuffer, sizeof (dgBuffer), &dwResult, NULL); if (!bResult) - goto error; + { + DISK_GEOMETRY geo; + if (DeviceIoControl (dev, IOCTL_DISK_GET_DRIVE_GEOMETRY, NULL, 0, (LPVOID) &geo, sizeof (geo), &dwResult, NULL)) + { + hostSize = geo.Cylinders.QuadPart * geo.SectorsPerTrack * geo.TracksPerCylinder * geo.BytesPerSector; - hostSize = driveInfo.Cylinders.QuadPart * driveInfo.BytesPerSector * - driveInfo.SectorsPerTrack * driveInfo.TracksPerCylinder; + if (CurrentOSMajor >= 6) + { + STORAGE_READ_CAPACITY storage = {0}; + + storage.Version = sizeof (STORAGE_READ_CAPACITY); + storage.Size = sizeof (STORAGE_READ_CAPACITY); + if (DeviceIoControl (dev, IOCTL_STORAGE_READ_CAPACITY, NULL, 0, (LPVOID) &storage, sizeof (storage), &dwResult, NULL) + && (dwResult >= sizeof (storage)) + && (storage.Size == sizeof (STORAGE_READ_CAPACITY)) + ) + { + hostSize = storage.DiskLength.QuadPart; + } + } + } + else + { + goto error; + } + } + else + hostSize = ((PDISK_GEOMETRY_EX) dgBuffer)->DiskSize.QuadPart; } if (hostSize == 0) { @@ -10272,20 +11401,11 @@ int RestoreVolumeHeader (HWND hwndDlg, const wchar_t *lpszVolume) hostSize = fileSize.QuadPart; } - if (!bDevice && bPreserveTimestamp) - { - /* Remember the container modification/creation date and time. */ - - if (GetFileTime ((HANDLE) dev, &ftCreationTime, &ftLastAccessTime, &ftLastWriteTime) == 0) - bTimeStampValid = FALSE; - else - bTimeStampValid = TRUE; - } /* Read the volume header from the backup file */ - char buffer[TC_VOLUME_HEADER_GROUP_SIZE]; + unsigned char buffer[TC_VOLUME_HEADER_GROUP_SIZE]; DWORD bytesRead; if (!ReadFile (fBackup, buffer, sizeof (buffer), &bytesRead, NULL)) { @@ -10298,9 +11418,8 @@ int RestoreVolumeHeader (HWND hwndDlg, const wchar_t *lpszVolume) nStatus = ERR_VOL_SIZE_WRONG; goto error; } - LARGE_INTEGER headerOffset; LARGE_INTEGER headerBackupOffset; bool legacyBackup; int headerOffsetBackupFile; @@ -10325,9 +11444,9 @@ int RestoreVolumeHeader (HWND hwndDlg, const wchar_t *lpszVolume) while (TRUE) { int GuiPkcs5 = ((EffectiveVolumePkcs5 > 0) && (VolumePkcs5 == 0))? EffectiveVolumePkcs5 : VolumePkcs5; int GuiPim = ((EffectiveVolumePim > 0) && (VolumePim <= 0))? EffectiveVolumePim : VolumePim; - if (!AskVolumePassword (hwndDlg, &VolumePassword, &GuiPkcs5, &GuiPim, &VolumeTrueCryptMode, "ENTER_HEADER_BACKUP_PASSWORD", FALSE)) + if (!AskVolumePassword (hwndDlg, &VolumePassword, &GuiPkcs5, &GuiPim, "ENTER_HEADER_BACKUP_PASSWORD", FALSE)) { nStatus = ERR_SUCCESS; goto ret; } @@ -10348,9 +11467,9 @@ int RestoreVolumeHeader (HWND hwndDlg, const wchar_t *lpszVolume) { if (type == TC_VOLUME_TYPE_HIDDEN) headerOffsetBackupFile += (legacyBackup ? TC_VOLUME_HEADER_SIZE_LEGACY : TC_VOLUME_HEADER_SIZE); - nStatus = ReadVolumeHeader (FALSE, buffer + headerOffsetBackupFile, &VolumePassword, VolumePkcs5, VolumePim, VolumeTrueCryptMode, &restoredCryptoInfo, NULL); + nStatus = ReadVolumeHeader (FALSE, buffer + headerOffsetBackupFile, &VolumePassword, VolumePkcs5, VolumePim, &restoredCryptoInfo, NULL); if (nStatus == ERR_SUCCESS) break; } @@ -10362,8 +11481,14 @@ int RestoreVolumeHeader (HWND hwndDlg, const wchar_t *lpszVolume) handleError (hwndDlg, nStatus, SRC_POS); } + // display a warning if the master key is vulnerable + if (restoredCryptoInfo->bVulnerableMasterKey) + { + Warning ("ERR_XTS_MASTERKEY_VULNERABLE", hwndDlg); + } + BOOL hiddenVol = restoredCryptoInfo->hiddenVolume; if (legacyBackup) { @@ -10387,9 +11512,9 @@ int RestoreVolumeHeader (HWND hwndDlg, const wchar_t *lpszVolume) nStatus = ERR_OS_ERROR; goto error; } - if (!WriteEffectiveVolumeHeader (bDevice, dev, (byte *) buffer)) + if (!WriteEffectiveVolumeHeader (bDevice, dev, (uint8 *) buffer)) { nStatus = ERR_OS_ERROR; goto error; } @@ -10406,9 +11531,9 @@ int RestoreVolumeHeader (HWND hwndDlg, const wchar_t *lpszVolume) nStatus = ERR_OS_ERROR; goto error; } - if (!WriteEffectiveVolumeHeader (bDevice, dev, (byte *) buffer)) + if (!WriteEffectiveVolumeHeader (bDevice, dev, (uint8 *) buffer)) { nStatus = ERR_OS_ERROR; goto error; } @@ -10454,9 +11579,8 @@ error: burn (&VolumePassword, sizeof (VolumePassword)); burn (&VolumePkcs5, sizeof (VolumePkcs5)); burn (&VolumePim, sizeof (VolumePim)); - burn (&VolumeTrueCryptMode, sizeof (VolumeTrueCryptMode)); RestoreDefaultKeyFilesParam(); RandStop (FALSE); NormalCursor(); @@ -10465,14 +11589,34 @@ error: void SetDriverConfigurationFlag (uint32 flag, BOOL state) { - BootEncObj->SetDriverConfigurationFlag (flag, state ? true : false); + if (BootEncObj) + BootEncObj->SetDriverConfigurationFlag (flag, state ? true : false); +} + +void SetServiceConfigurationFlag (uint32 flag, BOOL state) +{ + if (BootEncObj) + BootEncObj->SetServiceConfigurationFlag (flag, state ? true : false); +} + +void SetMemoryProtectionConfig (BOOL bEnable) +{ + DWORD config = bEnable? 1: 0; + if (BootEncObj) + BootEncObj->WriteLocalMachineRegistryDwordValue (L"SYSTEM\\CurrentControlSet\\Services\\veracrypt", VC_ENABLE_MEMORY_PROTECTION, config); } +void NotifyService (DWORD dwNotifyCmd) +{ + if (BootEncObj) + BootEncObj->NotifyService (dwNotifyCmd); +} static BOOL CALLBACK PerformanceSettingsDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { + static HWND hDisableMemProtectionTooltipWnd = NULL; WORD lw = LOWORD (wParam); switch (msg) { @@ -10482,29 +11626,61 @@ static BOOL CALLBACK PerformanceSettingsDlgProc (HWND hwndDlg, UINT msg, WPARAM uint32 driverConfig = ReadDriverConfigurationFlags(); CheckDlgButton (hwndDlg, IDC_ENABLE_HARDWARE_ENCRYPTION, (driverConfig & TC_DRIVER_CONFIG_DISABLE_HARDWARE_ENCRYPTION) ? BST_UNCHECKED : BST_CHECKED); CheckDlgButton (hwndDlg, IDC_ENABLE_EXTENDED_IOCTL_SUPPORT, (driverConfig & TC_DRIVER_CONFIG_ENABLE_EXTENDED_IOCTL) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton (hwndDlg, IDC_ALLOW_TRIM_NONSYS_SSD, (driverConfig & VC_DRIVER_CONFIG_ALLOW_NONSYS_TRIM) ? BST_CHECKED : BST_UNCHECKED); + // checkbox for Windows Defragmenter only usuable starting from Windows 8.1 + // on previous versions, we can not control Windows defragmenter so + // this settings is always checked. + if (IsOSAtLeast (WIN_8_1)) + CheckDlgButton (hwndDlg, IDC_ALLOW_WINDOWS_DEFRAG, (driverConfig & VC_DRIVER_CONFIG_ALLOW_WINDOWS_DEFRAG) ? BST_CHECKED : BST_UNCHECKED); + else + { + CheckDlgButton (hwndDlg, IDC_ALLOW_WINDOWS_DEFRAG, BST_CHECKED); + EnableWindow (GetDlgItem (hwndDlg, IDC_ALLOW_WINDOWS_DEFRAG), FALSE); + } - SYSTEM_INFO sysInfo; - GetSystemInfo (&sysInfo); + if (IsCpuRngSupported()) + { + CheckDlgButton (hwndDlg, IDC_ENABLE_CPU_RNG, (driverConfig & VC_DRIVER_CONFIG_ENABLE_CPU_RNG) ? BST_CHECKED : BST_UNCHECKED); + } + else + { + CheckDlgButton (hwndDlg, IDC_ENABLE_CPU_RNG, BST_UNCHECKED); + EnableWindow (GetDlgItem (hwndDlg, IDC_ENABLE_CPU_RNG), FALSE); + } + + if (IsRamEncryptionSupported()) + { + CheckDlgButton (hwndDlg, IDC_ENABLE_RAM_ENCRYPTION, (driverConfig & VC_DRIVER_CONFIG_ENABLE_RAM_ENCRYPTION) ? BST_CHECKED : BST_UNCHECKED); + } + else + { + CheckDlgButton (hwndDlg, IDC_ENABLE_RAM_ENCRYPTION, BST_UNCHECKED); + EnableWindow (GetDlgItem (hwndDlg, IDC_ENABLE_RAM_ENCRYPTION), FALSE); + } + + CheckDlgButton (hwndDlg, IDC_DISABLE_MEMORY_PROTECTION, ReadMemoryProtectionConfig() ? BST_UNCHECKED : BST_CHECKED); + + size_t cpuCount = GetCpuCount(NULL); HWND freeCpuCombo = GetDlgItem (hwndDlg, IDC_ENCRYPTION_FREE_CPU_COUNT); uint32 encryptionFreeCpuCount = ReadEncryptionThreadPoolFreeCpuCountLimit(); - if (encryptionFreeCpuCount > sysInfo.dwNumberOfProcessors - 1) - encryptionFreeCpuCount = sysInfo.dwNumberOfProcessors - 1; + if (encryptionFreeCpuCount > (uint32) (cpuCount - 1)) + encryptionFreeCpuCount = (uint32) (cpuCount - 1); - for (uint32 i = 1; i < sysInfo.dwNumberOfProcessors; ++i) + for (uint32 i = 1; i < cpuCount; ++i) { wstringstream s; s << i; AddComboPair (freeCpuCombo, s.str().c_str(), i); } - if (sysInfo.dwNumberOfProcessors < 2 || encryptionFreeCpuCount == 0) + if (cpuCount < 2 || encryptionFreeCpuCount == 0) EnableWindow (freeCpuCombo, FALSE); - if (sysInfo.dwNumberOfProcessors < 2) + if (cpuCount < 2) EnableWindow (GetDlgItem (hwndDlg, IDC_LIMIT_ENC_THREAD_POOL), FALSE); if (encryptionFreeCpuCount != 0) { @@ -10513,15 +11689,30 @@ static BOOL CALLBACK PerformanceSettingsDlgProc (HWND hwndDlg, UINT msg, WPARAM } SetWindowTextW (GetDlgItem (hwndDlg, IDT_LIMIT_ENC_THREAD_POOL_NOTE), GetString("LIMIT_ENC_THREAD_POOL_NOTE")); - SetDlgItemTextW (hwndDlg, IDC_HW_AES_SUPPORTED_BY_CPU, (wstring (L" ") + (GetString (is_aes_hw_cpu_supported() ? "UISTR_YES" : "UISTR_NO"))).c_str()); + SetDlgItemTextW (hwndDlg, IDC_HW_AES_SUPPORTED_BY_CPU, (wstring (L" ") + (GetString (HasAESNI() ? "UISTR_YES" : "UISTR_NO"))).c_str()); ToHyperlink (hwndDlg, IDC_MORE_INFO_ON_HW_ACCELERATION); ToHyperlink (hwndDlg, IDC_MORE_INFO_ON_THREAD_BASED_PARALLELIZATION); + + hDisableMemProtectionTooltipWnd = CreateToolTip (IDC_DISABLE_MEMORY_PROTECTION, hwndDlg, "DISABLE_MEMORY_PROTECTION_WARNING"); + // make IDC_DISABLE_MEMORY_PROTECTION control fit the text so that the tooltip is shown only when mouse is over the text + AccommodateCheckBoxTextWidth(hwndDlg, IDC_DISABLE_MEMORY_PROTECTION); + // make the help button adjacent to the checkbox + MakeControlsContiguous(hwndDlg, IDC_DISABLE_MEMORY_PROTECTION, IDC_DISABLE_MEMORY_PROTECTION_HELP); } return 0; + // handle message to destroy hDisableMemProtectionTooltipWnd when the dialog is closed + case WM_DESTROY: + if (hDisableMemProtectionTooltipWnd) + { + DestroyWindow (hDisableMemProtectionTooltipWnd); + hDisableMemProtectionTooltipWnd = NULL; + } + break; + case WM_COMMAND: switch (lw) { @@ -10538,13 +11729,21 @@ static BOOL CALLBACK PerformanceSettingsDlgProc (HWND hwndDlg, UINT msg, WPARAM return 1; } BOOL disableHW = !IsDlgButtonChecked (hwndDlg, IDC_ENABLE_HARDWARE_ENCRYPTION); + BOOL enableCpuRng = IsDlgButtonChecked (hwndDlg, IDC_ENABLE_CPU_RNG); + BOOL enableRamEncryption = IsDlgButtonChecked (hwndDlg, IDC_ENABLE_RAM_ENCRYPTION); BOOL enableExtendedIOCTL = IsDlgButtonChecked (hwndDlg, IDC_ENABLE_EXTENDED_IOCTL_SUPPORT); + BOOL allowTrimCommand = IsDlgButtonChecked (hwndDlg, IDC_ALLOW_TRIM_NONSYS_SSD); + BOOL allowWindowsDefrag = IsDlgButtonChecked (hwndDlg, IDC_ALLOW_WINDOWS_DEFRAG); + BOOL disableMemoryProtection = IsDlgButtonChecked (hwndDlg, IDC_DISABLE_MEMORY_PROTECTION); try { VOLUME_PROPERTIES_STRUCT prop; + bool rebootRequired = false; + uint32 driverConfig = ReadDriverConfigurationFlags(); + try { BootEncStatus = BootEncObj->GetStatus(); BootEncObj->GetVolumeProperties (&prop); @@ -10555,9 +11754,9 @@ static BOOL CALLBACK PerformanceSettingsDlgProc (HWND hwndDlg, UINT msg, WPARAM } if (BootEncStatus.DriveMounted && !bSystemIsGPT) { - byte userConfig; + uint8 userConfig; string customUserMessage; uint16 bootLoaderVersion; if (!BootEncObj->ReadBootSectorConfig (nullptr, 0, &userConfig, &customUserMessage, &bootLoaderVersion)) @@ -10575,14 +11774,48 @@ static BOOL CALLBACK PerformanceSettingsDlgProc (HWND hwndDlg, UINT msg, WPARAM } SetDriverConfigurationFlag (TC_DRIVER_CONFIG_DISABLE_HARDWARE_ENCRYPTION, disableHW); SetDriverConfigurationFlag (TC_DRIVER_CONFIG_ENABLE_EXTENDED_IOCTL, enableExtendedIOCTL); + SetDriverConfigurationFlag (VC_DRIVER_CONFIG_ALLOW_NONSYS_TRIM, allowTrimCommand); + if (IsOSAtLeast (WIN_8_1)) + SetDriverConfigurationFlag (VC_DRIVER_CONFIG_ALLOW_WINDOWS_DEFRAG, allowWindowsDefrag); + SetDriverConfigurationFlag (VC_DRIVER_CONFIG_ENABLE_CPU_RNG, enableCpuRng); + + BOOL originalRamEncryptionEnabled = (driverConfig & VC_DRIVER_CONFIG_ENABLE_RAM_ENCRYPTION)? TRUE : FALSE; + if (originalRamEncryptionEnabled != enableRamEncryption) + { + if (enableRamEncryption) + { + // Disable Hibernate and Fast Startup if they are enabled + BOOL bHibernateEnabled, bHiberbootEnabled; + if (GetHibernateStatus (bHibernateEnabled, bHiberbootEnabled)) + { + if (bHibernateEnabled) + { + BootEncObj->WriteLocalMachineRegistryDwordValue (L"SYSTEM\\CurrentControlSet\\Control\\Power", L"HibernateEnabled", 0); + } + + if (bHiberbootEnabled) + { + BootEncObj->WriteLocalMachineRegistryDwordValue (L"SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Power", L"HiberbootEnabled", 0); + } + } + } + rebootRequired = true; + } + SetDriverConfigurationFlag (VC_DRIVER_CONFIG_ENABLE_RAM_ENCRYPTION, enableRamEncryption); + + BOOL originalDisableMemoryProtection = !ReadMemoryProtectionConfig(); + if(originalDisableMemoryProtection != disableMemoryProtection) + rebootRequired = true; + SetMemoryProtectionConfig (!disableMemoryProtection); DWORD bytesReturned; if (!DeviceIoControl (hDriver, TC_IOCTL_REREAD_DRIVER_CONFIG, NULL, 0, NULL, 0, &bytesReturned, NULL)) handleWin32Error (hwndDlg, SRC_POS); EnableHwEncryption (!disableHW); + EnableCpuRng (enableCpuRng); uint32 cpuFreeCount = 0; if (IsDlgButtonChecked (hwndDlg, IDC_LIMIT_ENC_THREAD_POOL)) { @@ -10593,11 +11826,14 @@ static BOOL CALLBACK PerformanceSettingsDlgProc (HWND hwndDlg, UINT msg, WPARAM if (ReadEncryptionThreadPoolFreeCpuCountLimit() != cpuFreeCount) { BootEncObj->WriteLocalMachineRegistryDwordValue (L"SYSTEM\\CurrentControlSet\\Services\\veracrypt", TC_ENCRYPTION_FREE_CPU_COUNT_REG_VALUE_NAME, cpuFreeCount); - Warning ("SETTING_REQUIRES_REBOOT", hwndDlg); + rebootRequired = true; } + if (rebootRequired) + Warning ("SETTING_REQUIRES_REBOOT", hwndDlg); + EndDialog (hwndDlg, lw); return 1; } catch (Exception &e) @@ -10606,8 +11842,16 @@ static BOOL CALLBACK PerformanceSettingsDlgProc (HWND hwndDlg, UINT msg, WPARAM } } return 1; + case IDC_ALLOW_WINDOWS_DEFRAG: + if (IsDlgButtonChecked (hwndDlg, IDC_ALLOW_WINDOWS_DEFRAG) + && AskWarnYesNo ("CONFIRM_ALLOW_WINDOWS_DEFRAG", hwndDlg) == IDNO) + { + CheckDlgButton (hwndDlg, IDC_ALLOW_WINDOWS_DEFRAG, BST_UNCHECKED); + } + return 1; + case IDC_ENABLE_HARDWARE_ENCRYPTION: if (!IsDlgButtonChecked (hwndDlg, IDC_ENABLE_HARDWARE_ENCRYPTION) && AskWarnYesNo ("CONFIRM_SETTING_DEGRADES_PERFORMANCE", hwndDlg) == IDNO) { @@ -10629,18 +11873,65 @@ static BOOL CALLBACK PerformanceSettingsDlgProc (HWND hwndDlg, UINT msg, WPARAM EnableWindow (GetDlgItem (hwndDlg, IDC_ENCRYPTION_FREE_CPU_COUNT), IsDlgButtonChecked (hwndDlg, IDC_LIMIT_ENC_THREAD_POOL)); return 1; + case IDC_ENABLE_RAM_ENCRYPTION: + { + uint32 driverConfig = ReadDriverConfigurationFlags(); + BOOL originalRamEncryptionEnabled = (driverConfig & VC_DRIVER_CONFIG_ENABLE_RAM_ENCRYPTION)? TRUE : FALSE; + BOOL enableRamEncryption = IsDlgButtonChecked (hwndDlg, IDC_ENABLE_RAM_ENCRYPTION); + + if (originalRamEncryptionEnabled != enableRamEncryption) + { + if (enableRamEncryption) + { + // check if Hibernate or Fast Startup are enabled + BOOL bHibernateEnabled, bHiberbootEnabled; + if (GetHibernateStatus (bHibernateEnabled, bHiberbootEnabled)) + { + if (bHibernateEnabled || bHiberbootEnabled) + { + if (AskWarnYesNo ("RAM_ENCRYPTION_DISABLE_HIBERNATE", hwndDlg) == IDNO) + { + CheckDlgButton (hwndDlg, IDC_ENABLE_RAM_ENCRYPTION, BST_UNCHECKED); + return 1; + } + } + } + } + Warning ("SETTING_REQUIRES_REBOOT", hwndDlg); + } + } + return 1; + + case IDC_DISABLE_MEMORY_PROTECTION: + { + BOOL disableMemoryProtection = IsDlgButtonChecked (hwndDlg, IDC_DISABLE_MEMORY_PROTECTION); + BOOL originalDisableMemoryProtection = !ReadMemoryProtectionConfig(); + if (disableMemoryProtection != originalDisableMemoryProtection) + { + if (disableMemoryProtection) + { + Warning ("DISABLE_MEMORY_PROTECTION_WARNING", hwndDlg); + } + + Warning ("SETTING_REQUIRES_REBOOT", hwndDlg); + } + } + return 1; + case IDC_DISABLE_MEMORY_PROTECTION_HELP: + Applink ("memoryprotection"); + return 1; case IDC_BENCHMARK: Benchmark (hwndDlg); return 1; case IDC_MORE_INFO_ON_HW_ACCELERATION: - Applink ("hwacceleration", TRUE, ""); + Applink ("hwacceleration"); return 1; case IDC_MORE_INFO_ON_THREAD_BASED_PARALLELIZATION: - Applink ("parallelization", TRUE, ""); + Applink ("parallelization"); return 1; } return 0; @@ -10659,8 +11950,9 @@ static BOOL CALLBACK SecurityTokenPreferencesDlgProc (HWND hwndDlg, UINT msg, WP case WM_INITDIALOG: LocalizeDialog (hwndDlg, "IDD_TOKEN_PREFERENCES"); SetDlgItemText (hwndDlg, IDC_PKCS11_MODULE, SecurityTokenLibraryPath); CheckDlgButton (hwndDlg, IDC_CLOSE_TOKEN_SESSION_AFTER_MOUNT, CloseSecurityTokenSessionsAfterMount ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton (hwndDlg, IDC_ENABLE_EMV_SUPPORT, EMVSupportEnabled ? BST_CHECKED : BST_UNCHECKED); SetWindowTextW (GetDlgItem (hwndDlg, IDT_PKCS11_LIB_HELP), GetString("PKCS11_LIB_LOCATION_HELP")); return 0; @@ -10681,9 +11973,9 @@ static BOOL CALLBACK SecurityTokenPreferencesDlgProc (HWND hwndDlg, UINT msg, WP if (securityTokenLibraryPath[0] == 0) { try { - SecurityToken::CloseLibrary(); + SecurityToken::CloseLibrary(); // TODO Use Token } catch (...) { } SecurityTokenLibraryPath[0] = 0; @@ -10701,9 +11993,9 @@ static BOOL CALLBACK SecurityTokenPreferencesDlgProc (HWND hwndDlg, UINT msg, WP } } CloseSecurityTokenSessionsAfterMount = (IsDlgButtonChecked (hwndDlg, IDC_CLOSE_TOKEN_SESSION_AFTER_MOUNT) == BST_CHECKED); - + EMVSupportEnabled = (IsDlgButtonChecked (hwndDlg, IDC_ENABLE_EMV_SUPPORT) == BST_CHECKED); WaitCursor (); SaveSettings (hwndDlg); NormalCursor (); @@ -10805,11 +12097,8 @@ static BOOL CALLBACK DefaultMountParametersDlgProc (HWND hwndDlg, UINT msg, WPAR case WM_INITDIALOG: { LocalizeDialog (hwndDlg, "IDD_DEFAULT_MOUNT_PARAMETERS"); - SendMessage (GetDlgItem (hwndDlg, IDC_TRUECRYPT_MODE), BM_SETCHECK, - DefaultVolumeTrueCryptMode ? BST_CHECKED:BST_UNCHECKED, 0); - /* Populate the PRF algorithms list */ int i, nIndex, defaultPrfIndex = 0; HWND hComboBox = GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID); SendMessage (hComboBox, CB_RESETCONTENT, 0, 0); @@ -10841,27 +12130,16 @@ static BOOL CALLBACK DefaultMountParametersDlgProc (HWND hwndDlg, UINT msg, WPAR case IDOK: { int pkcs5 = (int) SendMessage (GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID), CB_GETITEMDATA, SendMessage (GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID), CB_GETCURSEL, 0, 0), 0); - BOOL truecryptMode = GetCheckBox (hwndDlg, IDC_TRUECRYPT_MODE); - /* check that PRF is supported in TrueCrypt Mode */ - if ( (truecryptMode) - && (!is_pkcs5_prf_supported(pkcs5, TRUE, PRF_BOOT_NO)) - ) - { - Error ("ALGO_NOT_SUPPORTED_FOR_TRUECRYPT_MODE", hwndDlg); - } - else - { - WaitCursor (); - DefaultVolumeTrueCryptMode = truecryptMode; - DefaultVolumePkcs5 = pkcs5; - SaveSettings (hwndDlg); + WaitCursor (); + DefaultVolumePkcs5 = pkcs5; - NormalCursor (); - EndDialog (hwndDlg, lw); - } + SaveSettings (hwndDlg); + + NormalCursor (); + EndDialog (hwndDlg, lw); return 1; } } @@ -10875,19 +12153,21 @@ void SecurityTokenPreferencesDialog (HWND hwndDlg) { DialogBoxParamW (hInst, MAKEINTRESOURCEW (IDD_TOKEN_PREFERENCES), hwndDlg, (DLGPROC) SecurityTokenPreferencesDlgProc, 0); } - static BOOL CALLBACK BootLoaderPreferencesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { WORD lw = LOWORD (wParam); + static std::string platforminfo; + static uint8 currentUserConfig; + static string currentCustomUserMessage; switch (msg) { case WM_INITDIALOG: { - BootEncryptionStatus BootEncStatus = BootEncObj->GetStatus(); - if (!BootEncStatus.DriveMounted) + BootEncryptionStatus bootEncStatus = BootEncObj->GetStatus(); + if (!bootEncStatus.DriveMounted) { Warning ("SYS_DRIVE_NOT_ENCRYPTED", hwndDlg); EndDialog (hwndDlg, IDCANCEL); return 1; @@ -10895,29 +12175,67 @@ static BOOL CALLBACK BootLoaderPreferencesDlgProc (HWND hwndDlg, UINT msg, WPARA try { LocalizeDialog (hwndDlg, "IDD_SYSENC_SETTINGS"); - uint32 driverConfig = ReadDriverConfigurationFlags(); - byte userConfig; + uint32 serviceConfig = ReadServiceConfigurationFlags(); + uint8 userConfig; string customUserMessage; uint16 bootLoaderVersion = 0; BOOL bPasswordCacheEnabled = (driverConfig & TC_DRIVER_CONFIG_CACHE_BOOT_PASSWORD)? TRUE : FALSE; BOOL bPimCacheEnabled = (driverConfig & TC_DRIVER_CONFIG_CACHE_BOOT_PIM)? TRUE : FALSE; + BOOL bBlockSysEncTrimEnabled = (driverConfig & VC_DRIVER_CONFIG_BLOCK_SYS_TRIM)? TRUE : FALSE; + BOOL bClearKeysEnabled = (driverConfig & VC_DRIVER_CONFIG_CLEAR_KEYS_ON_NEW_DEVICE_INSERTION)? TRUE : FALSE; + BOOL bAutoFixBootloader = (serviceConfig & VC_SYSTEM_FAVORITES_SERVICE_CONFIG_DONT_UPDATE_LOADER)? FALSE : TRUE; + BOOL bForceVeraCryptNextBoot = FALSE; + BOOL bForceSetVeraCryptBootEntry = TRUE; + BOOL bForceVeraCryptFirstEntry = TRUE; + if (bSystemIsGPT) + { + bForceVeraCryptNextBoot = (serviceConfig & VC_SYSTEM_FAVORITES_SERVICE_CONFIG_FORCE_SET_BOOTNEXT)? TRUE : FALSE; + bForceSetVeraCryptBootEntry = (serviceConfig & VC_SYSTEM_FAVORITES_SERVICE_CONFIG_DONT_SET_BOOTENTRY)? FALSE : TRUE; + bForceVeraCryptFirstEntry = (serviceConfig & VC_SYSTEM_FAVORITES_SERVICE_CONFIG_DONT_FORCE_FIRST_BOOTENTRY)? FALSE : TRUE; + } + + BOOL bIsHiddenOS = IsHiddenOSRunning (); + + if (bClearKeysEnabled) + { + // the clear keys option works only if the service is running + if (!BootEncObj->IsSystemFavoritesServiceRunning()) + bClearKeysEnabled = false; + } + if (!BootEncObj->ReadBootSectorConfig (nullptr, 0, &userConfig, &customUserMessage, &bootLoaderVersion)) { // operations canceled EndDialog (hwndDlg, IDCANCEL); return 1; } + // we store current configuration in order to be able to detect if user changed it or not after clicking OK + currentUserConfig = userConfig; + currentCustomUserMessage = customUserMessage; + if (bootLoaderVersion != VERSION_NUM) Warning ("BOOT_LOADER_VERSION_INCORRECT_PREFERENCES", hwndDlg); if (bSystemIsGPT) { CheckDlgButton (hwndDlg, IDC_DISABLE_BOOT_LOADER_HASH_PROMPT, (userConfig & TC_BOOT_USER_CFG_FLAG_STORE_HASH) ? BST_CHECKED : BST_UNCHECKED); + // read PlatformInfo file if it exists + try + { + platforminfo = ReadESPFile (L"\\EFI\\VeraCrypt\\PlatformInfo", true); + } + catch (Exception &) {} + + if (platforminfo.length() == 0) + { + // could not read PlatformInfo file. Disable corresponding button in UI + EnableWindow (GetDlgItem (hwndDlg, IDC_SHOW_PLATFORMINFO), FALSE); + } } else { SendMessage (GetDlgItem (hwndDlg, IDC_CUSTOM_BOOT_LOADER_MESSAGE), EM_LIMITTEXT, TC_BOOT_SECTOR_USER_MESSAGE_MAX_LENGTH, 0); @@ -10931,8 +12249,37 @@ static BOOL CALLBACK BootLoaderPreferencesDlgProc (HWND hwndDlg, UINT msg, WPARA CheckDlgButton (hwndDlg, IDC_DISABLE_BOOT_LOADER_PIM_PROMPT, (userConfig & TC_BOOT_USER_CFG_FLAG_DISABLE_PIM) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton (hwndDlg, IDC_BOOT_LOADER_CACHE_PASSWORD, bPasswordCacheEnabled ? BST_CHECKED : BST_UNCHECKED); EnableWindow (GetDlgItem (hwndDlg, IDC_BOOT_LOADER_CACHE_PIM), bPasswordCacheEnabled); CheckDlgButton (hwndDlg, IDC_BOOT_LOADER_CACHE_PIM, (bPasswordCacheEnabled && bPimCacheEnabled)? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton (hwndDlg, IDC_CLEAR_KEYS_ON_NEW_DEVICE_INSERTION, bClearKeysEnabled? BST_CHECKED : BST_UNCHECKED); + + if (bIsHiddenOS) + { + // we always block TRIM command on hidden OS regardless of the configuration + CheckDlgButton (hwndDlg, IDC_BLOCK_SYSENC_TRIM, BST_CHECKED); + EnableWindow (GetDlgItem (hwndDlg, IDC_BLOCK_SYSENC_TRIM), FALSE); + } + else + CheckDlgButton (hwndDlg, IDC_BLOCK_SYSENC_TRIM, bBlockSysEncTrimEnabled ? BST_CHECKED : BST_UNCHECKED); + + CheckDlgButton (hwndDlg, IDC_UPDATE_BOOTLOADER_ON_SHUTDOWN, bAutoFixBootloader? BST_CHECKED : BST_UNCHECKED); + if (bSystemIsGPT) + { + if (!bAutoFixBootloader || bIsHiddenOS) + { + // we disable other options if updating bootloader is not allowed or if hidden OS us running + EnableWindow (GetDlgItem (hwndDlg, IDC_FORCE_NEXT_BOOT_VERACRYPT), FALSE); + EnableWindow (GetDlgItem (hwndDlg, IDC_FORCE_VERACRYPT_BOOT_ENTRY), FALSE); + EnableWindow (GetDlgItem (hwndDlg, IDC_FORCE_VERACRYPT_FIRST_BOOT_ENTRY), FALSE); + } + + if (!bIsHiddenOS) + { + CheckDlgButton (hwndDlg, IDC_FORCE_NEXT_BOOT_VERACRYPT, bForceVeraCryptNextBoot? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton (hwndDlg, IDC_FORCE_VERACRYPT_BOOT_ENTRY, bForceSetVeraCryptBootEntry? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton (hwndDlg, IDC_FORCE_VERACRYPT_FIRST_BOOT_ENTRY, bForceVeraCryptFirstEntry? BST_CHECKED : BST_UNCHECKED); + } + } } catch (Exception &e) { e.Show (hwndDlg); @@ -10948,8 +12295,41 @@ static BOOL CALLBACK BootLoaderPreferencesDlgProc (HWND hwndDlg, UINT msg, WPARA { case IDCANCEL: EndDialog (hwndDlg, lw); return 1; + case IDC_SHOW_PLATFORMINFO: + TextEditDialogBox(TRUE, hwndDlg, GetString ("EFI_PLATFORM_INFORMATION"), platforminfo); + return 0; + + case IDC_EDIT_DCSPROP: + if (AskWarnNoYes ("EDIT_DCSPROP_FOR_ADVANCED_ONLY", hwndDlg) == IDYES) + { + try + { + std::string currentDcsprop = ReadESPFile (L"\\EFI\\VeraCrypt\\DcsProp", true); + std::string dcsprop = currentDcsprop; + + while (TextEditDialogBox(FALSE, hwndDlg, GetString ("BOOT_LOADER_CONFIGURATION_FILE"), dcsprop) == IDOK) + { + const char* dcspropContent = dcsprop.c_str(); + if (0 == strcmp(dcspropContent, currentDcsprop.c_str())) + { + break; + } + else if (validateDcsPropXml (dcspropContent)) + { + WriteESPFile (L"\\EFI\\VeraCrypt\\DcsProp", (LPBYTE) dcspropContent, (DWORD) strlen (dcspropContent), true); + break; + } + else + { + MessageBoxW (hwndDlg, GetString ("DCSPROP_XML_VALIDATION_FAILED"), lpszTitle, ICON_HAND); + } + } + } + catch (Exception &e) { e.Show(hwndDlg); } + } + return 0; case IDOK: { VOLUME_PROPERTIES_STRUCT prop; @@ -10974,53 +12354,90 @@ static BOOL CALLBACK BootLoaderPreferencesDlgProc (HWND hwndDlg, UINT msg, WPARA char customUserMessage[TC_BOOT_SECTOR_USER_MESSAGE_MAX_LENGTH + 1] = {0}; if (!bSystemIsGPT) GetDlgItemTextA (hwndDlg, IDC_CUSTOM_BOOT_LOADER_MESSAGE, customUserMessage, sizeof (customUserMessage)); - byte userConfig; - try - { - if (!BootEncObj->ReadBootSectorConfig (nullptr, 0, &userConfig)) - return 1; - } - catch (Exception &e) - { - e.Show (hwndDlg); - return 1; - } + uint8 userConfig = currentUserConfig; if (IsDlgButtonChecked (hwndDlg, IDC_DISABLE_BOOT_LOADER_PIM_PROMPT)) userConfig |= TC_BOOT_USER_CFG_FLAG_DISABLE_PIM; else userConfig &= ~TC_BOOT_USER_CFG_FLAG_DISABLE_PIM; if (bSystemIsGPT) { - if (IsDlgButtonChecked (hwndDlg, IDC_DISABLE_BOOT_LOADER_HASH_PROMPT)) - userConfig |= TC_BOOT_USER_CFG_FLAG_STORE_HASH; - else - userConfig &= ~TC_BOOT_USER_CFG_FLAG_STORE_HASH; + if (IsDlgButtonChecked (hwndDlg, IDC_DISABLE_BOOT_LOADER_HASH_PROMPT)) + userConfig |= TC_BOOT_USER_CFG_FLAG_STORE_HASH; + else + userConfig &= ~TC_BOOT_USER_CFG_FLAG_STORE_HASH; } else { if (IsDlgButtonChecked (hwndDlg, IDC_DISABLE_BOOT_LOADER_OUTPUT)) - userConfig |= TC_BOOT_USER_CFG_FLAG_SILENT_MODE; - else - userConfig &= ~TC_BOOT_USER_CFG_FLAG_SILENT_MODE; + userConfig |= TC_BOOT_USER_CFG_FLAG_SILENT_MODE; + else + userConfig &= ~TC_BOOT_USER_CFG_FLAG_SILENT_MODE; - if (!IsDlgButtonChecked (hwndDlg, IDC_ALLOW_ESC_PBA_BYPASS)) - userConfig |= TC_BOOT_USER_CFG_FLAG_DISABLE_ESC; - else - userConfig &= ~TC_BOOT_USER_CFG_FLAG_DISABLE_ESC; + if (!IsDlgButtonChecked (hwndDlg, IDC_ALLOW_ESC_PBA_BYPASS)) + userConfig |= TC_BOOT_USER_CFG_FLAG_DISABLE_ESC; + else + userConfig &= ~TC_BOOT_USER_CFG_FLAG_DISABLE_ESC; } try { BOOL bPasswordCacheEnabled = IsDlgButtonChecked (hwndDlg, IDC_BOOT_LOADER_CACHE_PASSWORD); BOOL bPimCacheEnabled = IsDlgButtonChecked (hwndDlg, IDC_BOOT_LOADER_CACHE_PIM); - BootEncObj->WriteBootSectorUserConfig (userConfig, customUserMessage, prop.volumePim, prop.pkcs5); + BOOL bBlockSysEncTrimEnabled = IsDlgButtonChecked (hwndDlg, IDC_BLOCK_SYSENC_TRIM); + BOOL bClearKeysEnabled = IsDlgButtonChecked (hwndDlg, IDC_CLEAR_KEYS_ON_NEW_DEVICE_INSERTION); + + BOOL bAutoFixBootloader = IsDlgButtonChecked (hwndDlg, IDC_UPDATE_BOOTLOADER_ON_SHUTDOWN); + BOOL bForceVeraCryptNextBoot = FALSE; + BOOL bForceSetVeraCryptBootEntry = TRUE; + BOOL bForceVeraCryptFirstEntry = TRUE; + if (bSystemIsGPT) + { + bForceVeraCryptNextBoot = IsDlgButtonChecked (hwndDlg, IDC_FORCE_NEXT_BOOT_VERACRYPT); + bForceSetVeraCryptBootEntry = IsDlgButtonChecked (hwndDlg, IDC_FORCE_VERACRYPT_BOOT_ENTRY); + bForceVeraCryptFirstEntry = IsDlgButtonChecked (hwndDlg, IDC_FORCE_VERACRYPT_FIRST_BOOT_ENTRY); + } + + if (bClearKeysEnabled && !BootEncObj->IsSystemFavoritesServiceRunning()) + { + // the system favorite service service should be running + // if it is not the case, report a failure and quit + std::string techInfo = SRC_POS; + techInfo += "\nIsSystemFavoritesServiceRunning = False."; + ReportUnexpectedState (techInfo.c_str()); + return 1; + } + + // only write boot configuration if something changed + if ((userConfig != currentUserConfig) || (!bSystemIsGPT && (customUserMessage != currentCustomUserMessage))) + BootEncObj->WriteBootSectorUserConfig (userConfig, customUserMessage, prop.volumePim, prop.pkcs5); + SetDriverConfigurationFlag (TC_DRIVER_CONFIG_CACHE_BOOT_PASSWORD, bPasswordCacheEnabled); SetDriverConfigurationFlag (TC_DRIVER_CONFIG_CACHE_BOOT_PIM, (bPasswordCacheEnabled && bPimCacheEnabled)? TRUE : FALSE); SetDriverConfigurationFlag (TC_DRIVER_CONFIG_DISABLE_EVIL_MAID_ATTACK_DETECTION, IsDlgButtonChecked (hwndDlg, IDC_DISABLE_EVIL_MAID_ATTACK_DETECTION)); + if (bClearKeysEnabled) + NotifyService (VC_DRIVER_CONFIG_CLEAR_KEYS_ON_NEW_DEVICE_INSERTION); + SetDriverConfigurationFlag (VC_DRIVER_CONFIG_CLEAR_KEYS_ON_NEW_DEVICE_INSERTION, bClearKeysEnabled); + SetServiceConfigurationFlag (VC_SYSTEM_FAVORITES_SERVICE_CONFIG_DONT_UPDATE_LOADER, bAutoFixBootloader? FALSE : TRUE); + if (!IsHiddenOSRunning ()) + { + /* we don't need to update TRIM config for hidden OS since it's always blocked */ + SetDriverConfigurationFlag (VC_DRIVER_CONFIG_BLOCK_SYS_TRIM, bBlockSysEncTrimEnabled); + + if (bSystemIsGPT) + { + if (bAutoFixBootloader) + { + /* we update bootloader settings only if the autofix option is enabled */ + SetServiceConfigurationFlag (VC_SYSTEM_FAVORITES_SERVICE_CONFIG_FORCE_SET_BOOTNEXT, bForceVeraCryptNextBoot); + SetServiceConfigurationFlag (VC_SYSTEM_FAVORITES_SERVICE_CONFIG_DONT_SET_BOOTENTRY, bForceSetVeraCryptBootEntry? FALSE : TRUE); + SetServiceConfigurationFlag (VC_SYSTEM_FAVORITES_SERVICE_CONFIG_DONT_FORCE_FIRST_BOOTENTRY, bForceVeraCryptFirstEntry? FALSE : TRUE); + } + } + } } catch (Exception &e) { e.Show (hwndDlg); @@ -11060,25 +12477,63 @@ static BOOL CALLBACK BootLoaderPreferencesDlgProc (HWND hwndDlg, UINT msg, WPARA EnableWindow (GetDlgItem (hwndDlg, IDC_BOOT_LOADER_CACHE_PIM), FALSE); } break; + + case IDC_CLEAR_KEYS_ON_NEW_DEVICE_INSERTION: + if (IsDlgButtonChecked (hwndDlg, IDC_CLEAR_KEYS_ON_NEW_DEVICE_INSERTION)) + { + if (!BootEncObj->IsSystemFavoritesServiceRunning()) + { + // the system favorite service service should be running + // if it is not the case, report a failure + std::string techInfo = SRC_POS; + techInfo += "\nIsSystemFavoritesServiceRunning = False."; + ReportUnexpectedState (techInfo.c_str()); + + CheckDlgButton (hwndDlg, IDC_CLEAR_KEYS_ON_NEW_DEVICE_INSERTION, BST_UNCHECKED); + } + else + Warning ("CLEAR_KEYS_ON_DEVICE_INSERTION_WARNING", hwndDlg); + } + + break; + + case IDC_UPDATE_BOOTLOADER_ON_SHUTDOWN: + if (bSystemIsGPT && !IsHiddenOSRunning ()) + { + if (IsDlgButtonChecked (hwndDlg, IDC_UPDATE_BOOTLOADER_ON_SHUTDOWN)) + { + EnableWindow (GetDlgItem (hwndDlg, IDC_FORCE_NEXT_BOOT_VERACRYPT), TRUE); + EnableWindow (GetDlgItem (hwndDlg, IDC_FORCE_VERACRYPT_BOOT_ENTRY), TRUE); + EnableWindow (GetDlgItem (hwndDlg, IDC_FORCE_VERACRYPT_FIRST_BOOT_ENTRY), TRUE); + } + else + { + EnableWindow (GetDlgItem (hwndDlg, IDC_FORCE_NEXT_BOOT_VERACRYPT), FALSE); + EnableWindow (GetDlgItem (hwndDlg, IDC_FORCE_VERACRYPT_BOOT_ENTRY), FALSE); + EnableWindow (GetDlgItem (hwndDlg, IDC_FORCE_VERACRYPT_FIRST_BOOT_ENTRY), FALSE); + } + } + break; } return 0; } return 0; } -void MountSelectedVolume (HWND hwndDlg, BOOL mountWithOptions) +void MountSelectedVolume (HWND hwndDlg, BOOL mountWithOptions, BOOL skipCachedPasswords) { if (!VolumeSelected(hwndDlg)) { Warning ("NO_VOLUME_SELECTED", hwndDlg); } else if (LOWORD (GetSelectedLong (GetDlgItem (hwndDlg, IDC_DRIVELIST))) == TC_MLIST_ITEM_FREE) { mountOptions = defaultMountOptions; + mountOptions.SkipCachedPasswords = skipCachedPasswords; bPrebootPasswordDlgMode = FALSE; if (mountWithOptions || GetAsyncKeyState (VK_CONTROL) < 0) { @@ -11089,9 +12544,9 @@ void MountSelectedVolume (HWND hwndDlg, BOOL mountWithOptions) mountOptions.ProtectedHidVolPkcs5Prf = DefaultVolumePkcs5; else mountOptions.ProtectedHidVolPkcs5Prf = CmdVolumePkcs5; mountOptions.ProtectedHidVolPim = CmdVolumePim; - if (IDCANCEL == DialogBoxParamW (hInst, + if (IDCANCEL == SecureDesktopDialogBoxParam (hInst, MAKEINTRESOURCEW (IDD_MOUNT_OPTIONS), hwndDlg, (DLGPROC) MountOptionsDlgProc, (LPARAM) &mountOptions)) return; diff --git a/src/Mount/Mount.h b/src/Mount/Mount.h index 4a50ef3c..cd2636b1 100644 --- a/src/Mount/Mount.h +++ b/src/Mount/Mount.h @@ -5,9 +5,9 @@ governed by the TrueCrypt License 3.0, also from the source code of Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux and which is governed by the 'License Agreement for Encryption for the Masses' Modifications and additions to the original source code (contained in this file) - and all other portions of this file are Copyright (c) 2013-2016 IDRIX + and all other portions of this file are Copyright (c) 2013-2017 IDRIX and are governed by the Apache License 2.0 the full text of which is contained in the file License.txt included in VeraCrypt binary and source code distribution packages. */ @@ -54,9 +54,8 @@ typedef struct { Password *password; int* pkcs5; int* pim; - BOOL* truecryptMode; } PasswordDlgParam; extern VOLUME_NOTIFICATIONS_LIST VolumeNotificationsList; @@ -107,9 +106,9 @@ int BackupVolumeHeader (HWND hwndDlg, BOOL bRequireConfirmation, const wchar_t * int RestoreVolumeHeader (HWND hwndDlg, const wchar_t *lpszVolume); void SecurityTokenPreferencesDialog (HWND hwndDlg); static BOOL CALLBACK PerformanceSettingsDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); static BOOL CALLBACK BootLoaderPreferencesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); -void MountSelectedVolume (HWND hwndDlg, BOOL mountWithOptions); +void MountSelectedVolume (HWND hwndDlg, BOOL mountWithOptions, BOOL skipCachedPasswords); uint32 ReadDriverConfigurationFlags (); void HookMouseWheel (HWND hwndDlg, UINT ctrlId); static BOOL HandleDriveListMouseWheelEvent (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL bListMustBePointed); static BOOL CALLBACK DefaultMountParametersDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); @@ -128,5 +127,43 @@ typedef struct void SetDriverConfigurationFlag (uint32 flag, BOOL state); BOOL MountFavoriteVolumes (HWND hwnd, BOOL systemFavorites = FALSE, BOOL logOnMount = FALSE, BOOL hotKeyMount = FALSE, const VeraCrypt::FavoriteVolume &favoriteVolumeToMount = VeraCrypt::FavoriteVolume()); void __cdecl mountFavoriteVolumeThreadFunction (void *pArg); +// A class that represents a device based on its device ID +class CDevice +{ +public: + WCHAR m_szDeviceID[MAX_PATH]; + + CDevice() + { + ZeroMemory(m_szDeviceID, sizeof(m_szDeviceID)); + } + + CDevice(WCHAR* szDevicePath) + { + StringCchCopyW(m_szDeviceID, MAX_PATH, szDevicePath); + } + + CDevice(const CDevice& src) + { + StringCchCopyW(m_szDeviceID, MAX_PATH, src.m_szDeviceID); + } + + CDevice& operator=(const CDevice& src) + { + StringCchCopyW(m_szDeviceID, MAX_PATH, src.m_szDeviceID); + return *this; + } + + BOOL operator==(const CDevice& src) + { + return wcscmp(m_szDeviceID, src.m_szDeviceID) == 0; + } + + ~CDevice() + { + } +}; + + #endif diff --git a/src/Mount/Mount.manifest b/src/Mount/Mount.manifest index 5d4cb896..79d86799 100644 --- a/src/Mount/Mount.manifest +++ b/src/Mount/Mount.manifest @@ -13,9 +13,15 @@ </asmv3:windowsSettings> </asmv3:application> <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> <application> - <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/> + <!-- Windows 10 and Windows 11 --> + <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/> + <!-- Windows 8.1 --> + <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/> + <!-- Windows 8 --> + <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/> + <!-- Windows 7 --> <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/> </application> </compatibility> <dependency> diff --git a/src/Mount/Mount.rc b/src/Mount/Mount.rc index ff2ab845..19b3bbe9 100644 --- a/src/Mount/Mount.rc +++ b/src/Mount/Mount.rc @@ -6,9 +6,9 @@ ///////////////////////////////////////////////////////////////////////////// // // Generated from the TEXTINCLUDE 2 resource. // -#include "afxres.h" +#include "winres.h" #include "..\\common\\resource.h" ///////////////////////////////////////////////////////////////////////////// #undef APSTUDIO_READONLY_SYMBOLS @@ -40,9 +40,9 @@ IDR_MOUNT_TLB TYPELIB "Mount.tlb" // // Dialog // -IDD_PREFERENCES_DLG DIALOGEX 0, 0, 336, 340 +IDD_PREFERENCES_DLG DIALOGEX 0, 0, 336, 347 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "VeraCrypt - Preferences" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN @@ -77,32 +77,34 @@ BEGIN "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,196,316,10 CONTROL "Make disconnected network drives available for mounting",IDC_SHOW_DISCONNECTED_NETWORK_DRIVES, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,208,316,10 CONTROL "Cache passwords in driver memory",IDC_PREF_CACHE_PASSWORDS, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,263,146,11 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,271,146,11 CONTROL "Wipe cached passwords on exit",IDC_PREF_WIPE_CACHE_ON_EXIT, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,162,263,165,11 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,162,271,165,11 CONTROL "Temporarily cache password during ""Mount Favorite Volumes"" operations",IDC_PREF_TEMP_CACHE_ON_MULTIPLE_MOUNT, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,277,294,11 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,285,294,11 CONTROL "Wipe cached passwords on auto-dismount",IDC_PREF_WIPE_CACHE_ON_AUTODISMOUNT, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,291,296,11 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,299,296,11 CONTROL "Include PIM when caching a password",IDC_PREF_CACHE_PIM, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,305,296,10 - PUSHBUTTON "More Settings...",IDC_MORE_SETTINGS,5,324,85,14 - DEFPUSHBUTTON "OK",IDOK,225,324,50,14 - PUSHBUTTON "Cancel",IDCANCEL,281,324,50,14 - GROUPBOX "Windows",IDT_WINDOWS_RELATED_SETTING,4,160,328,87 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,313,296,10 + PUSHBUTTON "More Settings...",IDC_MORE_SETTINGS,5,331,85,14 + DEFPUSHBUTTON "OK",IDOK,225,331,50,14 + PUSHBUTTON "Cancel",IDCANCEL,281,331,50,14 + GROUPBOX "Windows",IDT_WINDOWS_RELATED_SETTING,4,160,328,97 GROUPBOX "Default Mount Options",IDT_DEFAULT_MOUNT_OPTIONS,4,3,328,26 GROUPBOX "VeraCrypt Background Task",IDT_TASKBAR_ICON,4,33,328,26 GROUPBOX "Auto-Dismount",IDT_AUTO_DISMOUNT,4,94,328,62 LTEXT "minutes",IDT_MINUTES,289,129,39,10 LTEXT "Dismount all when:",IDT_AUTO_DISMOUNT_ON,9,104,71,20 - GROUPBOX "Password Cache",IDT_PW_CACHE_OPTIONS,4,252,328,68 + GROUPBOX "Password Cache",IDT_PW_CACHE_OPTIONS,4,260,328,68 GROUPBOX "Actions to perform upon logon to Windows",IDT_LOGON,4,63,328,28 CONTROL "Don't show wait message dialog when performing operations",IDC_HIDE_WAITING_DIALOG, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,220,316,10 CONTROL "Use Secure Desktop for password entry",IDC_SECURE_DESKTOP_PASSWORD_ENTRY, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,232,316,10 + CONTROL "Use legacy maximum password length (64 characters)",IDC_USE_LEGACY_MAX_PASSWORD_LENGTH, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,244,316,10 END IDD_VOLUME_PROPERTIES DIALOGEX 60, 30, 284, 224 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU @@ -120,9 +122,8 @@ CLASS "VeraCryptCustomDlg" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN EDITTEXT IDC_OLD_PASSWORD,89,14,181,13,ES_PASSWORD | ES_AUTOHSCROLL COMBOBOX IDC_PKCS5_OLD_PRF_ID,89,33,97,90,CBS_DROPDOWNLIST | WS_TABSTOP - CONTROL "TrueCrypt Mode",IDC_TRUECRYPT_MODE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,193,35,83,10 EDITTEXT IDC_OLD_PIM,89,51,42,14,ES_RIGHT | ES_PASSWORD | ES_AUTOHSCROLL | ES_NUMBER | NOT WS_VISIBLE CONTROL "Use P&IM",IDC_PIM_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,89,59,115,10 CONTROL "Use keyfiles",IDC_ENABLE_KEYFILES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,89,72,109,10 PUSHBUTTON "Keyfiles...",IDC_KEYFILES,203,70,67,14 @@ -178,9 +179,9 @@ BEGIN CONTROL "",IDC_STATIC,"Static",SS_ETCHEDFRAME,282,242,88,20 CONTROL "",IDC_STATIC,"Static",SS_ETCHEDFRAME,190,242,88,20 CONTROL "",IDC_STATIC,"Static",SS_ETCHEDFRAME,6,242,88,20 CONTROL "",IDC_STATIC,"Static",SS_ETCHEDFRAME,98,242,88,20 - CONTROL "",IDC_STATIC,"Static",SS_ETCHEDFRAME,2,151,372,119 + CONTROL "",IDC_LOWER_BOX,"Static",SS_ETCHEDFRAME,2,151,372,119 END IDD_PASSWORD_DLG DIALOGEX 0, 0, 330, 103 STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION @@ -188,14 +189,13 @@ CAPTION "Enter VeraCrypt Volume Password" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN EDITTEXT IDC_PASSWORD,69,8,179,14,ES_PASSWORD | ES_AUTOHSCROLL COMBOBOX IDC_PKCS5_PRF_ID,69,26,96,90,CBS_DROPDOWNLIST | WS_TABSTOP - CONTROL "TrueCrypt Mode",IDC_TRUECRYPT_MODE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,170,28,76,10 EDITTEXT IDC_PIM,69,43,42,14,ES_RIGHT | ES_PASSWORD | ES_AUTOHSCROLL | ES_NUMBER | NOT WS_VISIBLE CONTROL "Use P&IM",IDC_PIM_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,70,48,97,10 CONTROL "Cache passwords and keyfil&es in memory",IDC_CACHE, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,70,61,153,10 - CONTROL "&Display password",IDC_SHOW_PASSWORD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,70,74,83,10 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,70,61,241,10 + CONTROL "&Display password",IDC_SHOW_PASSWORD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,70,74,244,10 CONTROL "U&se keyfiles",IDC_KEYFILES_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,70,87,99,11 PUSHBUTTON "&Keyfiles...",IDC_KEY_FILES,173,84,75,14 PUSHBUTTON "Mount Opti&ons...",IDC_MOUNT_OPTIONS,252,84,69,14 LTEXT "(Empty or 0 for default iterations)",IDC_PIM_HELP,115,46,199,8,NOT WS_VISIBLE @@ -267,9 +267,9 @@ BEGIN GROUPBOX "Hot Key Options",IDT_DISMOUNT_ACTION,7,188,375,42 GROUPBOX "Shortcut",IDT_ASSIGN_HOTKEY,7,127,375,53 END -IDD_TOKEN_PREFERENCES DIALOGEX 0, 0, 316, 199 +IDD_TOKEN_PREFERENCES DIALOGEX 0, 0, 316, 229 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "VeraCrypt - Security Token Preferences" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN @@ -277,57 +277,85 @@ BEGIN PUSHBUTTON "Select &Library...",IDC_SELECT_PKCS11_MODULE,226,22,75,14 PUSHBUTTON "Auto-&Detect Library",IDC_AUTO_DETECT_PKCS11_MODULE,16,41,112,14 CONTROL "&Close token session (log out) after a volume is successfully mounted",IDC_CLOSE_TOKEN_SESSION_AFTER_MOUNT, "Button",BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,16,154,284,9 - DEFPUSHBUTTON "OK",IDOK,205,178,50,14 - PUSHBUTTON "Cancel",IDCANCEL,259,178,50,14 + CONTROL "&Enable EMV Support",IDC_ENABLE_EMV_SUPPORT,"Button",BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,16,185,284,9 + DEFPUSHBUTTON "OK",IDOK,205,208,50,14 + PUSHBUTTON "Cancel",IDCANCEL,259,208,50,14 GROUPBOX "PKCS #11 Library Path",IDT_PKCS11_LIB_PATH,7,7,302,129 GROUPBOX "Security Options",IDT_SECURITY_OPTIONS,7,140,302,30 + GROUPBOX "EMV Options",IDT_EMV_OPTIONS,7,172,302,30 LTEXT "",IDT_PKCS11_LIB_HELP,16,63,286,65 END -IDD_EFI_SYSENC_SETTINGS DIALOGEX 0, 0, 370, 139 +IDD_EFI_SYSENC_SETTINGS DIALOGEX 0, 0, 375, 250 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "VeraCrypt - System Encryption Settings" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN - CONTROL "&Cache pre-boot authentication password in driver memory (for mounting of non-system volumes)",IDC_BOOT_LOADER_CACHE_PASSWORD, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,79,339,10 - DEFPUSHBUTTON "OK",IDOK,257,115,50,14 - PUSHBUTTON "Cancel",IDCANCEL,313,115,50,14 - GROUPBOX "Boot Loader Screen Options",IDT_BOOT_LOADER_SCREEN_OPTIONS,8,7,355,53 - GROUPBOX "Security Options",IDT_SECURITY_OPTIONS,8,64,355,44 - CONTROL "Include PIM when caching pre-boot authentication password",IDC_BOOT_LOADER_CACHE_PIM, - "Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,18,94,340,10 + GROUPBOX "Boot Loader Screen Options",IDT_BOOT_LOADER_SCREEN_OPTIONS,8,7,355,45 CONTROL "Do not request PIM in the pre-boot authentication screen (PIM value is stored unencrypted on disk)",IDC_DISABLE_BOOT_LOADER_PIM_PROMPT, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,20,339,9 CONTROL "Do not request Hash algorithm in the pre-boot authentication screen",IDC_DISABLE_BOOT_LOADER_HASH_PROMPT, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,35,339,9 + GROUPBOX "Security Options",IDT_SECURITY_OPTIONS,7,53,355,75 + CONTROL "&Cache pre-boot authentication password in driver memory (for mounting of non-system volumes)",IDC_BOOT_LOADER_CACHE_PASSWORD, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,68,339,10 + CONTROL "Include PIM when caching pre-boot authentication password",IDC_BOOT_LOADER_CACHE_PIM, + "Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,16,83,340,10 + CONTROL "Block TRIM command on system partition/drive",IDC_BLOCK_SYSENC_TRIM, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,98,340,10 + CONTROL "Clear encryption keys from memory if a new device is inserted",IDC_CLEAR_KEYS_ON_NEW_DEVICE_INSERTION, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,112,340,10 + GROUPBOX "Advanced Options",IDT_ADVANCED_OPTIONS,7,131,355,91 + CONTROL "Automatically fix boot configuration issues that may prevent Windows from starting",IDC_UPDATE_BOOTLOADER_ON_SHUTDOWN, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,144,340,10 + CONTROL "Force machine to boot on VeraCrypt in the next startup",IDC_FORCE_NEXT_BOOT_VERACRYPT, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,158,340,10 + CONTROL "Force the presence of VeraCrypt entry in the EFI firmware boot menu",IDC_FORCE_VERACRYPT_BOOT_ENTRY, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,172,340,10 + CONTROL "Force VeraCrypt entry to be the first in the EFI firmware boot menu",IDC_FORCE_VERACRYPT_FIRST_BOOT_ENTRY, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,186,340,10 + PUSHBUTTON "Edit Boot Loader Configuration",IDC_EDIT_DCSPROP,10,201,173,14 + PUSHBUTTON "Display EFI Platform Information",IDC_SHOW_PLATFORMINFO,187,201,173,14 + PUSHBUTTON "Cancel",IDCANCEL,313,226,50,14 + DEFPUSHBUTTON "OK",IDOK,255,226,50,14 END -IDD_PERFORMANCE_SETTINGS DIALOGEX 0, 0, 370, 248 +IDD_PERFORMANCE_SETTINGS DIALOGEX 0, 0, 371, 300 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "VeraCrypt - Performance Options" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN CONTROL "",IDC_HW_AES_SUPPORTED_BY_CPU,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,294,21,57,12,WS_EX_CLIENTEDGE CONTROL "Accelerate AES encryption/decryption by using the AES instructions of the processor (if available)",IDC_ENABLE_HARDWARE_ENCRYPTION, "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,18,41,340,17 LTEXT "More information",IDC_MORE_INFO_ON_HW_ACCELERATION,18,61,165,10,SS_NOTIFY - CONTROL "Do not use the following number of processors for encryption/decryption:",IDC_LIMIT_ENC_THREAD_POOL, + CONTROL "Do not use the following number of logical processors for encryption/decryption:",IDC_LIMIT_ENC_THREAD_POOL, "Button",BS_AUTOCHECKBOX | BS_TOP | WS_TABSTOP,18,103,283,11 COMBOBOX IDC_ENCRYPTION_FREE_CPU_COUNT,304,101,48,51,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "",IDT_LIMIT_ENC_THREAD_POOL_NOTE,18,126,334,33 LTEXT "More information",IDC_MORE_INFO_ON_THREAD_BASED_PARALLELIZATION,18,159,165,10,SS_NOTIFY - PUSHBUTTON "&Benchmark",IDC_BENCHMARK,7,227,59,14 - DEFPUSHBUTTON "OK",IDOK,257,227,50,14 - PUSHBUTTON "Cancel",IDCANCEL,313,227,50,14 + CONTROL "Enable extended disk control codes support",IDC_ENABLE_EXTENDED_IOCTL_SUPPORT, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,198,337,10 + CONTROL "Allow TRIM command for non-system SSD partition/drive",IDC_ALLOW_TRIM_NONSYS_SSD, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,211,337,10 + CONTROL "Allow Windows Disk Defragmenter to defragment non-system partition/drive",IDC_ALLOW_WINDOWS_DEFRAG, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,224,337,10 + CONTROL "Use CPU hardware random generator as an additional source of entropy",IDC_ENABLE_CPU_RNG, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,237,335,10 + CONTROL "Activate encryption of keys and passwords stored in RAM",IDC_ENABLE_RAM_ENCRYPTION, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,250,337,10 + CONTROL "Disable memory protection for Accessibility tools compatibility",IDC_DISABLE_MEMORY_PROTECTION, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,263,339,10 + PUSHBUTTON "?",IDC_DISABLE_MEMORY_PROTECTION_HELP,364,259,7,14 + PUSHBUTTON "&Benchmark",IDC_BENCHMARK,7,279,59,14 + DEFPUSHBUTTON "OK",IDOK,257,279,50,14 + PUSHBUTTON "Cancel",IDCANCEL,314,279,50,14 LTEXT "Processor (CPU) in this computer supports hardware acceleration for AES:",IDT_HW_AES_SUPPORTED_BY_CPU,18,23,273,9 GROUPBOX "Hardware Acceleration",IDT_ACCELERATION_OPTIONS,7,6,355,74 GROUPBOX "Thread-Based Parallelization",IDT_PARALLELIZATION_OPTIONS,7,84,355,93 - LTEXT "",IDT_LIMIT_ENC_THREAD_POOL_NOTE,18,126,334,33 - GROUPBOX "Driver Configuration",IDT_DRIVER_OPTIONS,7,183,356,36 - CONTROL "Enable extended disk control codes support",IDC_ENABLE_EXTENDED_IOCTL_SUPPORT, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,198,337,10 + GROUPBOX "Driver Configuration",IDT_DRIVER_OPTIONS,7,183,357,95 END IDD_FAVORITE_VOLUMES DIALOGEX 0, 0, 380, 368 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU @@ -367,9 +395,8 @@ BEGIN EDITTEXT IDC_FAVORITE_VOLUME_ID,87,130,275,14,ES_AUTOHSCROLL | ES_READONLY CONTROL "Use Volume ID to mount favorite",IDC_FAVORITE_USE_VOLUME_ID, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,148,337,10 COMBOBOX IDC_PKCS5_PRF_ID,87,166,96,90,CBS_DROPDOWNLIST | WS_TABSTOP - CONTROL "TrueCrypt Mode",IDC_TRUECRYPT_MODE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,189,168,76,10 LTEXT "PKCS-5 PRF:",IDT_PKCS5_PRF,19,168,63,10 END IDD_DEFAULT_MOUNT_PARAMETERS DIALOGEX 0, 0, 167, 65 @@ -380,51 +407,57 @@ BEGIN DEFPUSHBUTTON "OK",IDOK,57,44,50,14 PUSHBUTTON "Cancel",IDCANCEL,111,44,50,14 COMBOBOX IDC_PKCS5_PRF_ID,57,24,103,90,CBS_DROPDOWNLIST | WS_TABSTOP LTEXT "PKCS-5 PRF:",IDT_PKCS5_PRF,8,26,44,11 - CONTROL "TrueCrypt Mode",IDC_TRUECRYPT_MODE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,7,76,10 END -IDD_SYSENC_SETTINGS DIALOGEX 0, 0, 370, 286 +IDD_SYSENC_SETTINGS DIALOGEX 0, 0, 371, 344 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "VeraCrypt - System Encryption Settings" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN CONTROL "Do not &show any texts in the pre-boot authentication screen (except the below custom message)",IDC_DISABLE_BOOT_LOADER_OUTPUT, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,20,339,9 EDITTEXT IDC_CUSTOM_BOOT_LOADER_MESSAGE,18,50,216,14,ES_AUTOHSCROLL + CONTROL "Do not request PIM in the pre-boot authentication screen (PIM value is stored unencrypted on disk)",IDC_DISABLE_BOOT_LOADER_PIM_PROMPT, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,157,339,9 CONTROL "&Cache pre-boot authentication password in driver memory (for mounting of non-system volumes)",IDC_BOOT_LOADER_CACHE_PASSWORD, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,192,339,10 + CONTROL "Include PIM when caching pre-boot authentication password",IDC_BOOT_LOADER_CACHE_PIM, + "Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,18,207,339,10 CONTROL "Allow pre-boot &authentication to be bypassed by pressing the Esc key (enables boot manager)",IDC_ALLOW_ESC_PBA_BYPASS, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,222,340,10 - DEFPUSHBUTTON "OK",IDOK,257,262,50,14 - PUSHBUTTON "Cancel",IDCANCEL,313,262,50,14 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,222,339,10 + CONTROL "Disable ""Evil Maid"" attack detection",IDC_DISABLE_EVIL_MAID_ATTACK_DETECTION, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,237,339,10 + CONTROL "Block TRIM command on system partition/drive",IDC_BLOCK_SYSENC_TRIM, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,251,339,10 + CONTROL "Clear encryption keys from memory if a new device is inserted",IDC_CLEAR_KEYS_ON_NEW_DEVICE_INSERTION, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,265,339,10 + CONTROL "Automatically fix boot configuration issues that may prevent Windows from starting",IDC_UPDATE_BOOTLOADER_ON_SHUTDOWN, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,298,339,10 + PUSHBUTTON "Cancel",IDCANCEL,314,320,50,14 + DEFPUSHBUTTON "OK",IDOK,257,320,50,14 LTEXT "Display this custom message in the pre-boot authentication screen (24 characters maximum):",IDT_CUSTOM_BOOT_LOADER_MESSAGE,18,39,337,8 - GROUPBOX "Boot Loader Screen Options",IDT_BOOT_LOADER_SCREEN_OPTIONS,8,7,355,165 - GROUPBOX "Security Options",IDT_SECURITY_OPTIONS,8,177,355,75 LTEXT "",IDC_CUSTOM_BOOT_LOADER_MESSAGE_HELP,18,72,337,73 - CONTROL "Disable ""Evil Maid"" attack detection",IDC_DISABLE_EVIL_MAID_ATTACK_DETECTION, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,237,340,10 - CONTROL "Include PIM when caching pre-boot authentication password",IDC_BOOT_LOADER_CACHE_PIM, - "Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,18,207,340,10 - CONTROL "Do not request PIM in the pre-boot authentication screen (PIM value is stored unencrypted on disk)",IDC_DISABLE_BOOT_LOADER_PIM_PROMPT, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,157,339,9 + GROUPBOX "Security Options",IDT_SECURITY_OPTIONS,9,177,355,105 + GROUPBOX "Boot Loader Screen Options",IDT_BOOT_LOADER_SCREEN_OPTIONS,9,7,355,165 + GROUPBOX "Advanced Options",IDT_ADVANCED_OPTIONS,9,285,355,29 END ///////////////////////////////////////////////////////////////////////////// // // DESIGNINFO // #ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO +GUIDELINES DESIGNINFO BEGIN IDD_PREFERENCES_DLG, DIALOG BEGIN LEFTMARGIN, 7 RIGHTMARGIN, 329 TOPMARGIN, 7 - BOTTOMMARGIN, 338 + BOTTOMMARGIN, 345 END IDD_VOLUME_PROPERTIES, DIALOG BEGIN @@ -480,19 +513,19 @@ BEGIN IDD_EFI_SYSENC_SETTINGS, DIALOG BEGIN LEFTMARGIN, 7 - RIGHTMARGIN, 363 + RIGHTMARGIN, 368 TOPMARGIN, 7 - BOTTOMMARGIN, 129 + BOTTOMMARGIN, 240 END IDD_PERFORMANCE_SETTINGS, DIALOG BEGIN LEFTMARGIN, 7 - RIGHTMARGIN, 363 + RIGHTMARGIN, 364 TOPMARGIN, 7 - BOTTOMMARGIN, 241 + BOTTOMMARGIN, 293 END IDD_FAVORITE_VOLUMES, DIALOG BEGIN @@ -512,11 +545,11 @@ BEGIN IDD_SYSENC_SETTINGS, DIALOG BEGIN LEFTMARGIN, 7 - RIGHTMARGIN, 363 + RIGHTMARGIN, 364 TOPMARGIN, 7 - BOTTOMMARGIN, 276 + BOTTOMMARGIN, 334 END END #endif // APSTUDIO_INVOKED @@ -526,10 +559,10 @@ END // Version // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,20,2,0 - PRODUCTVERSION 1,20,2,0 + FILEVERSION 1,26,17,2 + PRODUCTVERSION 1,26,17,2 FILEFLAGSMASK 0x17L #ifdef _DEBUG FILEFLAGS 0x1L #else @@ -544,13 +577,13 @@ BEGIN BLOCK "040904b0" BEGIN VALUE "CompanyName", "IDRIX" VALUE "FileDescription", "VeraCrypt" - VALUE "FileVersion", "1.20-BETA2" + VALUE "FileVersion", "1.26.17" VALUE "LegalTrademarks", "VeraCrypt" VALUE "OriginalFilename", "VeraCrypt.exe" VALUE "ProductName", "VeraCrypt" - VALUE "ProductVersion", "1.20-BETA2" + VALUE "ProductVersion", "1.26.17" END END BLOCK "VarFileInfo" BEGIN @@ -602,9 +635,9 @@ IDB_SYS_DRIVEICON_MASK BITMAP "System_drive_icon_mask_96dpi.bm // // Menu // -IDR_MENU MENU +IDR_MENU MENU BEGIN POPUP "&Volumes" BEGIN MENUITEM "Select File...", IDM_SELECT_FILE @@ -637,9 +670,9 @@ BEGIN MENUITEM "Create Hidden Operating System...", IDM_CREATE_HIDDEN_OS MENUITEM SEPARATOR MENUITEM "Create Rescue Disk...", IDM_CREATE_RESCUE_DISK MENUITEM "Verify Rescue Disk", IDM_VERIFY_RESCUE_DISK - MENUITEM "Verify Rescue Disk Image", IDM_VERIFY_RESCUE_DISK_ISO + MENUITEM "Verify Rescue Disk Image", IDM_VERIFY_RESCUE_DISK_ISO MENUITEM SEPARATOR MENUITEM "Mount Without Pre-Boot &Authentication...", IDM_MOUNT_SYSENC_PART_WITHOUT_PBA MENUITEM SEPARATOR MENUITEM "Change Password...", IDM_CHANGE_SYS_PASSWORD @@ -721,9 +754,9 @@ END // // String Table // -STRINGTABLE +STRINGTABLE BEGIN IDS_UACSTRING "VeraCrypt" END diff --git a/src/Mount/Mount.vcproj b/src/Mount/Mount.vcproj deleted file mode 100644 index c9a6ebc5..00000000 --- a/src/Mount/Mount.vcproj +++ /dev/null @@ -1,1027 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="9.00" - Name="Mount" - ProjectGUID="{E4C40F94-E7F9-4981-86E4-186B46F993F3}" - RootNamespace="Mount" - Keyword="Win32Proj" - TargetFrameworkVersion="131072" - > - <Platforms> - <Platform - Name="Win32" - /> - <Platform - Name="x64" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="Debug" - IntermediateDirectory="Debug" - ConfigurationType="1" - InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - AdditionalIncludeDirectories="" - TypeLibraryName="$(SolutionDir)/$(ProjectName)/$(ProjectName).tlb" - OutputDirectory="" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories="..\Common;..\Crypto;..\;..\PKCS11" - PreprocessorDefinitions="TCMOUNT;WIN32;DEBUG;_DEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NON_CONFORMING_SWPRINTFS" - MinimalRebuild="true" - ExceptionHandling="1" - BasicRuntimeChecks="3" - RuntimeLibrary="1" - BufferSecurityCheck="true" - EnableFunctionLevelLinking="false" - UsePrecompiledHeader="0" - BrowseInformation="0" - BrowseInformationFile="" - WarningLevel="4" - DebugInformationFormat="4" - DisableSpecificWarnings="4057;4100;4127;4201;4701;4706" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="..\Crypto\Debug\crypto.lib mpr.lib" - OutputFile="$(OutDir)/VeraCrypt.exe" - LinkIncremental="2" - GenerateManifest="false" - IgnoreAllDefaultLibraries="false" - DelayLoadDLLs="mpr.dll" - GenerateDebugInformation="true" - ProgramDatabaseFile="$(OutDir)/Mount.pdb" - SubSystem="2" - RandomizedBaseAddress="1" - DataExecutionPrevention="2" - TargetMachine="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - AdditionalManifestFiles="Mount.manifest" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCPostBuildEventTool" - CommandLine="md "..\Debug\Setup Files" 2>NUL:
copy Debug\VeraCrypt.exe "..\Debug\Setup Files" >NUL:
" - /> - </Configuration> - <Configuration - Name="Debug|x64" - OutputDirectory="$(PlatformName)\$(ConfigurationName)" - IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" - ConfigurationType="1" - InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - AdditionalIncludeDirectories="" - TargetEnvironment="3" - TypeLibraryName="$(SolutionDir)/$(ProjectName)/$(ProjectName).tlb" - OutputDirectory="" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories="..\Common;..\Crypto;..\;..\PKCS11" - PreprocessorDefinitions="TCMOUNT;WIN32;DEBUG;_DEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NON_CONFORMING_SWPRINTFS" - MinimalRebuild="true" - ExceptionHandling="1" - BasicRuntimeChecks="3" - RuntimeLibrary="1" - BufferSecurityCheck="true" - EnableFunctionLevelLinking="false" - UsePrecompiledHeader="0" - BrowseInformation="0" - BrowseInformationFile="" - WarningLevel="4" - DebugInformationFormat="3" - DisableSpecificWarnings="4057;4100;4127;4201;4701;4706" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="..\Crypto\x64\Debug\crypto.lib mpr.lib" - OutputFile="$(OutDir)/VeraCrypt.exe" - LinkIncremental="2" - GenerateManifest="false" - IgnoreAllDefaultLibraries="false" - DelayLoadDLLs="mpr.dll" - GenerateDebugInformation="true" - ProgramDatabaseFile="$(OutDir)/Mount.pdb" - SubSystem="2" - RandomizedBaseAddress="1" - DataExecutionPrevention="2" - TargetMachine="17" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - AdditionalManifestFiles="Mount.manifest" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCPostBuildEventTool" - CommandLine="md "..\Debug\Setup Files" 2>NUL:
copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt-x64.exe" >NUL:
" - /> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory="Release" - IntermediateDirectory="Release" - ConfigurationType="1" - InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - AdditionalIncludeDirectories="" - TypeLibraryName="$(SolutionDir)/$(ProjectName)/$(ProjectName).tlb" - OutputDirectory="" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalOptions="/w34189" - Optimization="2" - AdditionalIncludeDirectories="..\Common;..\Crypto;..\;..\PKCS11" - PreprocessorDefinitions="TCMOUNT;WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NON_CONFORMING_SWPRINTFS" - RuntimeLibrary="0" - BufferSecurityCheck="true" - UsePrecompiledHeader="0" - AssemblerOutput="2" - AssemblerListingLocation="$(IntDir)/" - WarningLevel="4" - DebugInformationFormat="0" - DisableSpecificWarnings="4057;4100;4127;4201;4701;4706" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="..\Crypto\Release\crypto.lib mpr.lib" - OutputFile="$(OutDir)/VeraCrypt.exe" - LinkIncremental="1" - GenerateManifest="false" - IgnoreAllDefaultLibraries="false" - DelayLoadDLLs="mpr.dll" - GenerateDebugInformation="false" - GenerateMapFile="true" - SubSystem="2" - OptimizeReferences="2" - EnableCOMDATFolding="2" - RandomizedBaseAddress="1" - DataExecutionPrevention="2" - TargetMachine="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - AdditionalManifestFiles="Mount.manifest" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCPostBuildEventTool" - CommandLine="copy Release\VeraCrypt.exe "..\Release\Setup Files"" - /> - </Configuration> - <Configuration - Name="Release|x64" - OutputDirectory="$(PlatformName)\$(ConfigurationName)" - IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" - ConfigurationType="1" - InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - AdditionalIncludeDirectories="" - TargetEnvironment="3" - TypeLibraryName="$(SolutionDir)/$(ProjectName)/$(ProjectName).tlb" - OutputDirectory="" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalOptions="/w34189" - Optimization="2" - AdditionalIncludeDirectories="..\Common;..\Crypto;..\;..\PKCS11" - PreprocessorDefinitions="TCMOUNT;WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NON_CONFORMING_SWPRINTFS" - RuntimeLibrary="0" - BufferSecurityCheck="true" - UsePrecompiledHeader="0" - AssemblerOutput="2" - AssemblerListingLocation="$(IntDir)/" - WarningLevel="4" - DebugInformationFormat="0" - DisableSpecificWarnings="4057;4100;4127;4201;4701;4706" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="..\Crypto\x64\Release\crypto.lib mpr.lib" - OutputFile="$(OutDir)/VeraCrypt.exe" - LinkIncremental="1" - GenerateManifest="false" - IgnoreAllDefaultLibraries="false" - DelayLoadDLLs="mpr.dll" - GenerateDebugInformation="false" - GenerateMapFile="true" - SubSystem="2" - OptimizeReferences="2" - EnableCOMDATFolding="2" - RandomizedBaseAddress="1" - DataExecutionPrevention="2" - TargetMachine="17" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - AdditionalManifestFiles="Mount.manifest" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCPostBuildEventTool" - CommandLine="copy $(TargetPath) "..\Release\Setup Files\VeraCrypt-x64.exe"" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="Source Files" - Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" - > - <File - RelativePath=".\Favorites.cpp" - > - </File> - <File - RelativePath=".\Hotkeys.c" - > - </File> - <File - RelativePath=".\MainCom.cpp" - > - </File> - <File - RelativePath=".\MainCom.idl" - > - </File> - <File - RelativePath=".\Mount.c" - > - <FileConfiguration - Name="Debug|Win32" - > - <Tool - Name="VCCLCompilerTool" - CompileAs="2" - /> - </FileConfiguration> - <FileConfiguration - Name="Debug|x64" - > - <Tool - Name="VCCLCompilerTool" - CompileAs="2" - /> - </FileConfiguration> - <FileConfiguration - Name="Release|Win32" - > - <Tool - Name="VCCLCompilerTool" - CompileAs="2" - /> - </FileConfiguration> - <FileConfiguration - Name="Release|x64" - > - <Tool - Name="VCCLCompilerTool" - CompileAs="2" - /> - </FileConfiguration> - </File> - <Filter - Name="Common" - > - <File - RelativePath="..\Common\BaseCom.cpp" - > - </File> - <File - RelativePath="..\Common\BootEncryption.cpp" - > - </File> - <File - RelativePath="..\Common\Cmdline.c" - > - </File> - <File - RelativePath="..\Common\Combo.c" - > - </File> - <File - RelativePath="..\Common\Crc.c" - > - </File> - <File - RelativePath="..\Common\Crypto.c" - > - </File> - <File - RelativePath="..\Common\Dictionary.c" - > - <FileConfiguration - Name="Debug|Win32" - > - <Tool - Name="VCCLCompilerTool" - CompileAs="2" - /> - </FileConfiguration> - <FileConfiguration - Name="Debug|x64" - > - <Tool - Name="VCCLCompilerTool" - CompileAs="2" - /> - </FileConfiguration> - <FileConfiguration - Name="Release|Win32" - > - <Tool - Name="VCCLCompilerTool" - CompileAs="2" - /> - </FileConfiguration> - <FileConfiguration - Name="Release|x64" - > - <Tool - Name="VCCLCompilerTool" - CompileAs="2" - /> - </FileConfiguration> - </File> - <File - RelativePath="..\Common\Dlgcode.c" - > - <FileConfiguration - Name="Debug|Win32" - > - <Tool - Name="VCCLCompilerTool" - CompileAs="2" - /> - </FileConfiguration> - <FileConfiguration - Name="Debug|x64" - > - <Tool - Name="VCCLCompilerTool" - CompileAs="2" - /> - </FileConfiguration> - <FileConfiguration - Name="Release|Win32" - > - <Tool - Name="VCCLCompilerTool" - CompileAs="2" - /> - </FileConfiguration> - <FileConfiguration - Name="Release|x64" - > - <Tool - Name="VCCLCompilerTool" - CompileAs="2" - /> - </FileConfiguration> - </File> - <File - RelativePath="..\Common\EncryptionThreadPool.c" - > - </File> - <File - RelativePath="..\Common\Endian.c" - > - </File> - <File - RelativePath="..\Common\GfMul.c" - > - </File> - <File - RelativePath="..\Common\Keyfiles.c" - > - <FileConfiguration - Name="Debug|Win32" - > - <Tool - Name="VCCLCompilerTool" - CompileAs="2" - /> - </FileConfiguration> - <FileConfiguration - Name="Debug|x64" - > - <Tool - Name="VCCLCompilerTool" - CompileAs="2" - /> - </FileConfiguration> - <FileConfiguration - Name="Release|Win32" - > - <Tool - Name="VCCLCompilerTool" - CompileAs="2" - /> - </FileConfiguration> - <FileConfiguration - Name="Release|x64" - > - <Tool - Name="VCCLCompilerTool" - CompileAs="2" - /> - </FileConfiguration> - </File> - <File - RelativePath="..\Common\Language.c" - > - </File> - <File - RelativePath="..\Common\Password.c" - > - </File> - <File - RelativePath="..\Common\Pkcs5.c" - > - </File> - <File - RelativePath="..\Common\Random.c" - > - </File> - <File - RelativePath="..\Common\Registry.c" - > - </File> - <File - RelativePath="..\Common\SecurityToken.cpp" - > - </File> - <File - RelativePath="..\Common\Tests.c" - > - </File> - <File - RelativePath="..\Common\Volumes.c" - > - </File> - <File - RelativePath="..\Common\Wipe.c" - > - </File> - <File - RelativePath="..\Common\Wipe.h" - > - </File> - <File - RelativePath="..\Common\Xml.c" - > - </File> - <File - RelativePath="..\Common\Xts.c" - > - </File> - </Filter> - </Filter> - <Filter - Name="Header Files" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - <File - RelativePath="..\Common\Apidrvr.h" - > - </File> - <File - RelativePath="..\Common\BaseCom.h" - > - </File> - <File - RelativePath="..\Common\BootEncryption.h" - > - </File> - <File - RelativePath="..\Common\Cmdline.h" - > - </File> - <File - RelativePath="..\Common\Combo.h" - > - </File> - <File - RelativePath="..\Common\Common.h" - > - </File> - <File - RelativePath="..\Common\Crc.h" - > - </File> - <File - RelativePath="..\Common\Crypto.h" - > - </File> - <File - RelativePath="..\Common\Dictionary.h" - > - </File> - <File - RelativePath="..\Common\Dlgcode.h" - > - </File> - <File - RelativePath="..\Common\EncryptionThreadPool.h" - > - </File> - <File - RelativePath="..\Common\Exception.h" - > - </File> - <File - RelativePath=".\Favorites.h" - > - </File> - <File - RelativePath="..\Common\GfMul.h" - > - </File> - <File - RelativePath=".\Hotkeys.h" - > - </File> - <File - RelativePath="..\Common\Keyfiles.h" - > - </File> - <File - RelativePath="..\Common\Language.h" - > - </File> - <File - RelativePath=".\MainCom.h" - > - </File> - <File - RelativePath=".\Mount.h" - > - </File> - <File - RelativePath="..\Common\Password.h" - > - </File> - <File - RelativePath="..\Common\Pkcs5.h" - > - </File> - <File - RelativePath="..\Common\Random.h" - > - </File> - <File - RelativePath="..\Common\Registry.h" - > - </File> - <File - RelativePath="..\Common\Resource.h" - > - </File> - <File - RelativePath=".\resource.h" - > - </File> - <File - RelativePath="..\Common\SecurityToken.h" - > - </File> - <File - RelativePath="..\Common\Tcdefs.h" - > - </File> - <File - RelativePath="..\Common\Tests.h" - > - </File> - <File - RelativePath="..\Common\Volumes.h" - > - </File> - <File - RelativePath="..\Common\Xml.h" - > - </File> - <File - RelativePath="..\Common\Xts.h" - > - </File> - </Filter> - <Filter - Name="Resource Files" - Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" - UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" - > - <File - RelativePath="..\Boot\Windows\Rescue_Serpent_SHA2\BootSector.bin" - > - </File> - <File - RelativePath="..\Boot\Windows\Rescue_AES_SHA2\BootSector.bin" - > - </File> - <File - RelativePath="..\Boot\Windows\Rescue_SHA2\BootSector.bin" - > - </File> - <File - RelativePath="..\Boot\Windows\Release_Twofish_SHA2\BootSector.bin" - > - </File> - <File - RelativePath="..\Boot\Windows\Release_Serpent_SHA2\BootSector.bin" - > - </File> - <File - RelativePath="..\Boot\Windows\Release_AES_SHA2\BootSector.bin" - > - </File> - <File - RelativePath="..\Boot\Windows\Release_SHA2\BootSector.bin" - > - </File> - <File - RelativePath="..\Boot\Windows\Rescue_Twofish_SHA2\BootSector.bin" - > - </File> - <File - RelativePath=".\Drive_icon_96dpi.bmp" - > - </File> - <File - RelativePath=".\Drive_icon_mask_96dpi.bmp" - > - </File> - <File - RelativePath=".\Logo_288dpi.bmp" - > - </File> - <File - RelativePath=".\Logo_96dpi.bmp" - > - </File> - <File - RelativePath=".\Mount.manifest" - > - </File> - <File - RelativePath=".\Mount.rc" - > - </File> - <File - RelativePath=".\Mount.tlb" - > - </File> - <File - RelativePath=".\System_drive_icon_96dpi.bmp" - > - </File> - <File - RelativePath=".\System_drive_icon_mask_96dpi.bmp" - > - </File> - <File - RelativePath="..\Common\VeraCrypt_mounted.ico" - > - </File> - <File - RelativePath="..\Common\VeraCrypt_volume.ico" - > - </File> - <Filter - Name="Common" - > - <File - RelativePath="..\Boot\Windows\Rescue_Twofish\BootLoader.com.gz" - > - </File> - <File - RelativePath="..\Boot\Windows\Release_Serpent\BootLoader.com.gz" - > - </File> - <File - RelativePath="..\Boot\Windows\Release_AES\BootLoader.com.gz" - > - </File> - <File - RelativePath="..\Boot\Windows\Release\BootLoader.com.gz" - > - </File> - <File - RelativePath="..\Boot\Windows\Release_Twofish\BootLoader.com.gz" - > - </File> - <File - RelativePath="..\Boot\Windows\Rescue_Serpent\BootLoader.com.gz" - > - </File> - <File - RelativePath="..\Boot\Windows\Rescue_AES\BootLoader.com.gz" - > - </File> - <File - RelativePath="..\Boot\Windows\Rescue\BootLoader.com.gz" - > - </File> - <File - RelativePath="..\Boot\Windows\Rescue\BootSector.bin" - > - </File> - <File - RelativePath="..\Boot\Windows\Release_Twofish\BootSector.bin" - > - </File> - <File - RelativePath="..\Boot\Windows\Release_Serpent\BootSector.bin" - > - </File> - <File - RelativePath="..\Boot\Windows\Rescue_Serpent\BootSector.bin" - > - </File> - <File - RelativePath="..\Boot\Windows\Rescue_AES\BootSector.bin" - > - </File> - <File - RelativePath="..\Boot\Windows\Release\BootSector.bin" - > - </File> - <File - RelativePath="..\Boot\Windows\Rescue_Twofish\BootSector.bin" - > - </File> - <File - RelativePath="..\Boot\Windows\Release_AES\BootSector.bin" - > - </File> - <File - RelativePath="..\Common\Common.rc" - > - <FileConfiguration - Name="Debug|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCResourceCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="Debug|x64" - ExcludedFromBuild="true" - > - <Tool - Name="VCResourceCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="Release|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCResourceCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="Release|x64" - ExcludedFromBuild="true" - > - <Tool - Name="VCResourceCompilerTool" - /> - </FileConfiguration> - </File> - <File - RelativePath="..\Boot\Windows\Release\Decompressor.com" - > - </File> - <File - RelativePath="..\Common\Language.xml" - > - </File> - <File - RelativePath="..\Resources\Texts\License.rtf" - > - </File> - <File - RelativePath="..\Common\Textual_logo_288dpi.bmp" - > - </File> - <File - RelativePath="..\Common\Textual_logo_96dpi.bmp" - > - </File> - <File - RelativePath="..\Common\Textual_logo_background.bmp" - > - </File> - <File - RelativePath="..\Common\VeraCrypt.ico" - > - </File> - </Filter> - </Filter> - <File - RelativePath="..\Boot\Windows\Rescue_AES_SHA2\BootLoader.com.gz" - > - </File> - <File - RelativePath="..\Boot\Windows\Rescue_Serpent_SHA2\BootLoader.com.gz" - > - </File> - <File - RelativePath="..\Boot\Windows\Rescue_Twofish_SHA2\BootLoader.com.gz" - > - </File> - <File - RelativePath="..\Boot\Windows\Release_SHA2\BootLoader.com.gz" - > - </File> - <File - RelativePath="..\Boot\Windows\Release_AES_SHA2\BootLoader.com.gz" - > - </File> - <File - RelativePath="..\Boot\Windows\Release_Serpent_SHA2\BootLoader.com.gz" - > - </File> - <File - RelativePath="..\Boot\Windows\Release_Twofish_SHA2\BootLoader.com.gz" - > - </File> - <File - RelativePath="..\Boot\Windows\Rescue_SHA2\BootLoader.com.gz" - > - </File> - </Files> - <Globals> - </Globals> -</VisualStudioProject> diff --git a/src/Mount/Mount.vcxproj b/src/Mount/Mount.vcxproj index 16edb514..38e63cac 100644 --- a/src/Mount/Mount.vcxproj +++ b/src/Mount/Mount.vcxproj @@ -1,18 +1,26 @@ <?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> + <ProjectConfiguration Include="Debug|ARM64"> <Configuration>Debug</Configuration> - <Platform>Win32</Platform> + <Platform>ARM64</Platform> </ProjectConfiguration> <ProjectConfiguration Include="Debug|x64"> <Configuration>Debug</Configuration> <Platform>x64</Platform> </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> + <ProjectConfiguration Include="ReleaseCustomEFI|ARM64"> + <Configuration>ReleaseCustomEFI</Configuration> + <Platform>ARM64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="ReleaseCustomEFI|x64"> + <Configuration>ReleaseCustomEFI</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|ARM64"> <Configuration>Release</Configuration> - <Platform>Win32</Platform> + <Platform>ARM64</Platform> </ProjectConfiguration> <ProjectConfiguration Include="Release|x64"> <Configuration>Release</Configuration> <Platform>x64</Platform> @@ -21,139 +29,177 @@ <PropertyGroup Label="Globals"> <ProjectGuid>{E4C40F94-E7F9-4981-86E4-186B46F993F3}</ProjectGuid> <RootNamespace>Mount</RootNamespace> <Keyword>Win32Proj</Keyword> + <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion> + <ProjectName>Mount</ProjectName> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <CharacterSet>Unicode</CharacterSet> - <PlatformToolset>Windows7.1SDK</PlatformToolset> + <PlatformToolset>v143</PlatformToolset> + <SpectreMitigation>Spectre</SpectreMitigation> </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <CharacterSet>Unicode</CharacterSet> - <PlatformToolset>Windows7.1SDK</PlatformToolset> + <PlatformToolset>v143</PlatformToolset> + <SpectreMitigation>Spectre</SpectreMitigation> </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseCustomEFI|x64'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <CharacterSet>Unicode</CharacterSet> - <PlatformToolset>Windows7.1SDK</PlatformToolset> + <PlatformToolset>v143</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseCustomEFI|ARM64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <PlatformToolset>v143</PlatformToolset> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <CharacterSet>Unicode</CharacterSet> - <PlatformToolset>Windows7.1SDK</PlatformToolset> + <PlatformToolset>v143</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <PlatformToolset>v143</PlatformToolset> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <ImportGroup Label="ExtensionSettings"> </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="PropertySheets"> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseCustomEFI|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseCustomEFI|ARM64'" Label="PropertySheets"> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> </ImportGroup> <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> + </ImportGroup> <PropertyGroup Label="UserMacros" /> <PropertyGroup> <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Debug\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Debug\</IntDir> - <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> - <GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</GenerateManifest> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectDir)$(Platform)\$(Configuration)\</OutDir> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">$(ProjectDir)$(Platform)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectDir)$(Platform)\$(Configuration)\</IntDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">$(ProjectDir)$(Platform)\$(Configuration)\</IntDir> <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</LinkIncremental> <GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</GenerateManifest> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Release\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Release\</IntDir> - <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental> - <GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</GenerateManifest> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir> + <GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</GenerateManifest> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectDir)$(Platform)\$(Configuration)\</OutDir> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">$(ProjectDir)$(Platform)\$(Configuration)\</OutDir> + <OutDir Condition="'$(Configuration)|$(Platform)'=='ReleaseCustomEFI|x64'">$(ProjectDir)$(Platform)\$(Configuration)\</OutDir> + <OutDir Condition="'$(Configuration)|$(Platform)'=='ReleaseCustomEFI|ARM64'">$(ProjectDir)$(Platform)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectDir)$(Platform)\$(Configuration)\</IntDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">$(ProjectDir)$(Platform)\$(Configuration)\</IntDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='ReleaseCustomEFI|x64'">$(ProjectDir)$(Platform)\$(Configuration)\</IntDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='ReleaseCustomEFI|ARM64'">$(ProjectDir)$(Platform)\$(Configuration)\</IntDir> <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">false</LinkIncremental> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='ReleaseCustomEFI|x64'">false</LinkIncremental> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='ReleaseCustomEFI|ARM64'">false</LinkIncremental> <GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</GenerateManifest> - <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">VeraCrypt</TargetName> - <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">VeraCrypt</TargetName> + <GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</GenerateManifest> + <GenerateManifest Condition="'$(Configuration)|$(Platform)'=='ReleaseCustomEFI|x64'">true</GenerateManifest> + <GenerateManifest Condition="'$(Configuration)|$(Platform)'=='ReleaseCustomEFI|ARM64'">true</GenerateManifest> <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">VeraCrypt</TargetName> + <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">VeraCrypt</TargetName> <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">VeraCrypt</TargetName> + <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">VeraCrypt</TargetName> + <TargetName Condition="'$(Configuration)|$(Platform)'=='ReleaseCustomEFI|x64'">VeraCrypt</TargetName> + <TargetName Condition="'$(Configuration)|$(Platform)'=='ReleaseCustomEFI|ARM64'">VeraCrypt</TargetName> </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <Midl> <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <TargetEnvironment>X64</TargetEnvironment> <TypeLibraryName>$(SolutionDir)/$(ProjectName)/$(ProjectName).tlb</TypeLibraryName> <OutputDirectory> </OutputDirectory> </Midl> <ClCompile> <Optimization>Disabled</Optimization> - <AdditionalIncludeDirectories>..\Common;..\Crypto;..\;..\PKCS11;..\Common\zlib;..\Common\libzip;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>..\Common;..\Crypto;..\;..\PKCS11;..\Common\zlib;..\Common\libzip;..\Common\lzma;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>TCMOUNT;WIN32;HAVE_CONFIG_H;ZIP_STATIC;DEBUG;_DEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NON_CONFORMING_SWPRINTFS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <MinimalRebuild>true</MinimalRebuild> <ExceptionHandling>Sync</ExceptionHandling> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <BufferSecurityCheck>true</BufferSecurityCheck> - <FunctionLevelLinking>false</FunctionLevelLinking> + <FunctionLevelLinking> + </FunctionLevelLinking> <PrecompiledHeader> </PrecompiledHeader> <BrowseInformation> </BrowseInformation> <BrowseInformationFile> </BrowseInformationFile> <WarningLevel>Level4</WarningLevel> - <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DisableSpecificWarnings>4057;4100;4127;4201;4701;4706;4131;%(DisableSpecificWarnings)</DisableSpecificWarnings> </ClCompile> <Link> - <AdditionalDependencies>..\Crypto\Debug\crypto.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies>..\Crypto\x64\Debug\crypto.lib;..\Common\x64\Debug\Zip.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies> <OutputFile>$(OutDir)VeraCrypt.exe</OutputFile> <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries> - <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs> + <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs> <GenerateDebugInformation>true</GenerateDebugInformation> <ProgramDatabaseFile>$(OutDir)Mount.pdb</ProgramDatabaseFile> <SubSystem>Windows</SubSystem> <RandomizedBaseAddress>false</RandomizedBaseAddress> <DataExecutionPrevention>true</DataExecutionPrevention> - <TargetMachine>MachineX86</TargetMachine> + <TargetMachine>MachineX64</TargetMachine> + <GenerateMapFile>true</GenerateMapFile> </Link> <Manifest> <AdditionalManifestFiles>Mount.manifest;%(AdditionalManifestFiles)</AdditionalManifestFiles> </Manifest> <PostBuildEvent> <Command>md "..\Debug\Setup Files" 2>NUL: -copy Debug\VeraCrypt.exe "..\Debug\Setup Files" >NUL: +copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt-x64.exe" >NUL: </Command> </PostBuildEvent> + <ResourceCompile> + <PreprocessorDefinitions>WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ResourceCompile> </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'"> <Midl> <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <TargetEnvironment>X64</TargetEnvironment> <TypeLibraryName>$(SolutionDir)/$(ProjectName)/$(ProjectName).tlb</TypeLibraryName> <OutputDirectory> </OutputDirectory> </Midl> <ClCompile> <Optimization>Disabled</Optimization> - <AdditionalIncludeDirectories>..\Common;..\Crypto;..\;..\PKCS11;..\Common\zlib;..\Common\libzip;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>..\Common;..\Crypto;..\;..\PKCS11;..\Common\zlib;..\Common\libzip;..\Common\lzma;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>TCMOUNT;WIN32;HAVE_CONFIG_H;ZIP_STATIC;DEBUG;_DEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NON_CONFORMING_SWPRINTFS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <MinimalRebuild>true</MinimalRebuild> <ExceptionHandling>Sync</ExceptionHandling> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <BufferSecurityCheck>true</BufferSecurityCheck> - <FunctionLevelLinking>false</FunctionLevelLinking> + <FunctionLevelLinking> + </FunctionLevelLinking> <PrecompiledHeader> </PrecompiledHeader> <BrowseInformation> </BrowseInformation> @@ -163,107 +209,158 @@ copy Debug\VeraCrypt.exe "..\Debug\Setup Files" >NUL: <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DisableSpecificWarnings>4057;4100;4127;4201;4701;4706;4131;%(DisableSpecificWarnings)</DisableSpecificWarnings> </ClCompile> <Link> - <AdditionalDependencies>..\Crypto\x64\Debug\crypto.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies>..\Crypto\ARM64\Debug\crypto.lib;..\Common\ARM64\Debug\Zip.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies> <OutputFile>$(OutDir)VeraCrypt.exe</OutputFile> <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries> - <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs> + <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs> <GenerateDebugInformation>true</GenerateDebugInformation> <ProgramDatabaseFile>$(OutDir)Mount.pdb</ProgramDatabaseFile> <SubSystem>Windows</SubSystem> - <RandomizedBaseAddress>false</RandomizedBaseAddress> <DataExecutionPrevention>true</DataExecutionPrevention> - <TargetMachine>MachineX64</TargetMachine> + <GenerateMapFile>true</GenerateMapFile> </Link> <Manifest> <AdditionalManifestFiles>Mount.manifest;%(AdditionalManifestFiles)</AdditionalManifestFiles> </Manifest> <PostBuildEvent> <Command>md "..\Debug\Setup Files" 2>NUL: -copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt-x64.exe" >NUL: +copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt-arm64.exe" >NUL: </Command> </PostBuildEvent> + <ResourceCompile> + <PreprocessorDefinitions>WIN64;ARM64;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ResourceCompile> </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <Midl> <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <TargetEnvironment>X64</TargetEnvironment> <TypeLibraryName>$(SolutionDir)/$(ProjectName)/$(ProjectName).tlb</TypeLibraryName> <OutputDirectory> </OutputDirectory> </Midl> <ClCompile> <AdditionalOptions>/w34189 %(AdditionalOptions)</AdditionalOptions> <Optimization>MaxSpeed</Optimization> - <AdditionalIncludeDirectories>..\Common;..\Crypto;..\;..\PKCS11;..\Common\zlib;..\Common\libzip;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>..\Common;..\Crypto;..\;..\PKCS11;..\Common\zlib;..\Common\libzip;..\Common\lzma;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>TCMOUNT;WIN32;HAVE_CONFIG_H;ZIP_STATIC;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NON_CONFORMING_SWPRINTFS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> <BufferSecurityCheck>true</BufferSecurityCheck> <PrecompiledHeader> </PrecompiledHeader> <AssemblerOutput>All</AssemblerOutput> <AssemblerListingLocation>$(IntDir)</AssemblerListingLocation> <WarningLevel>Level4</WarningLevel> - <DebugInformationFormat> - </DebugInformationFormat> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DisableSpecificWarnings>4057;4100;4127;4201;4701;4706;4131;%(DisableSpecificWarnings)</DisableSpecificWarnings> + <ControlFlowGuard>Guard</ControlFlowGuard> </ClCompile> <Link> - <AdditionalDependencies>..\Crypto\Release\crypto.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies>..\Crypto\x64\Release\crypto.lib;..\Common\x64\Release\Zip.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies> <OutputFile>$(OutDir)VeraCrypt.exe</OutputFile> <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries> - <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs> - <GenerateDebugInformation>false</GenerateDebugInformation> + <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs> + <GenerateDebugInformation>true</GenerateDebugInformation> <GenerateMapFile>true</GenerateMapFile> <SubSystem>Windows</SubSystem> <OptimizeReferences>true</OptimizeReferences> <EnableCOMDATFolding>true</EnableCOMDATFolding> - <RandomizedBaseAddress>false</RandomizedBaseAddress> + <RandomizedBaseAddress>true</RandomizedBaseAddress> <DataExecutionPrevention>true</DataExecutionPrevention> - <TargetMachine>MachineX86</TargetMachine> + <TargetMachine>MachineX64</TargetMachine> </Link> <Manifest> <AdditionalManifestFiles>Mount.manifest;%(AdditionalManifestFiles)</AdditionalManifestFiles> </Manifest> <PostBuildEvent> - <Command>copy Release\VeraCrypt.exe "..\Release\Setup Files"</Command> + <Command>copy $(TargetPath) "..\Release\Setup Files\VeraCrypt-x64.exe"</Command> </PostBuildEvent> + <ResourceCompile> + <PreprocessorDefinitions>WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ResourceCompile> </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'"> <Midl> <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <TargetEnvironment>X64</TargetEnvironment> <TypeLibraryName>$(SolutionDir)/$(ProjectName)/$(ProjectName).tlb</TypeLibraryName> <OutputDirectory> </OutputDirectory> </Midl> <ClCompile> <AdditionalOptions>/w34189 %(AdditionalOptions)</AdditionalOptions> <Optimization>MaxSpeed</Optimization> - <AdditionalIncludeDirectories>..\Common;..\Crypto;..\;..\PKCS11;..\Common\zlib;..\Common\libzip;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>..\Common;..\Crypto;..\;..\PKCS11;..\Common\zlib;..\Common\libzip;..\Common\lzma;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>TCMOUNT;WIN32;HAVE_CONFIG_H;ZIP_STATIC;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NON_CONFORMING_SWPRINTFS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> <BufferSecurityCheck>true</BufferSecurityCheck> <PrecompiledHeader> </PrecompiledHeader> <AssemblerOutput>All</AssemblerOutput> <AssemblerListingLocation>$(IntDir)</AssemblerListingLocation> <WarningLevel>Level4</WarningLevel> - <DebugInformationFormat> - </DebugInformationFormat> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DisableSpecificWarnings>4057;4100;4127;4201;4701;4706;4131;%(DisableSpecificWarnings)</DisableSpecificWarnings> + <ControlFlowGuard>Guard</ControlFlowGuard> </ClCompile> <Link> - <AdditionalDependencies>..\Crypto\x64\Release\crypto.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies>..\Crypto\ARM64\Release\crypto.lib;..\Common\ARM64\Release\Zip.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies> <OutputFile>$(OutDir)VeraCrypt.exe</OutputFile> <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries> - <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs> - <GenerateDebugInformation>false</GenerateDebugInformation> + <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs> + <GenerateDebugInformation>true</GenerateDebugInformation> <GenerateMapFile>true</GenerateMapFile> <SubSystem>Windows</SubSystem> <OptimizeReferences>true</OptimizeReferences> <EnableCOMDATFolding>true</EnableCOMDATFolding> - <RandomizedBaseAddress>false</RandomizedBaseAddress> + <RandomizedBaseAddress>true</RandomizedBaseAddress> + <DataExecutionPrevention>true</DataExecutionPrevention> + </Link> + <Manifest> + <AdditionalManifestFiles>Mount.manifest;%(AdditionalManifestFiles)</AdditionalManifestFiles> + </Manifest> + <PostBuildEvent> + <Command>copy $(TargetPath) "..\Release\Setup Files\VeraCrypt-arm64.exe"</Command> + </PostBuildEvent> + <ResourceCompile> + <PreprocessorDefinitions>WIN64;ARM64;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ResourceCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseCustomEFI|x64'"> + <Midl> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>$(SolutionDir)/$(ProjectName)/$(ProjectName).tlb</TypeLibraryName> + <OutputDirectory> + </OutputDirectory> + </Midl> + <ClCompile> + <AdditionalOptions>/w34189 %(AdditionalOptions)</AdditionalOptions> + <Optimization>MaxSpeed</Optimization> + <AdditionalIncludeDirectories>..\Common;..\Crypto;..\;..\PKCS11;..\Common\zlib;..\Common\libzip;..\Common\lzma;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>TCMOUNT;VC_EFI_CUSTOM_MODE;WIN32;HAVE_CONFIG_H;ZIP_STATIC;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NON_CONFORMING_SWPRINTFS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <BufferSecurityCheck>true</BufferSecurityCheck> + <PrecompiledHeader> + </PrecompiledHeader> + <AssemblerOutput>All</AssemblerOutput> + <AssemblerListingLocation>$(IntDir)</AssemblerListingLocation> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <DisableSpecificWarnings>4057;4100;4127;4201;4701;4706;4131;%(DisableSpecificWarnings)</DisableSpecificWarnings> + </ClCompile> + <Link> + <AdditionalDependencies>..\Crypto\x64\Release\crypto.lib;..\Common\x64\Release\Zip.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)VeraCrypt.exe</OutputFile> + <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries> + <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs> + <GenerateDebugInformation>true</GenerateDebugInformation> + <GenerateMapFile>true</GenerateMapFile> + <SubSystem>Windows</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <RandomizedBaseAddress>true</RandomizedBaseAddress> <DataExecutionPrevention>true</DataExecutionPrevention> <TargetMachine>MachineX64</TargetMachine> </Link> <Manifest> @@ -271,187 +368,113 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt-x64.exe" >NUL: </Manifest> <PostBuildEvent> <Command>copy $(TargetPath) "..\Release\Setup Files\VeraCrypt-x64.exe"</Command> </PostBuildEvent> + <ResourceCompile> + <PreprocessorDefinitions>VC_EFI_CUSTOM_MODE;WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ResourceCompile> </ItemDefinitionGroup> - <ItemGroup> - <ClCompile Include="..\Common\libzip\mkstemp.c"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_add.c" /> - <ClCompile Include="..\Common\libzip\zip_add_dir.c"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_add_entry.c" /> - <ClCompile Include="..\Common\libzip\zip_buffer.c" /> - <ClCompile Include="..\Common\libzip\zip_close.c" /> - <ClCompile Include="..\Common\libzip\zip_delete.c"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_dirent.c" /> - <ClCompile Include="..\Common\libzip\zip_dir_add.c"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_discard.c" /> - <ClCompile Include="..\Common\libzip\zip_entry.c" /> - <ClCompile Include="..\Common\libzip\zip_error.c" /> - <ClCompile Include="..\Common\libzip\zip_error_clear.c" /> - <ClCompile Include="..\Common\libzip\zip_error_get.c" /> - <ClCompile Include="..\Common\libzip\zip_error_get_sys_type.c" /> - <ClCompile Include="..\Common\libzip\zip_error_strerror.c" /> - <ClCompile Include="..\Common\libzip\zip_error_to_str.c" /> - <ClCompile Include="..\Common\libzip\zip_err_str.c" /> - <ClCompile Include="..\Common\libzip\zip_extra_field.c" /> - <ClCompile Include="..\Common\libzip\zip_extra_field_api.c" /> - <ClCompile Include="..\Common\libzip\zip_fclose.c" /> - <ClCompile Include="..\Common\libzip\zip_fdopen.c"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_filerange_crc.c" /> - <ClCompile Include="..\Common\libzip\zip_file_add.c" /> - <ClCompile Include="..\Common\libzip\zip_file_error_clear.c" /> - <ClCompile Include="..\Common\libzip\zip_file_error_get.c" /> - <ClCompile Include="..\Common\libzip\zip_file_get_comment.c" /> - <ClCompile Include="..\Common\libzip\zip_file_get_external_attributes.c" /> - <ClCompile Include="..\Common\libzip\zip_file_get_offset.c" /> - <ClCompile Include="..\Common\libzip\zip_file_rename.c" /> - <ClCompile Include="..\Common\libzip\zip_file_replace.c" /> - <ClCompile Include="..\Common\libzip\zip_file_set_comment.c" /> - <ClCompile Include="..\Common\libzip\zip_file_set_external_attributes.c" /> - <ClCompile Include="..\Common\libzip\zip_file_set_mtime.c" /> - <ClCompile Include="..\Common\libzip\zip_file_strerror.c" /> - <ClCompile Include="..\Common\libzip\zip_fopen.c" /> - <ClCompile Include="..\Common\libzip\zip_fopen_encrypted.c" /> - <ClCompile Include="..\Common\libzip\zip_fopen_index.c" /> - <ClCompile Include="..\Common\libzip\zip_fopen_index_encrypted.c" /> - <ClCompile Include="..\Common\libzip\zip_fread.c" /> - <ClCompile Include="..\Common\libzip\zip_get_archive_comment.c" /> - <ClCompile Include="..\Common\libzip\zip_get_archive_flag.c" /> - <ClCompile Include="..\Common\libzip\zip_get_compression_implementation.c" /> - <ClCompile Include="..\Common\libzip\zip_get_encryption_implementation.c" /> - <ClCompile Include="..\Common\libzip\zip_get_file_comment.c" /> - <ClCompile Include="..\Common\libzip\zip_get_name.c" /> - <ClCompile Include="..\Common\libzip\zip_get_num_entries.c" /> - <ClCompile Include="..\Common\libzip\zip_get_num_files.c" /> - <ClCompile Include="..\Common\libzip\zip_hash.c" /> - <ClCompile Include="..\Common\libzip\zip_io_util.c" /> - <ClCompile Include="..\Common\libzip\zip_memdup.c" /> - <ClCompile Include="..\Common\libzip\zip_name_locate.c" /> - <ClCompile Include="..\Common\libzip\zip_new.c" /> - <ClCompile Include="..\Common\libzip\zip_open.c" /> - <ClCompile Include="..\Common\libzip\zip_rename.c" /> - <ClCompile Include="..\Common\libzip\zip_replace.c" /> - <ClCompile Include="..\Common\libzip\zip_set_archive_comment.c" /> - <ClCompile Include="..\Common\libzip\zip_set_archive_flag.c" /> - <ClCompile Include="..\Common\libzip\zip_set_default_password.c" /> - <ClCompile Include="..\Common\libzip\zip_set_file_comment.c" /> - <ClCompile Include="..\Common\libzip\zip_set_file_compression.c" /> - <ClCompile Include="..\Common\libzip\zip_set_name.c" /> - <ClCompile Include="..\Common\libzip\zip_source_begin_write.c" /> - <ClCompile Include="..\Common\libzip\zip_source_buffer.c" /> - <ClCompile Include="..\Common\libzip\zip_source_call.c" /> - <ClCompile Include="..\Common\libzip\zip_source_close.c" /> - <ClCompile Include="..\Common\libzip\zip_source_commit_write.c" /> - <ClCompile Include="..\Common\libzip\zip_source_crc.c" /> - <ClCompile Include="..\Common\libzip\zip_source_deflate.c" /> - <ClCompile Include="..\Common\libzip\zip_source_error.c" /> - <ClCompile Include="..\Common\libzip\zip_source_filep.c"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseCustomEFI|ARM64'"> + <Midl> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <TypeLibraryName>$(SolutionDir)/$(ProjectName)/$(ProjectName).tlb</TypeLibraryName> + <OutputDirectory> + </OutputDirectory> + </Midl> + <ClCompile> + <AdditionalOptions>/w34189 %(AdditionalOptions)</AdditionalOptions> + <Optimization>MaxSpeed</Optimization> + <AdditionalIncludeDirectories>..\Common;..\Crypto;..\;..\PKCS11;..\Common\zlib;..\Common\libzip;..\Common\lzma;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>TCMOUNT;VC_EFI_CUSTOM_MODE;WIN32;HAVE_CONFIG_H;ZIP_STATIC;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NON_CONFORMING_SWPRINTFS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <BufferSecurityCheck>true</BufferSecurityCheck> + <PrecompiledHeader> + </PrecompiledHeader> + <AssemblerOutput>All</AssemblerOutput> + <AssemblerListingLocation>$(IntDir)</AssemblerListingLocation> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <DisableSpecificWarnings>4057;4100;4127;4201;4701;4706;4131;%(DisableSpecificWarnings)</DisableSpecificWarnings> </ClCompile> - <ClCompile Include="..\Common\libzip\zip_source_free.c" /> - <ClCompile Include="..\Common\libzip\zip_source_function.c" /> - <ClCompile Include="..\Common\libzip\zip_source_is_deleted.c" /> - <ClCompile Include="..\Common\libzip\zip_source_layered.c" /> - <ClCompile Include="..\Common\libzip\zip_source_open.c" /> - <ClCompile Include="..\Common\libzip\zip_source_pkware.c" /> - <ClCompile Include="..\Common\libzip\zip_source_read.c" /> - <ClCompile Include="..\Common\libzip\zip_source_remove.c" /> - <ClCompile Include="..\Common\libzip\zip_source_rollback_write.c" /> - <ClCompile Include="..\Common\libzip\zip_source_seek.c" /> - <ClCompile Include="..\Common\libzip\zip_source_seek_write.c" /> - <ClCompile Include="..\Common\libzip\zip_source_stat.c" /> - <ClCompile Include="..\Common\libzip\zip_source_supports.c" /> - <ClCompile Include="..\Common\libzip\zip_source_tell.c" /> - <ClCompile Include="..\Common\libzip\zip_source_tell_write.c" /> - <ClCompile Include="..\Common\libzip\zip_source_win32a.c" /> - <ClCompile Include="..\Common\libzip\zip_source_win32handle.c" /> - <ClCompile Include="..\Common\libzip\zip_source_win32utf8.c" /> - <ClCompile Include="..\Common\libzip\zip_source_win32w.c" /> - <ClCompile Include="..\Common\libzip\zip_source_window.c" /> - <ClCompile Include="..\Common\libzip\zip_source_write.c" /> - <ClCompile Include="..\Common\libzip\zip_source_zip.c" /> - <ClCompile Include="..\Common\libzip\zip_source_zip_new.c" /> - <ClCompile Include="..\Common\libzip\zip_stat.c" /> - <ClCompile Include="..\Common\libzip\zip_stat_index.c" /> - <ClCompile Include="..\Common\libzip\zip_stat_init.c" /> - <ClCompile Include="..\Common\libzip\zip_strerror.c" /> - <ClCompile Include="..\Common\libzip\zip_string.c" /> - <ClCompile Include="..\Common\libzip\zip_unchange.c" /> - <ClCompile Include="..\Common\libzip\zip_unchange_all.c" /> - <ClCompile Include="..\Common\libzip\zip_unchange_archive.c" /> - <ClCompile Include="..\Common\libzip\zip_unchange_data.c" /> - <ClCompile Include="..\Common\libzip\zip_utf-8.c" /> - <ClCompile Include="..\Common\zlib\adler32.c" /> - <ClCompile Include="..\Common\zlib\crc32.c" /> - <ClCompile Include="..\Common\zlib\deflate.c" /> - <ClCompile Include="..\Common\zlib\inffast.c" /> - <ClCompile Include="..\Common\zlib\inflate.c" /> - <ClCompile Include="..\Common\zlib\inftrees.c" /> - <ClCompile Include="..\Common\zlib\trees.c" /> - <ClCompile Include="..\Common\zlib\zutil.c" /> + <Link> + <AdditionalDependencies>..\Crypto\x64\Release\crypto.lib;..\Common\x64\Release\Zip.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)VeraCrypt.exe</OutputFile> + <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries> + <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs> + <GenerateDebugInformation>true</GenerateDebugInformation> + <GenerateMapFile>true</GenerateMapFile> + <SubSystem>Windows</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <RandomizedBaseAddress>true</RandomizedBaseAddress> + <DataExecutionPrevention>true</DataExecutionPrevention> + </Link> + <Manifest> + <AdditionalManifestFiles>Mount.manifest;%(AdditionalManifestFiles)</AdditionalManifestFiles> + </Manifest> + <PostBuildEvent> + <Command>copy $(TargetPath) "..\Release\Setup Files\VeraCrypt-arm64.exe"</Command> + </PostBuildEvent> + <ResourceCompile> + <PreprocessorDefinitions>VC_EFI_CUSTOM_MODE;WIN64;ARM64;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ResourceCompile> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\Common\CommandAPDU.cpp" /> + <ClCompile Include="..\Common\EMVCard.cpp" /> + <ClCompile Include="..\Common\EMVToken.cpp" /> + <ClCompile Include="..\Common\PCSCException.cpp" /> + <ClCompile Include="..\Common\ResponseAPDU.cpp" /> + <ClCompile Include="..\Common\SCard.cpp" /> + <ClCompile Include="..\Common\SCardLoader.cpp" /> + <ClCompile Include="..\Common\SCardManager.cpp" /> + <ClCompile Include="..\Common\SCardReader.cpp" /> + <ClCompile Include="..\Common\TLVParser.cpp" /> + <ClCompile Include="..\Common\Token.cpp" /> + <ClCompile Include="..\Setup\SelfExtract.c" /> <ClCompile Include="Favorites.cpp" /> <ClCompile Include="Hotkeys.c" /> <ClCompile Include="MainCom.cpp" /> <ClCompile Include="Mount.c"> - <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsCpp</CompileAs> <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">CompileAsCpp</CompileAs> - <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsCpp</CompileAs> + <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">CompileAsCpp</CompileAs> <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">CompileAsCpp</CompileAs> + <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">CompileAsCpp</CompileAs> + <CompileAs Condition="'$(Configuration)|$(Platform)'=='ReleaseCustomEFI|x64'">CompileAsCpp</CompileAs> + <CompileAs Condition="'$(Configuration)|$(Platform)'=='ReleaseCustomEFI|ARM64'">CompileAsCpp</CompileAs> </ClCompile> <ClCompile Include="..\Common\BaseCom.cpp" /> <ClCompile Include="..\Common\BootEncryption.cpp" /> <ClCompile Include="..\Common\Cmdline.c" /> <ClCompile Include="..\Common\Combo.c" /> <ClCompile Include="..\Common\Crc.c" /> <ClCompile Include="..\Common\Crypto.c" /> <ClCompile Include="..\Common\Dictionary.c"> - <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsCpp</CompileAs> <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">CompileAsCpp</CompileAs> - <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsCpp</CompileAs> + <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">CompileAsCpp</CompileAs> <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">CompileAsCpp</CompileAs> + <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">CompileAsCpp</CompileAs> + <CompileAs Condition="'$(Configuration)|$(Platform)'=='ReleaseCustomEFI|x64'">CompileAsCpp</CompileAs> + <CompileAs Condition="'$(Configuration)|$(Platform)'=='ReleaseCustomEFI|ARM64'">CompileAsCpp</CompileAs> </ClCompile> <ClCompile Include="..\Common\Dlgcode.c"> - <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsCpp</CompileAs> <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">CompileAsCpp</CompileAs> - <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsCpp</CompileAs> + <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">CompileAsCpp</CompileAs> <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">CompileAsCpp</CompileAs> + <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">CompileAsCpp</CompileAs> + <CompileAs Condition="'$(Configuration)|$(Platform)'=='ReleaseCustomEFI|x64'">CompileAsCpp</CompileAs> + <CompileAs Condition="'$(Configuration)|$(Platform)'=='ReleaseCustomEFI|ARM64'">CompileAsCpp</CompileAs> </ClCompile> <ClCompile Include="..\Common\EncryptionThreadPool.c" /> <ClCompile Include="..\Common\Endian.c" /> <ClCompile Include="..\Common\GfMul.c" /> <ClCompile Include="..\Common\Keyfiles.c"> - <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsCpp</CompileAs> <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">CompileAsCpp</CompileAs> - <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsCpp</CompileAs> + <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">CompileAsCpp</CompileAs> <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">CompileAsCpp</CompileAs> + <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">CompileAsCpp</CompileAs> + <CompileAs Condition="'$(Configuration)|$(Platform)'=='ReleaseCustomEFI|x64'">CompileAsCpp</CompileAs> + <CompileAs Condition="'$(Configuration)|$(Platform)'=='ReleaseCustomEFI|ARM64'">CompileAsCpp</CompileAs> </ClCompile> <ClCompile Include="..\Common\Language.c" /> <ClCompile Include="..\Common\Password.c" /> <ClCompile Include="..\Common\Pkcs5.c" /> @@ -467,15 +490,19 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt-x64.exe" >NUL: <ItemGroup> <Midl Include="MainCom.idl" /> </ItemGroup> <ItemGroup> - <ClInclude Include="..\Common\libzip\compat.h" /> - <ClInclude Include="..\Common\libzip\config.h" /> - <ClInclude Include="..\Common\libzip\zconf.h" /> - <ClInclude Include="..\Common\libzip\zip.h" /> - <ClInclude Include="..\Common\libzip\zipconf.h" /> - <ClInclude Include="..\Common\libzip\zipint.h" /> - <ClInclude Include="..\Common\libzip\zipwin32.h" /> + <ClInclude Include="..\Common\CommandAPDU.h" /> + <ClInclude Include="..\Common\EMVCard.h" /> + <ClInclude Include="..\Common\EMVToken.h" /> + <ClInclude Include="..\Common\PCSCException.h" /> + <ClInclude Include="..\Common\ResponseAPDU.h" /> + <ClInclude Include="..\Common\SCard.h" /> + <ClInclude Include="..\Common\SCardLoader.h" /> + <ClInclude Include="..\Common\SCardManager.h" /> + <ClInclude Include="..\Common\SCardReader.h" /> + <ClInclude Include="..\Common\TLVParser.h" /> + <ClInclude Include="..\Common\Token.h" /> <ClInclude Include="..\Common\Wipe.h" /> <ClInclude Include="..\Common\Apidrvr.h" /> <ClInclude Include="..\Common\BaseCom.h" /> <ClInclude Include="..\Common\BootEncryption.h" /> @@ -487,20 +514,8 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt-x64.exe" >NUL: <ClInclude Include="..\Common\Dictionary.h" /> <ClInclude Include="..\Common\Dlgcode.h" /> <ClInclude Include="..\Common\EncryptionThreadPool.h" /> <ClInclude Include="..\Common\Exception.h" /> - <ClInclude Include="..\Common\XUnzip.h" /> - <ClInclude Include="..\Common\XZip.h" /> - <ClInclude Include="..\Common\zlib\crc32.h" /> - <ClInclude Include="..\Common\zlib\deflate.h" /> - <ClInclude Include="..\Common\zlib\inffast.h" /> - <ClInclude Include="..\Common\zlib\inffixed.h" /> - <ClInclude Include="..\Common\zlib\inflate.h" /> - <ClInclude Include="..\Common\zlib\inftrees.h" /> - <ClInclude Include="..\Common\zlib\trees.h" /> - <ClInclude Include="..\Common\zlib\zconf.h" /> - <ClInclude Include="..\Common\zlib\zlib.h" /> - <ClInclude Include="..\Common\zlib\zutil.h" /> <ClInclude Include="Favorites.h" /> <ClInclude Include="..\Common\GfMul.h" /> <ClInclude Include="Hotkeys.h" /> <ClInclude Include="..\Common\Keyfiles.h" /> @@ -571,30 +586,28 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt-x64.exe" >NUL: </ItemGroup> <ItemGroup> <ResourceCompile Include="Mount.rc" /> <ResourceCompile Include="..\Common\Common.rc"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ReleaseCustomEFI|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ReleaseCustomEFI|ARM64'">true</ExcludedFromBuild> </ResourceCompile> </ItemGroup> <ItemGroup> - <ProjectReference Include="..\Boot\Windows\Boot.vcxproj"> - <Project>{8b7f059f-e4c7-4e11-88f5-ee8b8433072e}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + <ProjectReference Include="..\Common\Lzma.vcxproj"> + <Project>{b896fe1f-6bf3-4f75-9148-f841829073d9}</Project> + </ProjectReference> + <ProjectReference Include="..\Common\Zip.vcxproj"> + <Project>{6316ee71-0210-4ca4-bcc7-cfb7a3c090fc}</Project> </ProjectReference> <ProjectReference Include="..\Crypto\Crypto.vcxproj"> <Project>{993245cf-6b70-47ee-91bb-39f8fc6dc0e7}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> - <ProjectReference Include="..\Driver\Driver.vcxproj"> - <Project>{ef5ef444-18d0-40d7-8dfa-775ec4448602}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> </ProjectReference> <ProjectReference Include="..\Format\Format.vcxproj"> <Project>{9dc1abe2-d18b-48fb-81d2-8c50adc57bcf}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> </ProjectReference> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> diff --git a/src/Mount/Mount.vcxproj.filters b/src/Mount/Mount.vcxproj.filters index 811b3865..d5014051 100644 --- a/src/Mount/Mount.vcxproj.filters +++ b/src/Mount/Mount.vcxproj.filters @@ -18,13 +18,10 @@ </Filter> <Filter Include="Resource Files\Common"> <UniqueIdentifier>{f805ede6-c210-4210-95ce-e33edb12bc27}</UniqueIdentifier> </Filter> - <Filter Include="Source Files\Common\libzip"> - <UniqueIdentifier>{318128e2-1443-4dce-83e6-f3e1c92d6787}</UniqueIdentifier> - </Filter> - <Filter Include="Source Files\Common\zlib"> - <UniqueIdentifier>{21a4f879-0684-4016-ad89-f27c8ab96cf8}</UniqueIdentifier> + <Filter Include="Source Files\Setup"> + <UniqueIdentifier>{3bd21420-974d-4264-8daa-807c240fbed7}</UniqueIdentifier> </Filter> </ItemGroup> <ItemGroup> <ClCompile Include="Favorites.cpp"> @@ -107,343 +104,43 @@ </ClCompile> <ClCompile Include="..\Common\Xts.c"> <Filter>Source Files\Common</Filter> </ClCompile> - <ClCompile Include="..\Common\libzip\mkstemp.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_add.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_add_entry.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_buffer.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_close.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_discard.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_entry.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_error.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_error_clear.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_error_get.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_extra_field.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_fclose.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_fdopen.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_file_add.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_file_replace.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_fopen.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_fopen_index.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_fread.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_io_util.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_name_locate.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_new.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_open.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_source_begin_write.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_source_buffer.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_source_close.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_source_commit_write.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_source_crc.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_source_deflate.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_source_error.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_source_filep.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_source_free.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_source_function.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_source_is_deleted.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_source_layered.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_source_open.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_source_pkware.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_source_read.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_source_remove.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_source_rollback_write.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_source_seek.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_source_seek_write.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_source_stat.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_source_supports.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_source_tell.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_source_tell_write.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_source_win32a.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_source_win32handle.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_source_win32utf8.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_source_win32w.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_source_window.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_source_write.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_source_zip.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_source_zip_new.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_stat.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_stat_index.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_stat_init.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_strerror.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_string.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_utf-8.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\zlib\adler32.c"> - <Filter>Source Files\Common\zlib</Filter> - </ClCompile> - <ClCompile Include="..\Common\zlib\crc32.c"> - <Filter>Source Files\Common\zlib</Filter> - </ClCompile> - <ClCompile Include="..\Common\zlib\deflate.c"> - <Filter>Source Files\Common\zlib</Filter> - </ClCompile> - <ClCompile Include="..\Common\zlib\inflate.c"> - <Filter>Source Files\Common\zlib</Filter> - </ClCompile> - <ClCompile Include="..\Common\zlib\trees.c"> - <Filter>Source Files\Common\zlib</Filter> - </ClCompile> - <ClCompile Include="..\Common\zlib\zutil.c"> - <Filter>Source Files\Common\zlib</Filter> + <ClCompile Include="..\Setup\SelfExtract.c"> + <Filter>Source Files\Setup</Filter> </ClCompile> - <ClCompile Include="..\Common\zlib\inftrees.c"> - <Filter>Source Files\Common\zlib</Filter> - </ClCompile> - <ClCompile Include="..\Common\zlib\inffast.c"> - <Filter>Source Files\Common\zlib</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_add_dir.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_delete.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_dir_add.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_dirent.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_err_str.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_error_get_sys_type.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_error_strerror.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_error_to_str.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_extra_field_api.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_file_error_clear.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_file_error_get.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_file_get_comment.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_file_get_external_attributes.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_file_get_offset.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_file_rename.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_file_set_comment.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_file_set_external_attributes.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_file_set_mtime.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_file_strerror.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_filerange_crc.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_fopen_encrypted.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_fopen_index_encrypted.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_get_archive_comment.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_get_archive_flag.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_get_compression_implementation.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_get_encryption_implementation.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_get_file_comment.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_get_name.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_get_num_entries.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_get_num_files.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_hash.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_memdup.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_rename.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_replace.c"> - <Filter>Source Files\Common\libzip</Filter> - </ClCompile> - <ClCompile Include="..\Common\libzip\zip_set_archive_comment.c"> - <Filter>Source Files\Common\libzip</Filter> + <ClCompile Include="..\Common\EMVToken.cpp"> + <Filter>Source Files\Common</Filter> </ClCompile> - <ClCompile Include="..\Common\libzip\zip_set_archive_flag.c"> - <Filter>Source Files\Common\libzip</Filter> + <ClCompile Include="..\Common\Token.cpp"> + <Filter>Source Files\Common</Filter> </ClCompile> - <ClCompile Include="..\Common\libzip\zip_set_default_password.c"> - <Filter>Source Files\Common\libzip</Filter> + <ClCompile Include="..\Common\TLVParser.cpp"> + <Filter>Source Files\Common</Filter> </ClCompile> - <ClCompile Include="..\Common\libzip\zip_set_file_comment.c"> - <Filter>Source Files\Common\libzip</Filter> + <ClCompile Include="..\Common\CommandAPDU.cpp"> + <Filter>Source Files\Common</Filter> </ClCompile> - <ClCompile Include="..\Common\libzip\zip_set_file_compression.c"> - <Filter>Source Files\Common\libzip</Filter> + <ClCompile Include="..\Common\PCSCException.cpp"> + <Filter>Source Files\Common</Filter> </ClCompile> - <ClCompile Include="..\Common\libzip\zip_set_name.c"> - <Filter>Source Files\Common\libzip</Filter> + <ClCompile Include="..\Common\ResponseAPDU.cpp"> + <Filter>Source Files\Common</Filter> </ClCompile> - <ClCompile Include="..\Common\libzip\zip_source_call.c"> - <Filter>Source Files\Common\libzip</Filter> + <ClCompile Include="..\Common\SCardLoader.cpp"> + <Filter>Source Files\Common</Filter> </ClCompile> - <ClCompile Include="..\Common\libzip\zip_unchange.c"> - <Filter>Source Files\Common\libzip</Filter> + <ClCompile Include="..\Common\SCardManager.cpp"> + <Filter>Source Files\Common</Filter> </ClCompile> - <ClCompile Include="..\Common\libzip\zip_unchange_all.c"> - <Filter>Source Files\Common\libzip</Filter> + <ClCompile Include="..\Common\SCardReader.cpp"> + <Filter>Source Files\Common</Filter> </ClCompile> - <ClCompile Include="..\Common\libzip\zip_unchange_archive.c"> - <Filter>Source Files\Common\libzip</Filter> + <ClCompile Include="..\Common\EMVCard.cpp"> + <Filter>Source Files\Common</Filter> </ClCompile> - <ClCompile Include="..\Common\libzip\zip_unchange_data.c"> - <Filter>Source Files\Common\libzip</Filter> + <ClCompile Include="..\Common\SCard.cpp"> + <Filter>Source Files\Common</Filter> </ClCompile> </ItemGroup> <ItemGroup> <Midl Include="MainCom.idl"> @@ -546,64 +243,40 @@ </ClInclude> <ClInclude Include="..\Common\Xts.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\Common\XZip.h"> + <ClInclude Include="..\Common\EMVToken.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\Common\XUnzip.h"> + <ClInclude Include="..\Common\Token.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\Common\libzip\compat.h"> - <Filter>Source Files\Common\libzip</Filter> - </ClInclude> - <ClInclude Include="..\Common\libzip\config.h"> - <Filter>Source Files\Common\libzip</Filter> - </ClInclude> - <ClInclude Include="..\Common\libzip\zconf.h"> - <Filter>Source Files\Common\libzip</Filter> - </ClInclude> - <ClInclude Include="..\Common\libzip\zip.h"> - <Filter>Source Files\Common\libzip</Filter> - </ClInclude> - <ClInclude Include="..\Common\libzip\zipint.h"> - <Filter>Source Files\Common\libzip</Filter> - </ClInclude> - <ClInclude Include="..\Common\libzip\zipwin32.h"> - <Filter>Source Files\Common\libzip</Filter> - </ClInclude> - <ClInclude Include="..\Common\zlib\crc32.h"> - <Filter>Source Files\Common\zlib</Filter> - </ClInclude> - <ClInclude Include="..\Common\zlib\deflate.h"> - <Filter>Source Files\Common\zlib</Filter> - </ClInclude> - <ClInclude Include="..\Common\zlib\inffast.h"> - <Filter>Source Files\Common\zlib</Filter> + <ClInclude Include="..\Common\TLVParser.h"> + <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\Common\zlib\inffixed.h"> - <Filter>Source Files\Common\zlib</Filter> + <ClInclude Include="..\Common\CommandAPDU.h"> + <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\Common\zlib\inflate.h"> - <Filter>Source Files\Common\zlib</Filter> + <ClInclude Include="..\Common\PCSCException.h"> + <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\Common\zlib\inftrees.h"> - <Filter>Source Files\Common\zlib</Filter> + <ClInclude Include="..\Common\ResponseAPDU.h"> + <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\Common\zlib\trees.h"> - <Filter>Source Files\Common\zlib</Filter> + <ClInclude Include="..\Common\SCardLoader.h"> + <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\Common\zlib\zconf.h"> - <Filter>Source Files\Common\zlib</Filter> + <ClInclude Include="..\Common\SCardManager.h"> + <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\Common\zlib\zlib.h"> - <Filter>Source Files\Common\zlib</Filter> + <ClInclude Include="..\Common\SCardReader.h"> + <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\Common\zlib\zutil.h"> - <Filter>Source Files\Common\zlib</Filter> + <ClInclude Include="..\Common\EMVCard.h"> + <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\Common\libzip\zipconf.h"> - <Filter>Source Files\Common\libzip</Filter> + <ClInclude Include="..\Common\SCard.h"> + <Filter>Header Files</Filter> </ClInclude> </ItemGroup> <ItemGroup> <None Include="..\Boot\Windows\Rescue_Serpent_SHA2\BootSector.bin"> diff --git a/src/Mount/Mount.vcxproj.user b/src/Mount/Mount.vcxproj.user index ace9a86a..88a55094 100644 --- a/src/Mount/Mount.vcxproj.user +++ b/src/Mount/Mount.vcxproj.user @@ -1,3 +1,4 @@ <?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> +<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup /> </Project>
\ No newline at end of file diff --git a/src/Mount/Resource.h b/src/Mount/Resource.h index 0c863386..fef9da49 100644 --- a/src/Mount/Resource.h +++ b/src/Mount/Resource.h @@ -159,9 +159,8 @@ #define IDC_FAV_VOL_OPTIONS_GLOBAL_SETTINGS_BOX 1136 #define IDC_PREF_DISMOUNT_SESSION_LOCKED 1137 #define IDT_NEW_PKCS5_PRF 1138 #define IDC_PKCS5_OLD_PRF_ID 1139 -#define IDC_TRUECRYPT_MODE 1140 #define IDC_PREF_TEMP_CACHE_ON_MULTIPLE_MOUNT 1141 #define IDT_OLD_PIM 1142 #define IDC_OLD_PIM 1143 #define IDC_OLD_PIM_HELP 1144 @@ -183,8 +182,25 @@ #define IDC_DISABLE_BOOT_LOADER_PIM_PROMPT 1160 #define IDC_HIDE_WAITING_DIALOG 1161 #define IDC_DISABLE_BOOT_LOADER_HASH_PROMPT 1162 #define IDC_SECURE_DESKTOP_PASSWORD_ENTRY 1163 +#define IDC_SHOW_PLATFORMINFO 1164 +#define IDC_EDIT_DCSPROP 1165 +#define IDT_ADVANCED_OPTIONS 1166 +#define IDC_ALLOW_TRIM_NONSYS_SSD 1167 +#define IDC_BLOCK_SYSENC_TRIM 1168 +#define IDC_ALLOW_WINDOWS_DEFRAG 1169 +#define IDC_LOWER_BOX 1170 +#define IDC_CLEAR_KEYS_ON_NEW_DEVICE_INSERTION 1171 +#define IDC_ENABLE_CPU_RNG 1172 +#define IDC_ENABLE_RAM_ENCRYPTION 1173 +#define IDC_USE_LEGACY_MAX_PASSWORD_LENGTH 1174 +#define IDC_UPDATE_BOOTLOADER_ON_SHUTDOWN 1175 +#define IDC_FORCE_NEXT_BOOT_VERACRYPT 1176 +#define IDC_FORCE_VERACRYPT_BOOT_ENTRY 1177 +#define IDC_FORCE_VERACRYPT_FIRST_BOOT_ENTRY 1178 +#define IDC_ENABLE_EMV_SUPPORT 1179 +#define IDT_EMV_OPTIONS 1180 #define IDM_HELP 40001 #define IDM_ABOUT 40002 #define IDM_UNMOUNT_VOLUME 40003 #define IDM_CLEAR_HISTORY 40004 @@ -251,16 +267,17 @@ #define IDM_VOLUME_EXPANDER 40065 #define IDM_DEFAULT_MOUNT_PARAMETERS 40066 #define IDM_DECRYPT_NONSYS_VOL 40067 #define IDM_VERIFY_RESCUE_DISK_ISO 40068 +#define IDM_MOUNIT_NO_CACHE 40069 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NO_MFC 1 #define _APS_NEXT_RESOURCE_VALUE 120 -#define _APS_NEXT_COMMAND_VALUE 40069 -#define _APS_NEXT_CONTROL_VALUE 1164 +#define _APS_NEXT_COMMAND_VALUE 40070 +#define _APS_NEXT_CONTROL_VALUE 1181 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif |