VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common/Dlgcode.c
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/Common/Dlgcode.c
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/Common/Dlgcode.c')
-rw-r--r--src/Common/Dlgcode.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c
index 77210029..6958afe9 100644
--- a/src/Common/Dlgcode.c
+++ b/src/Common/Dlgcode.c
@@ -6760,11 +6760,13 @@ DWORD GetUsedLogicalDrives (void)
int GetFirstAvailableDrive ()
{
DWORD dwUsedDrives = GetUsedLogicalDrives();
- int i;
+ int i, drive;
- for (i = 0; i < 26; i++)
+ /* let A: and B: be used as last resort since they can introduce side effects */
+ for (i = 2; i < 28; i++)
{
- if (!(dwUsedDrives & 1 << i))
+ drive = (i < 26) ? i : (i - 26);
+ if (!(dwUsedDrives & 1 << drive))
return i;
}