diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Common/Common.h | 1 | ||||
-rw-r--r-- | src/Common/Dlgcode.c | 2 | ||||
-rw-r--r-- | src/Common/Language.xml | 1 | ||||
-rw-r--r-- | src/ExpandVolume/WinMain.cpp | 1 | ||||
-rw-r--r-- | src/Mount/Mount.c | 76 | ||||
-rw-r--r-- | src/Mount/Mount.h | 2 | ||||
-rw-r--r-- | src/Mount/Resource.h | 3 |
7 files changed, 78 insertions, 8 deletions
diff --git a/src/Common/Common.h b/src/Common/Common.h index 02b2929a..62ee3d65 100644 --- a/src/Common/Common.h +++ b/src/Common/Common.h @@ -92,7 +92,8 @@ typedef struct int ProtectedHidVolPkcs5Prf; int ProtectedHidVolPim; wchar_t Label[33]; /* maximum label length is 32 for NTFS and 11 for FAT32 */ BOOL DisableMountManager; + BOOL SkipCachedPasswords; } MountOptions; #endif diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c index 2c707f5d..d994aaf3 100644 --- a/src/Common/Dlgcode.c +++ b/src/Common/Dlgcode.c @@ -8886,9 +8886,9 @@ int MountVolume (HWND hwndDlg, return -1; } // If using cached passwords, check cache status first - if (password == NULL && IsPasswordCacheEmpty ()) + if (password == NULL && (mountOptions->SkipCachedPasswords || IsPasswordCacheEmpty ())) return 0; ZeroMemory (&mount, sizeof (mount)); mount.bExclusiveAccess = sharedAccess ? FALSE : TRUE; diff --git a/src/Common/Language.xml b/src/Common/Language.xml index a2615124..a2555147 100644 --- a/src/Common/Language.xml +++ b/src/Common/Language.xml @@ -1569,8 +1569,9 @@ <entry lang="en" key="CANT_INSTALL_WITH_EXE_OVER_MSI">VeraCrypt was previously installed using an MSI package and so it can't be updated using the standard installer.\n\nPlease use the MSI package to update your VeraCrypt installation.</entry> <entry lang="en" key="IDC_USE_ALL_FREE_SPACE">Use all available free space</entry> <entry lang="en" key="SYS_ENCRYPTION_UPGRADE_UNSUPPORTED_ALGORITHM">VeraCrypt cannot be upgraded because the system partition/drive was encrypted using an algorithm that is not supported anymore.\nPlease decrypt your system before upgrading VeraCrypt and then encrypt it again.</entry> <entry lang="en" key="LINUX_EX2MSG_TERMINALNOTFOUND">Supported terminal application could not be found, you need either xterm, konsole or gnome-terminal (with dbus-x11).</entry> + <entry lang="en" key="IDM_MOUNT_NO_CACHE">Mount Without Cache</entry> </localization> <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="VeraCrypt"> <xs:complexType> diff --git a/src/ExpandVolume/WinMain.cpp b/src/ExpandVolume/WinMain.cpp index 49422319..f1e7bfad 100644 --- a/src/ExpandVolume/WinMain.cpp +++ b/src/ExpandVolume/WinMain.cpp @@ -291,8 +291,9 @@ void LoadSettings (HWND hwndDlg) defaultMountOptions.ProtectHiddenVolume = FALSE; defaultMountOptions.PartitionInInactiveSysEncScope = FALSE; defaultMountOptions.RecoveryMode = FALSE; defaultMountOptions.UseBackupHeader = FALSE; + defaultMountOptions.SkipCachedPasswords = FALSE; mountOptions = defaultMountOptions; CloseSecurityTokenSessionsAfterMount = ConfigReadInt ("CloseSecurityTokenSessionsAfterMount", 0); diff --git a/src/Mount/Mount.c b/src/Mount/Mount.c index a5798afc..5a7e40fe 100644 --- a/src/Mount/Mount.c +++ b/src/Mount/Mount.c @@ -947,8 +947,9 @@ void LoadSettingsAndCheckModified (HWND hwndDlg, BOOL bOnlyCheckModified, BOOL* defaultMountOptions.ProtectedHidVolPim = 0; defaultMountOptions.PartitionInInactiveSysEncScope = FALSE; defaultMountOptions.RecoveryMode = FALSE; defaultMountOptions.UseBackupHeader = FALSE; + defaultMountOptions.SkipCachedPasswords = FALSE; mountOptions = defaultMountOptions; } @@ -5391,8 +5392,10 @@ ret: burn (&mountOptions.ProtectedHidVolPassword, sizeof (mountOptions.ProtectedHidVolPassword)); burn (&mountOptions.ProtectedHidVolPkcs5Prf, sizeof (mountOptions.ProtectedHidVolPkcs5Prf)); + mountOptions.SkipCachedPasswords = FALSE; + RestoreDefaultKeyFilesParam (); if (UsePreferences) bCacheInDriver = bCacheInDriverDefault; @@ -5673,8 +5676,9 @@ static BOOL MountAllDevicesThreadCode (HWND hwndDlg, BOOL bPasswordPrompt) EffectiveVolumeTrueCryptMode = DefaultVolumeTrueCryptMode; VolumePassword.Length = 0; mountOptions = defaultMountOptions; + mountOptions.SkipCachedPasswords = FALSE; bPrebootPasswordDlgMode = FALSE; VolumePim = -1; if (selDrive == -1) @@ -6963,14 +6967,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: @@ -7020,8 +7024,9 @@ void DisplayDriveListContextMenu (HWND hwndDlg, LPARAM lParam) } else { mountOptions = defaultMountOptions; + mountOptions.SkipCachedPasswords = FALSE; bPrebootPasswordDlgMode = FALSE; if (CheckMountList (hwndDlg, FALSE)) _beginthread(mountThreadFunction, 0, hwndDlg); @@ -7079,8 +7084,51 @@ static void SignalExitCode (int exitCode) } } } +#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 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); + } +} + /* 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) { @@ -7179,8 +7227,9 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa if (CmdMountOptionsValid) mountOptions = CmdMountOptions; InitMainDialog (hwndDlg); + EnableSplitButton(hwndDlg, IDOK); try { if (IsHiddenOSRunning()) @@ -8129,8 +8178,9 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa } else if (LOWORD (GetSelectedLong (GetDlgItem (hwndDlg, IDC_DRIVELIST))) == TC_MLIST_ITEM_FREE) { mountOptions = defaultMountOptions; + mountOptions.SkipCachedPasswords = FALSE; bPrebootPasswordDlgMode = FALSE; if (GetAsyncKeyState (VK_CONTROL) < 0) { @@ -8178,8 +8228,20 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa return 1; } } } + 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); + } + } return 0; case WM_ERASEBKGND: return 0; @@ -8224,11 +8286,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) @@ -8299,8 +8361,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); @@ -9146,8 +9209,9 @@ void ExtractCommandLine (HWND hwndDlg, wchar_t *lpszCommandLine) 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; @@ -10422,8 +10486,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); @@ -12396,17 +12461,18 @@ static BOOL CALLBACK BootLoaderPreferencesDlgProc (HWND hwndDlg, UINT msg, WPARA 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) { diff --git a/src/Mount/Mount.h b/src/Mount/Mount.h index bbe05c38..90e1d417 100644 --- a/src/Mount/Mount.h +++ b/src/Mount/Mount.h @@ -107,9 +107,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); diff --git a/src/Mount/Resource.h b/src/Mount/Resource.h index dc73d180..f7b3ff05 100644 --- a/src/Mount/Resource.h +++ b/src/Mount/Resource.h @@ -266,16 +266,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_COMMAND_VALUE 40070 #define _APS_NEXT_CONTROL_VALUE 1179 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif |