VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Mount
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2016-04-28 10:36:04 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2016-04-28 23:06:11 +0200
commit99de8a6dcdc81bbeb70296704b8c82029e363de2 (patch)
tree148c112fd96c0ed4ac77da1adae8898100f15b7e /src/Mount
parent91e3843732b2e6e0643066fd11a45100d2b454af (diff)
downloadVeraCrypt-99de8a6dcdc81bbeb70296704b8c82029e363de2.tar.gz
VeraCrypt-99de8a6dcdc81bbeb70296704b8c82029e363de2.zip
Windows: Only use A: and B: for mounting when no other free drive letter available or when explicitly chosen by user. This avoid side effects when mounting volumes as removable media and automatic drive selection (e.g. A: become invisible in explorer after closing all explorer instances although it is still mounted).
Diffstat (limited to 'src/Mount')
-rw-r--r--src/Mount/Mount.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/src/Mount/Mount.c b/src/Mount/Mount.c
index 9619a9f6..1851af06 100644
--- a/src/Mount/Mount.c
+++ b/src/Mount/Mount.c
@@ -5075,6 +5075,7 @@ static BOOL MountAllDevicesThreadCode (HWND hwndDlg, BOOL bPasswordPrompt)
if (!mounted)
{
int nDosDriveNo;
+ int driveAItem = -1, driveBItem = -1;
while (LOWORD (GetItemLong (driveList, selDrive)) != 0xffff)
{
@@ -5084,11 +5085,39 @@ static BOOL MountAllDevicesThreadCode (HWND hwndDlg, BOOL bPasswordPrompt)
continue;
}
nDosDriveNo = HIWORD(GetItemLong (driveList, selDrive)) - L'A';
+
+ /* don't use drives A: and B: for now until no other free drive found */
+ if (nDosDriveNo == 0)
+ {
+ driveAItem = selDrive;
+ selDrive++;
+ continue;
+ }
+ if (nDosDriveNo == 1)
+ {
+ driveBItem = selDrive;
+ selDrive++;
+ continue;
+ }
break;
}
if (LOWORD (GetItemLong (driveList, selDrive)) == 0xffff)
- goto ret;
+ {
+ /* use A: or B: if available as a last resort */
+ if (driveAItem >= 0)
+ {
+ nDosDriveNo = 0;
+ selDrive = driveAItem;
+ }
+ else if (driveBItem >= 0)
+ {
+ nDosDriveNo = 1;
+ selDrive = driveBItem;
+ }
+ else
+ 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