diff options
author | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2015-03-04 00:25:39 +0100 |
---|---|---|
committer | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2015-03-04 00:27:04 +0100 |
commit | f80f7d47d587710f657ab6f6c20140ddb503250e (patch) | |
tree | 4695c29b2bbcd59c372bfffd3c424b7772ca5f51 /src/Mount | |
parent | 8e6707cc22846e48c62e4730980cfe17595f8c2c (diff) | |
download | VeraCrypt-f80f7d47d587710f657ab6f6c20140ddb503250e.tar.gz VeraCrypt-f80f7d47d587710f657ab6f6c20140ddb503250e.zip |
Windows: Avoid temporary caching password when mounting multiple favorites. Add option to activate this if needed.
Diffstat (limited to 'src/Mount')
-rw-r--r-- | src/Mount/Mount.c | 31 | ||||
-rw-r--r-- | src/Mount/Mount.rc | 16 | ||||
-rw-r--r-- | src/Mount/Resource.h | 3 |
3 files changed, 33 insertions, 17 deletions
diff --git a/src/Mount/Mount.c b/src/Mount/Mount.c index 0a104709..61bc5adb 100644 --- a/src/Mount/Mount.c +++ b/src/Mount/Mount.c @@ -82,6 +82,7 @@ char szDriveLetter[3]; /* Drive Letter to mount */ char commandLineDrive = 0;
BOOL bCacheInDriver = FALSE; /* Cache any passwords we see */
BOOL bCacheInDriverDefault = FALSE;
+BOOL bCacheDuringMultipleMount = FALSE;
BOOL bHistoryCmdLine = FALSE; /* History control is always disabled */
BOOL bUseDifferentTrayIconIfVolMounted = TRUE;
BOOL bCloseDismountedWindows=TRUE; /* Close all open explorer windows of dismounted volume */
@@ -478,6 +479,7 @@ void LoadSettings (HWND hwndDlg) bHistory = ConfigReadInt ("SaveVolumeHistory", FALSE);
bCacheInDriverDefault = bCacheInDriver = ConfigReadInt ("CachePasswords", FALSE);
+ bCacheDuringMultipleMount = ConfigReadInt ("CachePasswordDuringMultipleMount", FALSE);
bWipeCacheOnExit = ConfigReadInt ("WipePasswordCacheOnExit", FALSE);
bWipeCacheOnAutoDismount = ConfigReadInt ("WipeCacheOnAutoDismount", TRUE);
@@ -579,6 +581,7 @@ void SaveSettings (HWND hwndDlg) ConfigWriteInt ("SaveVolumeHistory", !IsButtonChecked (GetDlgItem (hwndDlg, IDC_NO_HISTORY)));
ConfigWriteInt ("CachePasswords", bCacheInDriverDefault);
+ ConfigWriteInt ("CachePasswordDuringMultipleMount", bCacheDuringMultipleMount);
ConfigWriteInt ("WipePasswordCacheOnExit", bWipeCacheOnExit);
ConfigWriteInt ("WipeCacheOnAutoDismount", bWipeCacheOnAutoDismount);
@@ -2537,6 +2540,9 @@ BOOL CALLBACK PreferencesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM SendMessage (GetDlgItem (hwndDlg, IDC_PRESERVE_TIMESTAMPS), BM_SETCHECK,
defaultMountOptions.PreserveTimestamp ? 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,
bWipeCacheOnExit ? BST_CHECKED:BST_UNCHECKED, 0);
@@ -2645,6 +2651,7 @@ BOOL CALLBACK PreferencesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM bExplore = IsButtonChecked (GetDlgItem (hwndDlg, IDC_PREF_OPEN_EXPLORER));
bUseDifferentTrayIconIfVolMounted = IsButtonChecked (GetDlgItem (hwndDlg, IDC_PREF_USE_DIFF_TRAY_ICON_IF_VOL_MOUNTED));
bPreserveTimestamp = defaultMountOptions.PreserveTimestamp = IsButtonChecked (GetDlgItem (hwndDlg, IDC_PRESERVE_TIMESTAMPS));
+ 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));
@@ -3777,7 +3784,10 @@ static BOOL Mount (HWND hwndDlg, int nDosDriveNo, char *szFileName) // First try cached passwords and if they fail ask user for a new one
WaitCursor ();
- mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, NULL, EffectiveVolumePkcs5, EffectiveVolumeTrueCryptMode, bCacheInDriver, bForceMount, &mountOptions, Silent, FALSE);
+ // try TrueCrypt mode first since it is quick
+ mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, NULL, 0, TRUE, bCacheInDriver, bForceMount, &mountOptions, Silent, FALSE);
+ if (!mounted)
+ mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, NULL, 0, FALSE, bCacheInDriver, bForceMount, &mountOptions, Silent, FALSE);
// If keyfiles are enabled, test empty password first
if (!mounted && KeyFilesEnable && FirstKeyFile)
@@ -3786,19 +3796,22 @@ static BOOL Mount (HWND hwndDlg, int nDosDriveNo, char *szFileName) emptyPassword.Length = 0;
KeyFilesApply (hwndDlg, &emptyPassword, FirstKeyFile);
- mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, &emptyPassword, EffectiveVolumePkcs5, EffectiveVolumeTrueCryptMode, bCacheInDriver, bForceMount, &mountOptions, Silent, FALSE);
- if (mounted)
- {
- VolumePkcs5 = EffectiveVolumePkcs5;
- VolumeTrueCryptMode = EffectiveVolumeTrueCryptMode;
- }
+ // try TrueCrypt mode first since it is quick
+ mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, &emptyPassword, 0, TRUE, bCacheInDriver, bForceMount, &mountOptions, Silent, FALSE);
+ if (!mounted)
+ mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, &emptyPassword, 0, FALSE, bCacheInDriver, bForceMount, &mountOptions, Silent, FALSE);
burn (&emptyPassword, sizeof (emptyPassword));
}
// Test password and/or keyfiles used for the previous volume
- if (!mounted && MultipleMountOperationInProgress && VolumePassword.Length != 0)
- mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, &VolumePassword, VolumePkcs5, VolumeTrueCryptMode, bCacheInDriver, bForceMount, &mountOptions, Silent, FALSE);
+ if (!mounted && bCacheDuringMultipleMount && MultipleMountOperationInProgress && VolumePassword.Length != 0)
+ {
+ // try TrueCrypt mode first as it is quick
+ mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, &VolumePassword, 0, TRUE, bCacheInDriver, bForceMount, &mountOptions, Silent, FALSE);
+ if (!mounted)
+ mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, &VolumePassword, 0, FALSE, bCacheInDriver, bForceMount, &mountOptions, Silent, FALSE);
+ }
NormalCursor ();
diff --git a/src/Mount/Mount.rc b/src/Mount/Mount.rc index 4783aea3..6b81a4ac 100644 --- a/src/Mount/Mount.rc +++ b/src/Mount/Mount.rc @@ -41,7 +41,7 @@ IDR_MOUNT_TLB TYPELIB "Mount.tlb" // Dialog
//
-IDD_PREFERENCES_DLG DIALOGEX 0, 0, 336, 282
+IDD_PREFERENCES_DLG DIALOGEX 0, 0, 336, 291
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
@@ -78,20 +78,22 @@ BEGIN CONTROL "Wipe cached passwords on exit",IDC_PREF_WIPE_CACHE_ON_EXIT,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,162,227,165,11
CONTROL "Wipe cached passwords on auto-dismount",IDC_PREF_WIPE_CACHE_ON_AUTODISMOUNT,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,239,296,11
- PUSHBUTTON "More Settings...",IDC_MORE_SETTINGS,5,262,85,14
- DEFPUSHBUTTON "OK",IDOK,225,262,50,14
- PUSHBUTTON "Cancel",IDCANCEL,281,262,50,14
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,254,296,11
+ PUSHBUTTON "More Settings...",IDC_MORE_SETTINGS,5,275,85,14
+ DEFPUSHBUTTON "OK",IDOK,225,275,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,281,275,50,14
GROUPBOX "Windows",IDT_WINDOWS_RELATED_SETTING,4,160,328,52
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,110,71,17
- GROUPBOX "Password Cache",IDT_PW_CACHE_OPTIONS,4,216,328,39
+ GROUPBOX "Password Cache",IDT_PW_CACHE_OPTIONS,4,216,328,54
GROUPBOX "Actions to perform upon logon to Windows",IDT_LOGON,4,63,328,28
CONTROL "User session locked",IDC_PREF_DISMOUNT_SESSION_LOCKED,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,197,105,130,11
+ CONTROL "Temporary Cache password during ""Mount Favorite Volumes"" operations",IDC_PREF_TEMP_CACHE_ON_MULTIPLE_MOUNT,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,241,294,11
END
IDD_VOLUME_PROPERTIES DIALOGEX 60, 30, 284, 224
@@ -357,7 +359,7 @@ BEGIN LEFTMARGIN, 7
RIGHTMARGIN, 329
TOPMARGIN, 7
- BOTTOMMARGIN, 280
+ BOTTOMMARGIN, 289
END
IDD_VOLUME_PROPERTIES, DIALOG
diff --git a/src/Mount/Resource.h b/src/Mount/Resource.h index c2c23d9f..1c50c52c 100644 --- a/src/Mount/Resource.h +++ b/src/Mount/Resource.h @@ -162,6 +162,7 @@ #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 IDM_HELP 40001
#define IDM_ABOUT 40002
#define IDM_UNMOUNT_VOLUME 40003
@@ -237,7 +238,7 @@ #define _APS_NO_MFC 1
#define _APS_NEXT_RESOURCE_VALUE 119
#define _APS_NEXT_COMMAND_VALUE 40068
-#define _APS_NEXT_CONTROL_VALUE 1141
+#define _APS_NEXT_CONTROL_VALUE 1142
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
|