VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Boot/Windows/BootCommon.h2
-rw-r--r--src/Boot/Windows/BootConfig.cpp10
-rw-r--r--src/Boot/Windows/BootConfig.h2
-rw-r--r--src/Boot/Windows/BootDefs.h13
-rw-r--r--src/Boot/Windows/BootEncryptedIo.cpp4
-rw-r--r--src/Boot/Windows/BootMain.cpp120
-rw-r--r--src/Common/Apidrvr.h5
-rw-r--r--src/Common/BootEncryption.cpp44
-rw-r--r--src/Common/BootEncryption.h4
-rw-r--r--src/Common/Common.h2
-rw-r--r--src/Common/Common.rc34
-rw-r--r--src/Common/Dlgcode.c337
-rw-r--r--src/Common/Dlgcode.h13
-rw-r--r--src/Common/Language.xml8
-rw-r--r--src/Common/Volumes.c7
-rw-r--r--src/Driver/DriveFilter.c5
-rw-r--r--src/Driver/Ntdriver.c111
-rw-r--r--src/Driver/Ntdriver.h2
-rw-r--r--src/Driver/Ntvol.c3
-rw-r--r--src/Format/Format.rc80
-rw-r--r--src/Mount/Favorites.cpp83
-rw-r--r--src/Mount/Favorites.h6
-rw-r--r--src/Mount/Mount.c316
-rw-r--r--src/Mount/Mount.rc140
-rw-r--r--src/Mount/Resource.h6
-rw-r--r--src/Release/Setup Files/LICENSE190
-rw-r--r--src/Release/Setup Files/NOTICE134
-rw-r--r--src/Release/Setup Files/VeraCrypt User Guide.pdfbin3010349 -> 2793735 bytes
28 files changed, 1400 insertions, 281 deletions
diff --git a/src/Boot/Windows/BootCommon.h b/src/Boot/Windows/BootCommon.h
index 4d820493..4d91981b 100644
--- a/src/Boot/Windows/BootCommon.h
+++ b/src/Boot/Windows/BootCommon.h
@@ -17,7 +17,7 @@
#include "BootDefs.h"
// The user will be advised to upgrade the rescue disk if upgrading from the following or any previous version
-#define TC_RESCUE_DISK_UPGRADE_NOTICE_MAX_VERSION 0x0116
+#define TC_RESCUE_DISK_UPGRADE_NOTICE_MAX_VERSION 0x0117
#define TC_BOOT_LOADER_AREA_SIZE (TC_BOOT_LOADER_AREA_SECTOR_COUNT * TC_SECTOR_SIZE_BIOS)
diff --git a/src/Boot/Windows/BootConfig.cpp b/src/Boot/Windows/BootConfig.cpp
index 222fcfc4..63ebaf5e 100644
--- a/src/Boot/Windows/BootConfig.cpp
+++ b/src/Boot/Windows/BootConfig.cpp
@@ -32,7 +32,7 @@ Partition EncryptedVirtualPartition;
Partition ActivePartition;
Partition PartitionFollowingActive;
bool ExtraBootPartitionPresent = false;
-uint64 HiddenVolumeStartUnitNo;
+uint64 PimValueOrHiddenVolumeStartUnitNo; // reuse this variable for stored PIM value to reduce memory usage
uint64 HiddenVolumeStartSector;
#ifndef TC_WINDOWS_BOOT_RESCUE_DISK_MODE
@@ -68,6 +68,14 @@ void ReadBootSectorUserConfiguration ()
DisableScreenOutput();
}
+ if (userConfig & TC_BOOT_USER_CFG_FLAG_DISABLE_PIM)
+ {
+ PimValueOrHiddenVolumeStartUnitNo.LowPart = 0;
+ memcpy (&PimValueOrHiddenVolumeStartUnitNo.LowPart, SectorBuffer + TC_BOOT_SECTOR_PIM_VALUE_OFFSET, TC_BOOT_SECTOR_PIM_VALUE_SIZE);
+ }
+ else
+ PimValueOrHiddenVolumeStartUnitNo.LowPart = -1;
+
OuterVolumeBackupHeaderCrc = *(uint32 *) (SectorBuffer + TC_BOOT_SECTOR_OUTER_VOLUME_BAK_HEADER_CRC_OFFSET);
ret:
diff --git a/src/Boot/Windows/BootConfig.h b/src/Boot/Windows/BootConfig.h
index d972a49f..0c5eee74 100644
--- a/src/Boot/Windows/BootConfig.h
+++ b/src/Boot/Windows/BootConfig.h
@@ -36,7 +36,7 @@ extern Partition EncryptedVirtualPartition;
extern Partition ActivePartition;
extern Partition PartitionFollowingActive;
extern bool ExtraBootPartitionPresent;
-extern uint64 HiddenVolumeStartUnitNo;
+extern uint64 PimValueOrHiddenVolumeStartUnitNo; // reuse this variable for stored PIM value to reduce memory usage
extern uint64 HiddenVolumeStartSector;
diff --git a/src/Boot/Windows/BootDefs.h b/src/Boot/Windows/BootDefs.h
index 6e425847..69c57dbc 100644
--- a/src/Boot/Windows/BootDefs.h
+++ b/src/Boot/Windows/BootDefs.h
@@ -14,11 +14,7 @@
#define TC_HEADER_Boot_BootDefs
// Total memory required (CODE + DATA + BSS + STACK + 0x100) in KBytes - determined from linker map.
-#ifdef TC_WINDOWS_BOOT_RESCUE_DISK_MODE
- #define TC__BOOT_MEMORY_REQUIRED 44
-#else
- #define TC__BOOT_MEMORY_REQUIRED 43
-#endif
+#define TC__BOOT_MEMORY_REQUIRED 43
#ifdef TC_WINDOWS_BOOT_SINGLE_CIPHER_MODE
# undef TC__BOOT_MEMORY_REQUIRED
@@ -74,6 +70,9 @@
#define TC__BOOT_SECTOR_OUTER_VOLUME_BAK_HEADER_CRC_SIZE 4
#define TC__BOOT_SECTOR_OUTER_VOLUME_BAK_HEADER_CRC_OFFSET (TC__BOOT_SECTOR_USER_MESSAGE_OFFSET - TC__BOOT_SECTOR_OUTER_VOLUME_BAK_HEADER_CRC_SIZE)
+#define TC__BOOT_SECTOR_PIM_VALUE_SIZE 2
+#define TC__BOOT_SECTOR_PIM_VALUE_OFFSET (TC__BOOT_SECTOR_OUTER_VOLUME_BAK_HEADER_CRC_OFFSET - TC__BOOT_SECTOR_PIM_VALUE_SIZE)
+
#define TC__BOOT_LOADER_DECOMPRESSOR_START_SECTOR 2
#define TC__BOOT_LOADER_DECOMPRESSOR_SECTOR_COUNT 4
#define TC__BOOT_LOADER_DECOMPRESSOR_MEMORY_SIZE 32768
@@ -100,6 +99,7 @@
#define TC__BOOT_USER_CFG_FLAG_SILENT_MODE TC_HEX (01)
#define TC__BOOT_USER_CFG_FLAG_DISABLE_ESC TC_HEX (02)
#define TC__BOOT_USER_CFG_FLAG_DISABLE_HW_ENCRYPTION TC_HEX (04)
+#define TC__BOOT_USER_CFG_FLAG_DISABLE_PIM TC_HEX (08)
// The following items are treated as a 2-bit value (apply TC_BOOT_CFG_MASK_HIDDEN_OS_CREATION_PHASE to obtain the value)
#define TC__HIDDEN_OS_CREATION_PHASE_NONE 0
@@ -163,6 +163,8 @@ TC_HIDDEN_OS_CREATION_PHASE_WIPED = TC__HIDDEN_OS_CREATION_PHASE_WIPED
#define TC_BOOT_SECTOR_USER_MESSAGE_OFFSET TC__BOOT_SECTOR_USER_MESSAGE_OFFSET
#define TC_BOOT_SECTOR_OUTER_VOLUME_BAK_HEADER_CRC_SIZE TC__BOOT_SECTOR_OUTER_VOLUME_BAK_HEADER_CRC_SIZE
#define TC_BOOT_SECTOR_OUTER_VOLUME_BAK_HEADER_CRC_OFFSET TC__BOOT_SECTOR_OUTER_VOLUME_BAK_HEADER_CRC_OFFSET
+#define TC_BOOT_SECTOR_PIM_VALUE_SIZE TC__BOOT_SECTOR_PIM_VALUE_SIZE
+#define TC_BOOT_SECTOR_PIM_VALUE_OFFSET TC__BOOT_SECTOR_PIM_VALUE_OFFSET
#define TC_BOOT_SECTOR_USER_MESSAGE_MAX_LENGTH TC__BOOT_SECTOR_USER_MESSAGE_MAX_LENGTH
#define TC_BOOT_SECTOR_VERSION_OFFSET TC__BOOT_SECTOR_VERSION_OFFSET
#define TC_BOOT_SECTOR_LOADER_LENGTH_OFFSET TC__BOOT_SECTOR_LOADER_LENGTH_OFFSET
@@ -186,6 +188,7 @@ TC_HIDDEN_OS_CREATION_PHASE_WIPED = TC__HIDDEN_OS_CREATION_PHASE_WIPED
#define TC_BOOT_USER_CFG_FLAG_SILENT_MODE TC__BOOT_USER_CFG_FLAG_SILENT_MODE
#define TC_BOOT_USER_CFG_FLAG_DISABLE_ESC TC__BOOT_USER_CFG_FLAG_DISABLE_ESC
#define TC_BOOT_USER_CFG_FLAG_DISABLE_HW_ENCRYPTION TC__BOOT_USER_CFG_FLAG_DISABLE_HW_ENCRYPTION
+#define TC_BOOT_USER_CFG_FLAG_DISABLE_PIM TC__BOOT_USER_CFG_FLAG_DISABLE_PIM
#define TC_HIDDEN_OS_CREATION_PHASE_NONE TC__HIDDEN_OS_CREATION_PHASE_NONE
#define TC_HIDDEN_OS_CREATION_PHASE_CLONING TC__HIDDEN_OS_CREATION_PHASE_CLONING
#define TC_HIDDEN_OS_CREATION_PHASE_WIPING TC__HIDDEN_OS_CREATION_PHASE_WIPING
diff --git a/src/Boot/Windows/BootEncryptedIo.cpp b/src/Boot/Windows/BootEncryptedIo.cpp
index cc44416d..d130534f 100644
--- a/src/Boot/Windows/BootEncryptedIo.cpp
+++ b/src/Boot/Windows/BootEncryptedIo.cpp
@@ -48,7 +48,7 @@ BiosResult ReadEncryptedSectors (uint16 destSegment, uint16 destOffset, byte dri
{
// Convert sector number to data unit number of the hidden volume
sector -= HiddenVolumeStartSector;
- sector += HiddenVolumeStartUnitNo;
+ sector += PimValueOrHiddenVolumeStartUnitNo;
}
if (drive == EncryptedVirtualPartition.Drive)
@@ -96,7 +96,7 @@ BiosResult WriteEncryptedSectors (uint16 sourceSegment, uint16 sourceOffset, byt
writeOffset = HiddenVolumeStartSector;
writeOffset -= EncryptedVirtualPartition.StartSector;
dataUnitNo -= EncryptedVirtualPartition.StartSector;
- dataUnitNo += HiddenVolumeStartUnitNo;
+ dataUnitNo += PimValueOrHiddenVolumeStartUnitNo;
}
while (sectorCount-- > 0)
diff --git a/src/Boot/Windows/BootMain.cpp b/src/Boot/Windows/BootMain.cpp
index abab2038..275c5762 100644
--- a/src/Boot/Windows/BootMain.cpp
+++ b/src/Boot/Windows/BootMain.cpp
@@ -231,71 +231,83 @@ static byte AskPassword (Password &password, int& pim)
PrintCharAtCursor (asciiCode);
}
- pos = 0;
- Print ("PIM: ");
-
- while (true)
+#ifndef TC_WINDOWS_BOOT_RESCUE_DISK_MODE
+ if (PimValueOrHiddenVolumeStartUnitNo.LowPart != -1)
{
- asciiCode = GetKeyboardChar (&scanCode);
+ pim = (int) PimValueOrHiddenVolumeStartUnitNo.LowPart;
+ // reset stored PIM value to allow requesting PIM next time in case the stored value is wrong
+ PimValueOrHiddenVolumeStartUnitNo.LowPart = -1;
+ return TC_BIOS_KEY_ENTER;
+ }
+ else
+#endif
+ {
+ pos = 0;
+ Print ("PIM: ");
- switch (scanCode)
+ while (true)
{
- case TC_BIOS_KEY_ENTER:
- Print ("\rPIM: ");
- pos =0;
- while (pos < MAX_PIM)
+ asciiCode = GetKeyboardChar (&scanCode);
+
+ switch (scanCode)
{
- PrintChar ('*');
- pos++;
- }
+ case TC_BIOS_KEY_ENTER:
+ Print ("\rPIM: ");
+ pos =0;
+ while (pos < MAX_PIM)
+ {
+ PrintChar ('*');
+ pos++;
+ }
- ClearBiosKeystrokeBuffer();
- PrintEndl();
-
- return TC_BIOS_KEY_ENTER;
+ ClearBiosKeystrokeBuffer();
+ PrintEndl();
+
+ return TC_BIOS_KEY_ENTER;
- case TC_BIOS_KEY_BACKSPACE:
- if (pos > 0)
- {
- if (pos < MAX_PIM)
- PrintBackspace();
- else
- PrintCharAtCursor (' ');
+ case TC_BIOS_KEY_BACKSPACE:
+ if (pos > 0)
+ {
+ if (pos < MAX_PIM)
+ PrintBackspace();
+ else
+ PrintCharAtCursor (' ');
- --pos;
- pim /= 10;
- }
- continue;
+ --pos;
+ pim /= 10;
+ }
+ continue;
- case TC_BIOS_KEY_F5:
- hidePassword ^= 0x01;
- continue;
+ case TC_BIOS_KEY_F5:
+ hidePassword ^= 0x01;
+ continue;
- default:
- if (scanCode == TC_BIOS_KEY_ESC || IsMenuKey (scanCode))
- {
- burn (password.Text, sizeof (password.Text));
- ClearBiosKeystrokeBuffer();
+ default:
+ if (scanCode == TC_BIOS_KEY_ESC || IsMenuKey (scanCode))
+ {
+ burn (password.Text, sizeof (password.Text));
+ ClearBiosKeystrokeBuffer();
- PrintEndl();
- return scanCode;
+ PrintEndl();
+ return scanCode;
+ }
}
- }
- if (!IsDigit (asciiCode) || pos == MAX_PIM)
- {
- Beep();
- continue;
- }
+ if (!IsDigit (asciiCode) || pos == MAX_PIM)
+ {
+ Beep();
+ continue;
+ }
- pim = 10*pim + (asciiCode - '0');
- pos++;
-
- if (hidePassword) asciiCode = '*';
- if (pos < MAX_PIM)
- PrintChar (asciiCode);
- else
- PrintCharAtCursor (asciiCode);
+ pim = 10*pim + (asciiCode - '0');
+ pos++;
+
+ if (hidePassword) asciiCode = '*';
+ if (pos < MAX_PIM)
+ PrintChar (asciiCode);
+ else
+ PrintCharAtCursor (asciiCode);
+ }
}
}
@@ -468,7 +480,7 @@ static bool MountVolume (byte drive, byte &exitKey, bool skipNormal, bool skipHi
EncryptedVirtualPartition.StartSector = BootCryptoInfo->EncryptedAreaStart >> TC_LB_SIZE_BIT_SHIFT_DIVISOR;
- HiddenVolumeStartUnitNo = EncryptedVirtualPartition.StartSector;
+ PimValueOrHiddenVolumeStartUnitNo = EncryptedVirtualPartition.StartSector;
HiddenVolumeStartSector = PartitionFollowingActive.StartSector;
HiddenVolumeStartSector += EncryptedVirtualPartition.StartSector;
@@ -749,7 +761,7 @@ static bool CopySystemPartitionToHiddenVolume (byte drive, byte &exitKey)
{
CopyMemory (TC_BOOT_LOADER_BUFFER_SEGMENT, i * TC_LB_SIZE, SectorBuffer, TC_LB_SIZE);
- uint64 s = HiddenVolumeStartUnitNo + sectorOffset + i;
+ uint64 s = PimValueOrHiddenVolumeStartUnitNo + sectorOffset + i;
EncryptDataUnits (SectorBuffer, &s, 1, BootCryptoInfo);
CopyMemory (SectorBuffer, TC_BOOT_LOADER_BUFFER_SEGMENT, i * TC_LB_SIZE, TC_LB_SIZE);
diff --git a/src/Common/Apidrvr.h b/src/Common/Apidrvr.h
index 2cfa369f..f584582e 100644
--- a/src/Common/Apidrvr.h
+++ b/src/Common/Apidrvr.h
@@ -128,6 +128,7 @@ typedef struct
unsigned __int32 ulMountedDrives; /* Bitfield of all mounted drive letters */
wchar_t wszVolume[26][TC_MAX_PATH]; /* Volume names of mounted volumes */
wchar_t wszLabel[26][33]; /* Labels of mounted volumes */
+ wchar_t volumeID[26][VOLUME_ID_SIZE]; /* IDs of mounted volumes */
unsigned __int64 diskLength[26];
int ea[26];
int volumeType[26]; /* Volume type (e.g. PROP_VOL_TYPE_OUTER, PROP_VOL_TYPE_OUTER_VOL_WRITE_PREVENTED, etc.) */
@@ -156,6 +157,7 @@ typedef struct
int volumePim;
wchar_t wszLabel[33];
BOOL bDriverSetLabel;
+ unsigned char volumeID[VOLUME_ID_SIZE];
} VOLUME_PROPERTIES_STRUCT;
typedef struct
@@ -194,6 +196,9 @@ typedef struct
BOOL TCBootLoaderDetected;
BOOL DetectFilesystem;
BOOL FilesystemDetected;
+ BOOL bMatchVolumeID;
+ unsigned char volumeID[VOLUME_ID_SIZE];
+ BOOL VolumeIDMatched;
} OPEN_TEST_STRUCT;
diff --git a/src/Common/BootEncryption.cpp b/src/Common/BootEncryption.cpp
index 07eb9a99..851d7622 100644
--- a/src/Common/BootEncryption.cpp
+++ b/src/Common/BootEncryption.cpp
@@ -1300,7 +1300,7 @@ namespace VeraCrypt
}
- void BootEncryption::WriteBootSectorUserConfig (byte userConfig, const string &customUserMessage)
+ void BootEncryption::WriteBootSectorUserConfig (byte userConfig, const string &customUserMessage, int pim)
{
Device device (GetSystemDriveConfiguration().DevicePath);
device.CheckOpened (SRC_POS);
@@ -1326,6 +1326,15 @@ namespace VeraCrypt
memcpy (mbr + TC_BOOT_SECTOR_USER_MESSAGE_OFFSET, customUserMessage.c_str(), customUserMessage.size());
}
+
+ if (userConfig & TC_BOOT_USER_CFG_FLAG_DISABLE_PIM)
+ {
+ // PIM for pre-boot authentication can be encoded on two bytes since its maximum
+ // value is 65535 (0xFFFF)
+ memcpy (mbr + TC_BOOT_SECTOR_PIM_VALUE_OFFSET, &pim, TC_BOOT_SECTOR_PIM_VALUE_SIZE);
+ }
+ else
+ memset (mbr + TC_BOOT_SECTOR_PIM_VALUE_OFFSET, 0, TC_BOOT_SECTOR_PIM_VALUE_SIZE);
device.SeekAt (0);
device.Write (mbr, sizeof (mbr));
@@ -1494,7 +1503,7 @@ namespace VeraCrypt
InstallBootLoader (device, preserveUserConfig, hiddenOSCreation);
}
- void BootEncryption::InstallBootLoader (Device& device, bool preserveUserConfig, bool hiddenOSCreation)
+ void BootEncryption::InstallBootLoader (Device& device, bool preserveUserConfig, bool hiddenOSCreation, int pim)
{
byte bootLoaderBuf[TC_BOOT_LOADER_AREA_SIZE - TC_BOOT_ENCRYPTION_VOLUME_HEADER_SIZE] = {0};
CreateBootLoaderInMemory (bootLoaderBuf, sizeof (bootLoaderBuf), false, hiddenOSCreation);
@@ -1512,6 +1521,16 @@ namespace VeraCrypt
{
bootLoaderBuf[TC_BOOT_SECTOR_USER_CONFIG_OFFSET] = mbr[TC_BOOT_SECTOR_USER_CONFIG_OFFSET];
memcpy (bootLoaderBuf + TC_BOOT_SECTOR_USER_MESSAGE_OFFSET, mbr + TC_BOOT_SECTOR_USER_MESSAGE_OFFSET, TC_BOOT_SECTOR_USER_MESSAGE_MAX_LENGTH);
+
+ if (bootLoaderBuf[TC_BOOT_SECTOR_USER_CONFIG_OFFSET] & TC_BOOT_USER_CFG_FLAG_DISABLE_PIM)
+ {
+ if (pim >= 0)
+ {
+ memcpy (bootLoaderBuf + TC_BOOT_SECTOR_PIM_VALUE_OFFSET, &pim, TC_BOOT_SECTOR_PIM_VALUE_SIZE);
+ }
+ else
+ memcpy (bootLoaderBuf + TC_BOOT_SECTOR_PIM_VALUE_OFFSET, mbr + TC_BOOT_SECTOR_PIM_VALUE_OFFSET, TC_BOOT_SECTOR_PIM_VALUE_SIZE);
+ }
}
}
@@ -2499,17 +2518,32 @@ namespace VeraCrypt
if (headerUpdated)
{
+ bool storedPimUpdateNeeded = false;
ReopenBootVolumeHeaderRequest reopenRequest;
reopenRequest.VolumePassword = *newPassword;
reopenRequest.pkcs5_prf = cryptoInfo->pkcs5;
reopenRequest.pim = pim;
finally_do_arg (ReopenBootVolumeHeaderRequest*, &reopenRequest, { burn (finally_arg, sizeof (*finally_arg)); });
+ if (old_pim != pim)
+ {
+ try
+ {
+ // check if PIM is stored in MBR
+ byte userConfig;
+ ReadBootSectorConfig (nullptr, 0, &userConfig);
+ if (userConfig & TC_BOOT_USER_CFG_FLAG_DISABLE_PIM)
+ storedPimUpdateNeeded = true;
+ }
+ catch (...)
+ {}
+ }
+
try
{
- // force update of bootloader if fingerprint doesn't match
- if (!CheckBootloaderFingerprint (true))
- InstallBootLoader (device, true);
+ // force update of bootloader if fingerprint doesn't match or if the stored PIM changed
+ if (storedPimUpdateNeeded || !CheckBootloaderFingerprint (true))
+ InstallBootLoader (device, true, false, pim);
}
catch (...)
{}
diff --git a/src/Common/BootEncryption.h b/src/Common/BootEncryption.h
index 8aad6708..a922d1fa 100644
--- a/src/Common/BootEncryption.h
+++ b/src/Common/BootEncryption.h
@@ -169,7 +169,7 @@ namespace VeraCrypt
void GetVolumeProperties (VOLUME_PROPERTIES_STRUCT *properties);
SystemDriveConfiguration GetSystemDriveConfiguration ();
void Install (bool hiddenSystem);
- void InstallBootLoader (Device& device, bool preserveUserConfig = false, bool hiddenOSCreation = false);
+ void InstallBootLoader (Device& device, bool preserveUserConfig = false, bool hiddenOSCreation = false, int pim = -1);
void InstallBootLoader (bool preserveUserConfig = false, bool hiddenOSCreation = false);
bool CheckBootloaderFingerprint (bool bSilent = false);
void InvalidateCachedSysDriveProperties ();
@@ -206,7 +206,7 @@ namespace VeraCrypt
void WipeHiddenOSCreationConfig ();
void WriteBootDriveSector (uint64 offset, byte *data);
void WriteBootSectorConfig (const byte newConfig[]);
- void WriteBootSectorUserConfig (byte userConfig, const string &customUserMessage);
+ void WriteBootSectorUserConfig (byte userConfig, const string &customUserMessage, int pim);
void WriteLocalMachineRegistryDwordValue (wchar_t *keyPath, wchar_t *valueName, DWORD value);
protected:
diff --git a/src/Common/Common.h b/src/Common/Common.h
index 3780cfe1..180cbffb 100644
--- a/src/Common/Common.h
+++ b/src/Common/Common.h
@@ -21,6 +21,8 @@
#define MAX_HOST_DRIVE_NUMBER 64
#define MAX_HOST_PARTITION_NUMBER 32
+#define VOLUME_ID_SIZE SHA256_DIGESTSIZE
+
typedef enum
{
// IMPORTANT: If you add a new item here, update IsOSVersionAtLeast().
diff --git a/src/Common/Common.rc b/src/Common/Common.rc
index 1abd1bbd..a0dbd612 100644
--- a/src/Common/Common.rc
+++ b/src/Common/Common.rc
@@ -98,28 +98,28 @@ BEGIN
LTEXT "Volume Label in Windows:",IDT_VOLUME_LABEL,12,70,95,8
END
-IDD_KEYFILES DIALOGEX 0, 0, 345, 251
+IDD_KEYFILES DIALOGEX 0, 0, 363, 251
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "VeraCrypt - Keyfiles"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
- CONTROL "",IDC_KEYLIST,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,8,263,118
+ CONTROL "",IDC_KEYLIST,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,8,275,118
PUSHBUTTON "Add &Files...",IDC_KEYADD,7,132,61,14
- PUSHBUTTON "Add &Path...",IDC_ADD_KEYFILE_PATH,73,132,61,14
- PUSHBUTTON "Add &Token Files...",IDC_TOKEN_FILES_ADD,139,132,65,14
- PUSHBUTTON "&Remove",IDC_KEYREMOVE,209,132,61,14
- PUSHBUTTON "Remove &All",IDC_KEYREMOVEALL,275,132,61,14
- CONTROL "U&se keyfiles",IDC_KEYFILES_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,232,83,11
- PUSHBUTTON "&Generate Random Keyfile...",IDC_GENERATE_KEYFILE,213,230,123,14
- DEFPUSHBUTTON "OK",IDOK,279,8,59,14
- PUSHBUTTON "Cancel",IDCANCEL,279,25,59,14
- LTEXT "",IDT_KEYFILES_NOTE,10,161,324,41,0,WS_EX_TRANSPARENT
- LTEXT "WARNING: If you lose a keyfile or if any bit of its first 1024 kilobytes changes, it will be impossible to mount volumes that use the keyfile!",IDT_KEYFILE_WARNING,279,44,58,85,0,WS_EX_TRANSPARENT
- CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,2,154,343,1,WS_EX_STATICEDGE
- CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,2,209,343,1,WS_EX_STATICEDGE
- LTEXT "More information on keyfiles",IDC_LINK_KEYFILES_INFO,96,233,108,10,SS_NOTIFY
+ PUSHBUTTON "Add &Path...",IDC_ADD_KEYFILE_PATH,79,132,61,14
+ PUSHBUTTON "Add &Token Files...",IDC_TOKEN_FILES_ADD,151,132,65,14
+ PUSHBUTTON "&Remove",IDC_KEYREMOVE,227,132,61,14
+ PUSHBUTTON "Remove &All",IDC_KEYREMOVEALL,299,132,61,14
+ CONTROL "U&se keyfiles",IDC_KEYFILES_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,232,105,11
+ PUSHBUTTON "&Generate Random Keyfile...",IDC_GENERATE_KEYFILE,237,230,123,14
+ DEFPUSHBUTTON "OK",IDOK,290,8,70,14
+ PUSHBUTTON "Cancel",IDCANCEL,290,25,70,14
+ LTEXT "",IDT_KEYFILES_NOTE,10,161,346,41,0,WS_EX_TRANSPARENT
+ LTEXT "WARNING: If you lose a keyfile or if any bit of its first 1024 kilobytes changes, it will be impossible to mount volumes that use the keyfile!",IDT_KEYFILE_WARNING,290,44,69,85,0,WS_EX_TRANSPARENT
+ CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,2,154,361,1,WS_EX_STATICEDGE
+ CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,2,209,361,1,WS_EX_STATICEDGE
+ LTEXT "More information on keyfiles",IDC_LINK_KEYFILES_INFO,119,233,113,10,SS_NOTIFY
CONTROL "Try first to mount with an empty password",IDC_KEYFILES_TRY_EMPTY_PASSWORD,
- "Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,7,217,205,10
+ "Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,7,217,310,10
END
IDD_LANGUAGE DIALOGEX 0, 0, 209, 183
@@ -366,7 +366,7 @@ BEGIN
IDD_KEYFILES, DIALOG
BEGIN
LEFTMARGIN, 7
- RIGHTMARGIN, 330
+ RIGHTMARGIN, 345
TOPMARGIN, 7
BOTTOMMARGIN, 244
END
diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c
index 2cf5bb8e..6958afe9 100644
--- a/src/Common/Dlgcode.c
+++ b/src/Common/Dlgcode.c
@@ -248,6 +248,9 @@ typedef LSTATUS (STDAPICALLTYPE *SHDeleteKeyWPtr)(HKEY hkey, LPCWSTR pszSubKey);
typedef HRESULT (STDAPICALLTYPE *SHStrDupWPtr)(LPCWSTR psz, LPWSTR *ppwsz);
+// ChangeWindowMessageFilter
+typedef BOOL (WINAPI *ChangeWindowMessageFilterPtr) (UINT, DWORD);
+
ImageList_CreatePtr ImageList_CreateFn = NULL;
ImageList_AddPtr ImageList_AddFn = NULL;
@@ -257,6 +260,7 @@ SetupInstallFromInfSectionWPtr SetupInstallFromInfSectionWFn = NULL;
SetupOpenInfFileWPtr SetupOpenInfFileWFn = NULL;
SHDeleteKeyWPtr SHDeleteKeyWFn = NULL;
SHStrDupWPtr SHStrDupWFn = NULL;
+ChangeWindowMessageFilterPtr ChangeWindowMessageFilterFn = NULL;
/* Windows dialog class */
#define WINDOWS_DIALOG_CLASS L"#32770"
@@ -265,6 +269,16 @@ SHStrDupWPtr SHStrDupWFn = NULL;
#define TC_DLG_CLASS L"VeraCryptCustomDlg"
#define TC_SPLASH_CLASS L"VeraCryptSplashDlg"
+/* constant used by ChangeWindowMessageFilter calls */
+#ifndef MSGFLT_ADD
+#define MSGFLT_ADD 1
+#endif
+
+/* undocumented message sent during drag-n-drop */
+#ifndef WM_COPYGLOBALDATA
+#define WM_COPYGLOBALDATA 0x0049
+#endif
+
/* Benchmarks */
#ifndef SETUP
@@ -2603,6 +2617,19 @@ void InitApp (HINSTANCE hInstance, wchar_t *lpszCommandLine)
if (!SHDeleteKeyWFn || !SHStrDupWFn)
AbortProcess ("INIT_DLL");
+ if (IsOSAtLeast (WIN_VISTA))
+ {
+ /* Get ChangeWindowMessageFilter used to enable some messages bypasss UIPI (User Interface Privilege Isolation) */
+ ChangeWindowMessageFilterFn = (ChangeWindowMessageFilterPtr) GetProcAddress (GetModuleHandle (L"user32.dll"), "ChangeWindowMessageFilter");
+
+#ifndef SETUP
+ /* enable drag-n-drop when we are running elevated */
+ AllowMessageInUIPI (WM_DROPFILES);
+ AllowMessageInUIPI (WM_COPYDATA);
+ AllowMessageInUIPI (WM_COPYGLOBALDATA);
+#endif
+ }
+
/* Save the instance handle for later */
hInst = hInstance;
@@ -2903,7 +2930,7 @@ void InitHelpFileName (void)
}
}
-BOOL OpenDevice (const wchar_t *lpszPath, OPEN_TEST_STRUCT *driver, BOOL detectFilesystem)
+BOOL OpenDevice (const wchar_t *lpszPath, OPEN_TEST_STRUCT *driver, BOOL detectFilesystem, BOOL matchVolumeID, const BYTE* pbVolumeID)
{
DWORD dwResult;
BOOL bResult;
@@ -2916,6 +2943,9 @@ BOOL OpenDevice (const wchar_t *lpszPath, OPEN_TEST_STRUCT *driver, BOOL detectF
driver->bDetectTCBootLoader = FALSE;
driver->DetectFilesystem = detectFilesystem;
+ driver->bMatchVolumeID = matchVolumeID;
+ if (matchVolumeID && pbVolumeID)
+ memcpy (driver->volumeID, pbVolumeID, VOLUME_ID_SIZE);
bResult = DeviceIoControl (hDriver, TC_IOCTL_OPEN_TEST,
driver, sizeof (OPEN_TEST_STRUCT),
@@ -2943,6 +2973,7 @@ BOOL OpenDevice (const wchar_t *lpszPath, OPEN_TEST_STRUCT *driver, BOOL detectF
{
driver->TCBootLoaderDetected = FALSE;
driver->FilesystemDetected = FALSE;
+ driver->VolumeIDMatched = FALSE;
return TRUE;
}
else
@@ -4685,6 +4716,55 @@ wstring IntToWideString (int val)
return szTmp;
}
+wstring ArrayToHexWideString (const unsigned char* pbData, int cbData)
+{
+ static wchar_t* hexChar = L"0123456789ABCDEF";
+ wstring result;
+ if (pbData)
+ {
+ for (int i = 0; i < cbData; i++)
+ {
+ result += hexChar[pbData[i] >> 4];
+ result += hexChar[pbData[i] & 0x0F];
+ }
+ }
+
+ return result;
+}
+
+bool HexToByte (wchar_t c, byte& b)
+{
+ bool bRet = true;
+ if (c >= L'0' && c <= L'9')
+ b = (byte) (c - L'0');
+ else if (c >= L'a' && c <= L'z')
+ b = (byte) (c - L'a' + 10);
+ else if (c >= L'A' && c <= L'Z')
+ b = (byte) (c - L'A' + 10);
+ else
+ bRet = false;
+
+ return bRet;
+}
+
+bool HexWideStringToArray (const wchar_t* hexStr, std::vector<byte>& arr)
+{
+ byte b1, b2;
+ size_t i, len = wcslen (hexStr);
+
+ arr.clear();
+ if (len %2)
+ return false;
+
+ for (i = 0; i < len/2; i++)
+ {
+ if (!HexToByte (*hexStr++, b1) || !HexToByte (*hexStr++, b2))
+ return false;
+ arr.push_back (b1 << 4 | b2);
+ }
+ return true;
+}
+
wstring GetTempPathString ()
{
wchar_t tempPath[MAX_PATH];
@@ -6680,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;
}
@@ -7042,12 +7124,37 @@ void ShowWaitDialog(HWND hwnd, BOOL bUseHwndAsParent, WaitThreadProc callback, v
/************************************************************************/
+static BOOL PerformMountIoctl (MOUNT_STRUCT* pmount, LPDWORD pdwResult, BOOL useVolumeID, BYTE volumeID[VOLUME_ID_SIZE])
+{
+ if (useVolumeID)
+ {
+ wstring devicePath = FindDeviceByVolumeID (volumeID);
+ if (devicePath == L"")
+ {
+ if (pdwResult)
+ *pdwResult = 0;
+ SetLastError (ERROR_PATH_NOT_FOUND);
+ return FALSE;
+ }
+ else
+ {
+ BOOL bDevice = FALSE;
+ CreateFullVolumePath (pmount->wszVolume, sizeof(pmount->wszVolume), devicePath.c_str(), &bDevice);
+ }
+ }
+
+ return DeviceIoControl (hDriver, TC_IOCTL_MOUNT_VOLUME, pmount,
+ sizeof (MOUNT_STRUCT), pmount, sizeof (MOUNT_STRUCT), pdwResult, NULL);
+}
+
// specific definitions and implementation for support of mount operation
// in wait dialog mechanism
typedef struct
{
MOUNT_STRUCT* pmount;
+ BOOL useVolumeID;
+ BYTE volumeID[VOLUME_ID_SIZE];
BOOL* pbResult;
DWORD* pdwResult;
DWORD dwLastError;
@@ -7057,8 +7164,7 @@ void CALLBACK MountWaitThreadProc(void* pArg, HWND )
{
MountThreadParam* pThreadParam = (MountThreadParam*) pArg;
- *(pThreadParam->pbResult) = DeviceIoControl (hDriver, TC_IOCTL_MOUNT_VOLUME, pThreadParam->pmount,
- sizeof (MOUNT_STRUCT),pThreadParam->pmount, sizeof (MOUNT_STRUCT), pThreadParam->pdwResult, NULL);
+ *(pThreadParam->pbResult) = PerformMountIoctl (pThreadParam->pmount, pThreadParam->pdwResult, pThreadParam->useVolumeID, pThreadParam->volumeID);
pThreadParam->dwLastError = GetLastError ();
}
@@ -7095,6 +7201,8 @@ int MountVolume (HWND hwndDlg,
BOOL bResult, bDevice;
wchar_t root[MAX_PATH];
int favoriteMountOnArrivalRetryCount = 0;
+ BOOL useVolumeID = FALSE;
+ BYTE volumeID[VOLUME_ID_SIZE] = {0};
#ifdef TCMOUNT
if (mountOptions->PartitionInInactiveSysEncScope)
@@ -7181,7 +7289,29 @@ retry:
StringCchCopyW (volumePath, TC_MAX_PATH, resolvedPath.c_str());
}
- CreateFullVolumePath (mount.wszVolume, sizeof(mount.wszVolume), volumePath, &bDevice);
+ if ((path.length () >= 3) && (_wcsnicmp (path.c_str(), L"ID:", 3) == 0))
+ {
+ std::vector<byte> arr;
+ if ( (path.length() == (3 + 2*VOLUME_ID_SIZE))
+ && HexWideStringToArray (path.c_str() + 3, arr)
+ && (arr.size() == VOLUME_ID_SIZE)
+ )
+ {
+ useVolumeID = TRUE;
+ bDevice = TRUE;
+ memcpy (volumeID, &arr[0], VOLUME_ID_SIZE);
+ }
+ else
+ {
+ if (!quiet)
+ Error ("VOLUME_ID_INVALID", hwndDlg);
+
+ SetLastError (ERROR_INVALID_PARAMETER);
+ return -1;
+ }
+ }
+ else
+ CreateFullVolumePath (mount.wszVolume, sizeof(mount.wszVolume), volumePath, &bDevice);
if (!bDevice)
{
@@ -7257,6 +7387,8 @@ retry:
{
MountThreadParam mountThreadParam;
mountThreadParam.pmount = &mount;
+ mountThreadParam.useVolumeID = useVolumeID;
+ memcpy (mountThreadParam.volumeID, volumeID, VOLUME_ID_SIZE);
mountThreadParam.pbResult = &bResult;
mountThreadParam.pdwResult = &dwResult;
mountThreadParam.dwLastError = ERROR_SUCCESS;
@@ -7267,8 +7399,8 @@ retry:
}
else
{
- bResult = DeviceIoControl (hDriver, TC_IOCTL_MOUNT_VOLUME, &mount,
- sizeof (mount), &mount, sizeof (mount), &dwResult, NULL);
+ bResult = PerformMountIoctl (&mount, &dwResult, useVolumeID, volumeID);
+
dwLastError = GetLastError ();
}
@@ -7555,22 +7687,11 @@ BOOL IsPasswordCacheEmpty (void)
return !DeviceIoControl (hDriver, TC_IOCTL_GET_PASSWORD_CACHE_STATUS, 0, 0, 0, 0, &dw, 0);
}
-
-BOOL IsMountedVolume (const wchar_t *volname)
+BOOL IsMountedVolumeID (BYTE volumeID[VOLUME_ID_SIZE])
{
MOUNT_LIST_STRUCT mlist;
DWORD dwResult;
int i;
- wchar_t volume[TC_MAX_PATH*2+16];
-
- StringCbCopyW (volume, sizeof(volume), volname);
-
- if (wcsstr (volname, L"\\Device\\") != volname)
- StringCbPrintfW(volume, sizeof(volume), L"\\??\\%s", volname);
-
- wstring resolvedPath = VolumeGuidPathToDevicePath (volname);
- if (!resolvedPath.empty())
- StringCbCopyW (volume, sizeof (volume), resolvedPath.c_str());
memset (&mlist, 0, sizeof (mlist));
DeviceIoControl (hDriver, TC_IOCTL_GET_MOUNTED_VOLUMES, &mlist,
@@ -7578,12 +7699,52 @@ BOOL IsMountedVolume (const wchar_t *volname)
NULL);
for (i=0 ; i<26; i++)
- if (0 == _wcsicmp ((wchar_t *) mlist.wszVolume[i], volume))
+ if (0 == memcmp (mlist.volumeID[i], volumeID, VOLUME_ID_SIZE))
return TRUE;
return FALSE;
}
+BOOL IsMountedVolume (const wchar_t *volname)
+{
+ if ((wcslen (volname) == (3 + 2*VOLUME_ID_SIZE)) && _wcsnicmp (volname, L"ID:", 3) == 0)
+ {
+ /* Volume ID specified. Use it for matching mounted volumes. */
+ std::vector<byte> arr;
+ if (HexWideStringToArray (&volname[3], arr) && (arr.size() == VOLUME_ID_SIZE))
+ {
+ return IsMountedVolumeID (&arr[0]);
+ }
+ }
+ else
+ {
+ MOUNT_LIST_STRUCT mlist;
+ DWORD dwResult;
+ int i;
+ wchar_t volume[TC_MAX_PATH*2+16];
+
+ StringCbCopyW (volume, sizeof(volume), volname);
+
+ if (wcsstr (volname, L"\\Device\\") != volname)
+ StringCbPrintfW(volume, sizeof(volume), L"\\??\\%s", volname);
+
+ wstring resolvedPath = VolumeGuidPathToDevicePath (volname);
+ if (!resolvedPath.empty())
+ StringCbCopyW (volume, sizeof (volume), resolvedPath.c_str());
+
+ memset (&mlist, 0, sizeof (mlist));
+ DeviceIoControl (hDriver, TC_IOCTL_GET_MOUNTED_VOLUMES, &mlist,
+ sizeof (mlist), &mlist, sizeof (mlist), &dwResult,
+ NULL);
+
+ for (i=0 ; i<26; i++)
+ if (0 == _wcsicmp ((wchar_t *) mlist.wszVolume[i], volume))
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
int GetMountedVolumeDriveNo (wchar_t *volname)
{
@@ -10848,7 +11009,7 @@ std::vector <HostDevice> GetAvailableHostDevices (bool noDeviceProperties, bool
const wchar_t *devPath = devPathStr.c_str();
OPEN_TEST_STRUCT openTest = {0};
- if (!OpenDevice (devPath, &openTest, detectUnencryptedFilesystems && partNumber != 0))
+ if (!OpenDevice (devPath, &openTest, detectUnencryptedFilesystems && partNumber != 0, FALSE, NULL))
{
if (partNumber == 0)
break;
@@ -10953,7 +11114,7 @@ std::vector <HostDevice> GetAvailableHostDevices (bool noDeviceProperties, bool
const wchar_t *devPath = devPathStr.c_str();
OPEN_TEST_STRUCT openTest = {0};
- if (!OpenDevice (devPath, &openTest, detectUnencryptedFilesystems))
+ if (!OpenDevice (devPath, &openTest, detectUnencryptedFilesystems, FALSE, NULL))
continue;
DISK_PARTITION_INFO_STRUCT info;
@@ -10993,6 +11154,46 @@ std::vector <HostDevice> GetAvailableHostDevices (bool noDeviceProperties, bool
return devices;
}
+wstring FindDeviceByVolumeID (const BYTE volumeID [VOLUME_ID_SIZE])
+{
+ /* if it is already mounted, get the real path name used for mounting */
+ MOUNT_LIST_STRUCT mlist;
+ DWORD dwResult;
+
+ memset (&mlist, 0, sizeof (mlist));
+ DeviceIoControl (hDriver, TC_IOCTL_GET_MOUNTED_VOLUMES, &mlist,
+ sizeof (mlist), &mlist, sizeof (mlist), &dwResult,
+ NULL);
+
+ for (int i=0 ; i < 26; i++)
+ {
+ if (0 == memcmp (mlist.volumeID[i], volumeID, VOLUME_ID_SIZE))
+ return mlist.wszVolume[i];
+ }
+
+ /* not mounted. Look for it in the local drives*/
+ for (int devNumber = 0; devNumber < MAX_HOST_DRIVE_NUMBER; devNumber++)
+ {
+ for (int partNumber = 0; partNumber < MAX_HOST_PARTITION_NUMBER; partNumber++)
+ {
+ wstringstream strm;
+ strm << L"\\Device\\Harddisk" << devNumber << L"\\Partition" << partNumber;
+ wstring devPathStr (strm.str());
+ const wchar_t *devPath = devPathStr.c_str();
+
+ OPEN_TEST_STRUCT openTest = {0};
+ if (!OpenDevice (devPath, &openTest, FALSE, TRUE, volumeID))
+ {
+ continue;
+ }
+
+ if (openTest.VolumeIDMatched)
+ return devPath;
+ }
+ }
+
+ return L"";
+}
BOOL FileHasReadOnlyAttribute (const wchar_t *path)
{
@@ -11215,7 +11416,7 @@ BOOL VolumePathExists (const wchar_t *volumePath)
UpperCaseCopy (upperCasePath, sizeof(upperCasePath), volumePath);
if (wcsstr (upperCasePath, L"\\DEVICE\\") == upperCasePath)
- return OpenDevice (volumePath, &openTest, FALSE);
+ return OpenDevice (volumePath, &openTest, FALSE, FALSE, NULL);
wstring path = volumePath;
if (path.find (L"\\\\?\\Volume{") == 0 && path.rfind (L"}\\") == path.size() - 2)
@@ -11575,3 +11776,89 @@ void ProcessEntropyEstimate (HWND hProgress, DWORD* pdwInitialValue, DWORD dwCou
0);
}
}
+
+void AllowMessageInUIPI (UINT msg)
+{
+ if (ChangeWindowMessageFilterFn)
+ {
+ ChangeWindowMessageFilterFn (msg, MSGFLT_ADD);
+ }
+}
+
+BOOL IsRepeatedByteArray (byte value, const byte* buffer, size_t bufferSize)
+{
+ if (buffer && bufferSize)
+ {
+ size_t i;
+ for (i = 0; i < bufferSize; i++)
+ {
+ if (*buffer++ != value)
+ return FALSE;
+ }
+ return TRUE;
+ }
+ else
+ return FALSE;
+}
+
+BOOL TranslateVolumeID (HWND hwndDlg, wchar_t* pathValue, size_t cchPathValue)
+{
+ BOOL bRet = TRUE;
+ size_t pathLen = pathValue? wcslen (pathValue) : 0;
+ if ((pathLen >= 3) && (_wcsnicmp (pathValue, L"ID:", 3) == 0))
+ {
+ std::vector<byte> arr;
+ if ( (pathLen == (3 + 2*VOLUME_ID_SIZE))
+ && HexWideStringToArray (pathValue + 3, arr)
+ && (arr.size() == VOLUME_ID_SIZE)
+ )
+ {
+ std::wstring devicePath = FindDeviceByVolumeID (&arr[0]);
+ if (devicePath.length() > 0)
+ StringCchCopyW (pathValue, cchPathValue, devicePath.c_str());
+ else
+ {
+ if (!Silent && !MultipleMountOperationInProgress)
+ Error ("VOLUME_ID_NOT_FOUND", hwndDlg);
+ SetLastError (ERROR_PATH_NOT_FOUND);
+ bRet = FALSE;
+ }
+ }
+ else
+ {
+ if (!Silent)
+ Error ("VOLUME_ID_INVALID", hwndDlg);
+
+ SetLastError (ERROR_INVALID_PARAMETER);
+ bRet = FALSE;
+ }
+ }
+
+ return bRet;
+}
+
+BOOL CopyTextToClipboard (LPCWSTR txtValue)
+{
+ size_t txtLen = wcslen(txtValue);
+ HGLOBAL hdst;
+ LPWSTR dst;
+ BOOL bRet = FALSE;
+
+ // Allocate string for cwd
+ hdst = GlobalAlloc(GMEM_MOVEABLE, (txtLen + 1) * sizeof(WCHAR));
+ if (hdst)
+ {
+ dst = (LPWSTR)GlobalLock(hdst);
+ wmemcpy(dst, txtValue, txtLen + 1);
+ GlobalUnlock(hdst);
+
+ if (OpenClipboard(NULL))
+ {
+ EmptyClipboard();
+ SetClipboardData(CF_UNICODETEXT, hdst);
+ CloseClipboard();
+ }
+ }
+
+ return bRet;
+}
diff --git a/src/Common/Dlgcode.h b/src/Common/Dlgcode.h
index 20199924..d9f29cd0 100644
--- a/src/Common/Dlgcode.h
+++ b/src/Common/Dlgcode.h
@@ -34,7 +34,8 @@ enum dynamic_gui_element_ids
IDPM_ADD_TO_FAVORITES,
IDPM_ADD_TO_SYSTEM_FAVORITES,
IDM_SHOW_HIDE,
- IDM_HOMEPAGE_SYSTRAY
+ IDM_HOMEPAGE_SYSTRAY,
+ IDPM_COPY_VALUE_TO_CLIPBOARD
};
enum
@@ -298,7 +299,7 @@ void InitOSVersionInfo ();
void InitApp ( HINSTANCE hInstance, wchar_t *lpszCommandLine );
void FinalizeApp (void);
void InitHelpFileName (void);
-BOOL OpenDevice (const wchar_t *lpszPath, OPEN_TEST_STRUCT *driver, BOOL detectFilesystem);
+BOOL OpenDevice (const wchar_t *lpszPath, OPEN_TEST_STRUCT *driver, BOOL detectFilesystem, BOOL matchVolumeID, const BYTE* pbVolumeID);
void NotifyDriverOfPortableMode (void);
int GetAvailableFixedDisks ( HWND hComboBox , char *lpszRootPath );
int GetAvailableRemovables ( HWND hComboBox , char *lpszRootPath );
@@ -342,6 +343,7 @@ int MountVolume (HWND hwndDlg, int driveNo, wchar_t *volumePath, Password *passw
BOOL UnmountVolume (HWND hwndDlg , int nDosDriveNo, BOOL forceUnmount);
BOOL UnmountVolumeAfterFormatExCall (HWND hwndDlg, int nDosDriveNo);
BOOL IsPasswordCacheEmpty (void);
+BOOL IsMountedVolumeID (BYTE volumeID[VOLUME_ID_SIZE]);
BOOL IsMountedVolume (const wchar_t *volname);
int GetMountedVolumeDriveNo (wchar_t *volname);
BOOL IsAdmin (void);
@@ -500,6 +502,10 @@ HIMAGELIST CreateImageList(int cx, int cy, UINT flags, int cInitial, int cGrow)
int AddBitmapToImageList(HIMAGELIST himl, HBITMAP hbmImage, HBITMAP hbmMask);
HRESULT VCStrDupW(LPCWSTR psz, LPWSTR *ppwsz);
void ProcessEntropyEstimate (HWND hProgress, DWORD* pdwInitialValue, DWORD dwCounter, DWORD dwMaxLevel, DWORD* pdwEntropy);
+void AllowMessageInUIPI (UINT msg);
+BOOL IsRepeatedByteArray (byte value, const byte* buffer, size_t bufferSize);
+BOOL TranslateVolumeID (HWND hwndDlg, wchar_t* pathValue, size_t cchPathValue);
+BOOL CopyTextToClipboard (const wchar_t* txtValue);
#ifdef __cplusplus
}
@@ -564,6 +570,9 @@ std::wstring HarddiskVolumePathToPartitionPath (const std::wstring &harddiskVolu
std::wstring FindLatestFileOrDirectory (const std::wstring &directory, const wchar_t *namePattern, bool findDirectory, bool findFile);
std::wstring GetUserFriendlyVersionString (int version);
std::wstring IntToWideString (int val);
+std::wstring ArrayToHexWideString (const unsigned char* pbData, int cbData);
+bool HexWideStringToArray (const wchar_t* hexStr, std::vector<byte>& arr);
+std::wstring FindDeviceByVolumeID (const BYTE volumeID [VOLUME_ID_SIZE]);
void RegisterDriverInf (bool registerFilter, const std::string& filter, const std::string& filterReg, HWND ParentWindow, HKEY regKey);
std::wstring GetTempPathString ();
inline std::wstring AppendSrcPos (const wchar_t* msg, const char* srcPos)
diff --git a/src/Common/Language.xml b/src/Common/Language.xml
index d994bf63..f72e1a30 100644
--- a/src/Common/Language.xml
+++ b/src/Common/Language.xml
@@ -1388,6 +1388,14 @@
<string lang="en" key="INIT_DLL">Error: Failed to load a system library.</string>
<string lang="en" key="ERR_EXFAT_INVALID_VOLUME_SIZE">The volume file size specified in the command line is incompatible with selected exFAT filesystem.</string>
<control lang="en" key="IDT_ENTROPY_BAR">Randomness Collected From Mouse Movements</control>
+ <control lang="en" key="IDT_VOLUME_ID">Volume ID:</control>
+ <string lang="en" key="VOLUME_ID">Volume ID</string>
+ <control lang="en" key="IDC_FAVORITE_USE_VOLUME_ID">Use Volume ID to mount favorite</control>
+ <string lang="en" key="VOLUME_ID_INVALID">The Volume ID value is invalid</string>
+ <string lang="en" key="VOLUME_ID_NOT_FOUND">No Volume with the specified ID was found on the system</string>
+ <string lang="en" key="IDPM_COPY_VALUE_TO_CLIPBOARD">Copy Value to Clipboard...</string>
+ <control lang="en" key="IDC_DISABLE_BOOT_LOADER_PIM_PROMPT">Do not request PIM in the pre-boot authentication screen (PIM value is stored unencrypted on disk)</control>
+ <string lang="en" key="DISABLE_BOOT_LOADER_PIM_PROMPT">WARNING: Please keep in mind that if you enable this option, the PIM value will be stored unencrypted on the disk.\n\nAre you sure you want to enable this option?</string>
</localization>
<!-- XML Schema -->
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
diff --git a/src/Common/Volumes.c b/src/Common/Volumes.c
index b7c77e9c..955c7e48 100644
--- a/src/Common/Volumes.c
+++ b/src/Common/Volumes.c
@@ -590,6 +590,7 @@ void ComputeBootloaderFingerprint (byte *bootLoaderBuf, unsigned int bootLoaderS
{
// compute Whirlpool+SHA512 fingerprint of bootloader including MBR
// we skip user configuration fields:
+ // TC_BOOT_SECTOR_PIM_VALUE_OFFSET = 400
// TC_BOOT_SECTOR_OUTER_VOLUME_BAK_HEADER_CRC_OFFSET = 402
// => TC_BOOT_SECTOR_OUTER_VOLUME_BAK_HEADER_CRC_SIZE = 4
// TC_BOOT_SECTOR_USER_MESSAGE_OFFSET = 406
@@ -604,8 +605,8 @@ void ComputeBootloaderFingerprint (byte *bootLoaderBuf, unsigned int bootLoaderS
WHIRLPOOL_init (&whirlpool);
sha512_begin (&sha2);
- WHIRLPOOL_add (bootLoaderBuf, TC_BOOT_SECTOR_OUTER_VOLUME_BAK_HEADER_CRC_OFFSET * 8, &whirlpool);
- sha512_hash (bootLoaderBuf, TC_BOOT_SECTOR_OUTER_VOLUME_BAK_HEADER_CRC_OFFSET, &sha2);
+ WHIRLPOOL_add (bootLoaderBuf, TC_BOOT_SECTOR_PIM_VALUE_OFFSET * 8, &whirlpool);
+ sha512_hash (bootLoaderBuf, TC_BOOT_SECTOR_PIM_VALUE_OFFSET, &sha2);
WHIRLPOOL_add (bootLoaderBuf + TC_BOOT_SECTOR_USER_MESSAGE_OFFSET + TC_BOOT_SECTOR_USER_MESSAGE_MAX_LENGTH, (TC_BOOT_SECTOR_USER_CONFIG_OFFSET - (TC_BOOT_SECTOR_USER_MESSAGE_OFFSET + TC_BOOT_SECTOR_USER_MESSAGE_MAX_LENGTH)) * 8, &whirlpool);
sha512_hash (bootLoaderBuf + TC_BOOT_SECTOR_USER_MESSAGE_OFFSET + TC_BOOT_SECTOR_USER_MESSAGE_MAX_LENGTH, (TC_BOOT_SECTOR_USER_CONFIG_OFFSET - (TC_BOOT_SECTOR_USER_MESSAGE_OFFSET + TC_BOOT_SECTOR_USER_MESSAGE_MAX_LENGTH)), &sha2);
@@ -1005,7 +1006,7 @@ int CreateVolumeHeaderInMemory (HWND hwndDlg, BOOL bBoot, char *header, int ea,
#ifdef VOLFORMAT
- if (showKeys && !bInPlaceEncNonSys)
+ if (!bInPlaceEncNonSys && (showKeys || (bBoot && !masterKeydata)))
{
BOOL dots3 = FALSE;
int i, j;
diff --git a/src/Driver/DriveFilter.c b/src/Driver/DriveFilter.c
index eba7c40c..a8752a5f 100644
--- a/src/Driver/DriveFilter.c
+++ b/src/Driver/DriveFilter.c
@@ -241,6 +241,7 @@ static void ComputeBootLoaderFingerprint(PDEVICE_OBJECT LowerDeviceObject, byte*
// compute Whirlpool+SHA512 fingerprint of bootloader including MBR
// we skip user configuration fields:
+ // TC_BOOT_SECTOR_PIM_VALUE_OFFSET = 400
// TC_BOOT_SECTOR_OUTER_VOLUME_BAK_HEADER_CRC_OFFSET = 402
// => TC_BOOT_SECTOR_OUTER_VOLUME_BAK_HEADER_CRC_SIZE = 4
// TC_BOOT_SECTOR_USER_MESSAGE_OFFSET = 406
@@ -257,11 +258,11 @@ static void ComputeBootLoaderFingerprint(PDEVICE_OBJECT LowerDeviceObject, byte*
status = TCReadDevice (LowerDeviceObject, ioBuffer, offset, TC_SECTOR_SIZE_BIOS);
if (NT_SUCCESS (status))
{
- WHIRLPOOL_add (ioBuffer, TC_BOOT_SECTOR_OUTER_VOLUME_BAK_HEADER_CRC_OFFSET * 8, &whirlpool);
+ WHIRLPOOL_add (ioBuffer, TC_BOOT_SECTOR_PIM_VALUE_OFFSET * 8, &whirlpool);
WHIRLPOOL_add (ioBuffer + TC_BOOT_SECTOR_USER_MESSAGE_OFFSET + TC_BOOT_SECTOR_USER_MESSAGE_MAX_LENGTH, (TC_BOOT_SECTOR_USER_CONFIG_OFFSET - (TC_BOOT_SECTOR_USER_MESSAGE_OFFSET + TC_BOOT_SECTOR_USER_MESSAGE_MAX_LENGTH)) * 8, &whirlpool);
WHIRLPOOL_add (ioBuffer + TC_BOOT_SECTOR_USER_CONFIG_OFFSET + 1, (TC_MAX_MBR_BOOT_CODE_SIZE - (TC_BOOT_SECTOR_USER_CONFIG_OFFSET + 1)) * 8, &whirlpool);
- sha512_hash (ioBuffer, TC_BOOT_SECTOR_OUTER_VOLUME_BAK_HEADER_CRC_OFFSET, &sha2);
+ sha512_hash (ioBuffer, TC_BOOT_SECTOR_PIM_VALUE_OFFSET, &sha2);
sha512_hash (ioBuffer + TC_BOOT_SECTOR_USER_MESSAGE_OFFSET + TC_BOOT_SECTOR_USER_MESSAGE_MAX_LENGTH, (TC_BOOT_SECTOR_USER_CONFIG_OFFSET - (TC_BOOT_SECTOR_USER_MESSAGE_OFFSET + TC_BOOT_SECTOR_USER_MESSAGE_MAX_LENGTH)), &sha2);
sha512_hash (ioBuffer + TC_BOOT_SECTOR_USER_CONFIG_OFFSET + 1, (TC_MAX_MBR_BOOT_CODE_SIZE - (TC_BOOT_SECTOR_USER_CONFIG_OFFSET + 1)), &sha2);
diff --git a/src/Driver/Ntdriver.c b/src/Driver/Ntdriver.c
index 5153c67b..eeea7815 100644
--- a/src/Driver/Ntdriver.c
+++ b/src/Driver/Ntdriver.c
@@ -975,7 +975,7 @@ NTSTATUS ProcessMainDeviceControlIrp (PDEVICE_OBJECT DeviceObject, PEXTENSION Ex
InitializeObjectAttributes (&ObjectAttributes, &FullFileName, OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE, NULL, NULL);
- if (opentest->bDetectTCBootLoader || opentest->DetectFilesystem)
+ if (opentest->bDetectTCBootLoader || opentest->DetectFilesystem || opentest->bMatchVolumeID)
access |= FILE_READ_DATA;
ntStatus = ZwCreateFile (&NtFileHandle,
@@ -986,8 +986,9 @@ NTSTATUS ProcessMainDeviceControlIrp (PDEVICE_OBJECT DeviceObject, PEXTENSION Ex
{
opentest->TCBootLoaderDetected = FALSE;
opentest->FilesystemDetected = FALSE;
+ opentest->VolumeIDMatched = FALSE;
- if (opentest->bDetectTCBootLoader || opentest->DetectFilesystem)
+ if (opentest->bDetectTCBootLoader || opentest->DetectFilesystem || opentest->bMatchVolumeID)
{
byte *readBuffer = TCalloc (TC_MAX_VOLUME_SECTOR_SIZE);
if (!readBuffer)
@@ -996,49 +997,99 @@ NTSTATUS ProcessMainDeviceControlIrp (PDEVICE_OBJECT DeviceObject, PEXTENSION Ex
}
else
{
- // Determine if the first sector contains a portion of the VeraCrypt Boot Loader
-
- offset.QuadPart = 0;
+ if (opentest->bDetectTCBootLoader || opentest->DetectFilesystem)
+ {
+ // Determine if the first sector contains a portion of the VeraCrypt Boot Loader
- ntStatus = ZwReadFile (NtFileHandle,
- NULL,
- NULL,
- NULL,
- &IoStatus,
- readBuffer,
- TC_MAX_VOLUME_SECTOR_SIZE,
- &offset,
- NULL);
+ offset.QuadPart = 0;
- if (NT_SUCCESS (ntStatus))
- {
- size_t i;
+ ntStatus = ZwReadFile (NtFileHandle,
+ NULL,
+ NULL,
+ NULL,
+ &IoStatus,
+ readBuffer,
+ TC_MAX_VOLUME_SECTOR_SIZE,
+ &offset,
+ NULL);
- if (opentest->bDetectTCBootLoader && IoStatus.Information >= TC_SECTOR_SIZE_BIOS)
+ if (NT_SUCCESS (ntStatus))
{
- // Search for the string "VeraCrypt"
- for (i = 0; i < TC_SECTOR_SIZE_BIOS - strlen (TC_APP_NAME); ++i)
+ size_t i;
+
+ if (opentest->bDetectTCBootLoader && IoStatus.Information >= TC_SECTOR_SIZE_BIOS)
{
- if (memcmp (readBuffer + i, TC_APP_NAME, strlen (TC_APP_NAME)) == 0)
+ // Search for the string "VeraCrypt"
+ for (i = 0; i < TC_SECTOR_SIZE_BIOS - strlen (TC_APP_NAME); ++i)
{
- opentest->TCBootLoaderDetected = TRUE;
+ if (memcmp (readBuffer + i, TC_APP_NAME, strlen (TC_APP_NAME)) == 0)
+ {
+ opentest->TCBootLoaderDetected = TRUE;
+ break;
+ }
+ }
+ }
+
+ if (opentest->DetectFilesystem && IoStatus.Information >= sizeof (int64))
+ {
+ switch (BE64 (*(uint64 *) readBuffer))
+ {
+ case 0xEB52904E54465320: // NTFS
+ case 0xEB3C904D53444F53: // FAT16
+ case 0xEB58904D53444F53: // FAT32
+ case 0xEB76904558464154: // exFAT
+
+ opentest->FilesystemDetected = TRUE;
break;
}
}
}
+ }
- if (opentest->DetectFilesystem && IoStatus.Information >= sizeof (int64))
+ if (opentest->bMatchVolumeID)
+ {
+ int volumeType;
+ BYTE volumeID[VOLUME_ID_SIZE];
+
+ // Go through all volume types (e.g., normal, hidden)
+ for (volumeType = TC_VOLUME_TYPE_NORMAL;
+ volumeType < TC_VOLUME_TYPE_COUNT;
+ volumeType++)
{
- switch (BE64 (*(uint64 *) readBuffer))
+ /* Read the volume header */
+ switch (volumeType)
{
- case 0xEB52904E54465320: // NTFS
- case 0xEB3C904D53444F53: // FAT16
- case 0xEB58904D53444F53: // FAT32
- case 0xEB76904558464154: // exFAT
+ case TC_VOLUME_TYPE_NORMAL:
+ offset.QuadPart = TC_VOLUME_HEADER_OFFSET;
+ break;
- opentest->FilesystemDetected = TRUE;
+ case TC_VOLUME_TYPE_HIDDEN:
+
+ offset.QuadPart = TC_HIDDEN_VOLUME_HEADER_OFFSET;
break;
}
+
+ ntStatus = ZwReadFile (NtFileHandle,
+ NULL,
+ NULL,
+ NULL,
+ &IoStatus,
+ readBuffer,
+ TC_MAX_VOLUME_SECTOR_SIZE,
+ &offset,
+ NULL);
+
+ if (NT_SUCCESS (ntStatus))
+ {
+ /* compute the ID of this volume: SHA-256 of the effective header */
+ sha256 (volumeID, readBuffer, TC_VOLUME_HEADER_EFFECTIVE_SIZE);
+
+ if (0 == memcmp (volumeID, opentest->volumeID, VOLUME_ID_SIZE))
+ {
+ opentest->VolumeIDMatched = TRUE;
+ break;
+ }
+ }
}
}
@@ -1214,6 +1265,7 @@ NTSTATUS ProcessMainDeviceControlIrp (PDEVICE_OBJECT DeviceObject, PEXTENSION Ex
list->ulMountedDrives |= (1 << ListExtension->nDosDriveNo);
RtlStringCbCopyW (list->wszVolume[ListExtension->nDosDriveNo], sizeof(list->wszVolume[ListExtension->nDosDriveNo]),ListExtension->wszVolume);
RtlStringCbCopyW (list->wszLabel[ListExtension->nDosDriveNo], sizeof(list->wszLabel[ListExtension->nDosDriveNo]),ListExtension->wszLabel);
+ memcpy (list->volumeID[ListExtension->nDosDriveNo], ListExtension->volumeID, VOLUME_ID_SIZE);
list->diskLength[ListExtension->nDosDriveNo] = ListExtension->DiskLength;
list->ea[ListExtension->nDosDriveNo] = ListExtension->cryptoInfo->ea;
if (ListExtension->cryptoInfo->hiddenVolume)
@@ -1265,6 +1317,7 @@ NTSTATUS ProcessMainDeviceControlIrp (PDEVICE_OBJECT DeviceObject, PEXTENSION Ex
prop->uniqueId = ListExtension->UniqueVolumeId;
RtlStringCbCopyW (prop->wszVolume, sizeof(prop->wszVolume),ListExtension->wszVolume);
RtlStringCbCopyW (prop->wszLabel, sizeof(prop->wszLabel),ListExtension->wszLabel);
+ memcpy (prop->volumeID, ListExtension->volumeID, VOLUME_ID_SIZE);
prop->bDriverSetLabel = ListExtension->bDriverSetLabel;
prop->diskLength = ListExtension->DiskLength;
prop->ea = ListExtension->cryptoInfo->ea;
diff --git a/src/Driver/Ntdriver.h b/src/Driver/Ntdriver.h
index 21051e44..59634760 100644
--- a/src/Driver/Ntdriver.h
+++ b/src/Driver/Ntdriver.h
@@ -81,6 +81,8 @@ typedef struct EXTENSION
BOOL bIsNTFS;
BOOL bDriverSetLabel;
+ unsigned char volumeID[VOLUME_ID_SIZE];
+
LARGE_INTEGER fileCreationTime;
LARGE_INTEGER fileLastAccessTime;
LARGE_INTEGER fileLastWriteTime;
diff --git a/src/Driver/Ntvol.c b/src/Driver/Ntvol.c
index 46dd46fd..4f35323b 100644
--- a/src/Driver/Ntvol.c
+++ b/src/Driver/Ntvol.c
@@ -517,6 +517,9 @@ NTSTATUS TCOpenVolume (PDEVICE_OBJECT DeviceObject,
Extension->cryptoInfo->bPartitionInInactiveSysEncScope = mount->bPartitionInInactiveSysEncScope;
+ /* compute the ID of this volume: SHA-512 of the effective header */
+ sha256 (Extension->volumeID, readBuffer, TC_VOLUME_HEADER_EFFECTIVE_SIZE);
+
if (volumeType == TC_VOLUME_TYPE_NORMAL)
{
if (mount->bPartitionInInactiveSysEncScope)
diff --git a/src/Format/Format.rc b/src/Format/Format.rc
index be565291..32da02eb 100644
--- a/src/Format/Format.rc
+++ b/src/Format/Format.rc
@@ -101,23 +101,23 @@ FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
COMBOBOX IDC_COMBO_BOX,7,23,137,126,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "&Test",IDC_CIPHER_TEST,149,22,59,14
- PUSHBUTTON "&Benchmark",IDC_BENCHMARK,149,82,59,14
- COMBOBOX IDC_COMBO_BOX_HASH_ALGO,7,122,83,126,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
- LTEXT "",IDC_BOX_HELP,7,40,205,40
- GROUPBOX "Encryption Algorithm",IDT_ENCRYPTION_ALGO,0,10,217,95
- GROUPBOX "Hash Algorithm",IDT_HASH_ALGO,0,109,217,35
- LTEXT "More information",IDC_LINK_MORE_INFO_ABOUT_CIPHER,7,82,135,10,SS_NOTIFY
- LTEXT "Information on hash algorithms",IDC_LINK_HASH_INFO,97,124,115,8,SS_NOTIFY
+ PUSHBUTTON "&Benchmark",IDC_BENCHMARK,149,100,59,14
+ COMBOBOX IDC_COMBO_BOX_HASH_ALGO,7,137,83,126,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+ LTEXT "",IDC_BOX_HELP,7,40,205,58
+ GROUPBOX "Encryption Algorithm",IDT_ENCRYPTION_ALGO,0,10,217,111
+ GROUPBOX "Hash Algorithm",IDT_HASH_ALGO,0,124,217,35
+ LTEXT "More information",IDC_LINK_MORE_INFO_ABOUT_CIPHER,7,102,135,10,SS_NOTIFY
+ LTEXT "Information on hash algorithms",IDC_LINK_HASH_INFO,97,139,115,8,SS_NOTIFY
END
IDD_PASSWORD_PAGE_DLG DIALOGEX 0, 0, 226, 172
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
- EDITTEXT IDC_PASSWORD,53,3,163,14,ES_PASSWORD | ES_AUTOHSCROLL
- EDITTEXT IDC_VERIFY,53,19,163,14,ES_PASSWORD | ES_AUTOHSCROLL
+ EDITTEXT IDC_PASSWORD,53,3,170,14,ES_PASSWORD | ES_AUTOHSCROLL
+ EDITTEXT IDC_VERIFY,53,19,170,14,ES_PASSWORD | ES_AUTOHSCROLL
CONTROL "U&se keyfiles",IDC_KEYFILES_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,53,35,95,10
- PUSHBUTTON "&Keyfiles...",IDC_KEY_FILES,152,36,64,14,WS_DISABLED
+ PUSHBUTTON "&Keyfiles...",IDC_KEY_FILES,152,36,71,14,WS_DISABLED
CONTROL "&Display password",IDC_SHOW_PASSWORD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,53,45,95,11,WS_EX_TRANSPARENT
CONTROL "Use P&IM",IDC_PIM_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,53,56,97,10
RTEXT "Password:",IDT_PASSWORD,1,6,50,8
@@ -133,8 +133,8 @@ BEGIN
CONTROL "&KB",IDC_KB,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,80,25,27,10
CONTROL "&MB",IDC_MB,"Button",BS_AUTORADIOBUTTON,115,25,27,10
CONTROL "&GB",IDC_GB,"Button",BS_AUTORADIOBUTTON,150,25,27,10
- LTEXT "",IDC_BOX_HELP,0,75,214,64
- LTEXT "",IDC_SPACE_LEFT,0,44,214,21
+ LTEXT "",IDC_BOX_HELP,0,84,214,75
+ LTEXT "",IDC_SPACE_LEFT,0,44,214,33
CONTROL "&TB",IDC_TB,"Button",BS_AUTORADIOBUTTON,185,25,27,10
END
@@ -143,9 +143,9 @@ STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
COMBOBOX IDC_COMBO_BOX,0,9,148,80,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
- CONTROL "&Never save history",IDC_NO_HISTORY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,3,28,137,10
+ CONTROL "&Never save history",IDC_NO_HISTORY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,3,28,213,10
PUSHBUTTON "",IDC_SELECT_VOLUME_LOCATION,155,9,62,14
- LTEXT "",IDC_BOX_HELP,0,45,219,108
+ LTEXT "",IDC_BOX_HELP,0,42,219,125
END
IDD_FORMAT_PAGE_DLG DIALOGEX 0, 0, 226, 172
@@ -186,22 +186,22 @@ FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
CONTROL "Create an encrypted file container",IDC_FILE_CONTAINER,
"Button",BS_AUTORADIOBUTTON,0,7,217,10
- LTEXT "More information",IDC_MORE_INFO_ON_CONTAINERS,16,39,165,10,SS_NOTIFY
+ LTEXT "More information",IDC_MORE_INFO_ON_CONTAINERS,16,40,165,10,SS_NOTIFY
CONTROL "Encrypt a non-system partition/drive",IDC_NONSYS_DEVICE,
"Button",BS_AUTORADIOBUTTON,0,53,217,10
CONTROL "Encrypt the system partition or entire system drive",IDC_SYS_DEVICE,
- "Button",BS_AUTORADIOBUTTON,0,87,217,10
- LTEXT "More information about system encryption",IDC_MORE_INFO_ON_SYS_ENCRYPTION,16,136,190,10,SS_NOTIFY
+ "Button",BS_AUTORADIOBUTTON,0,89,217,10
+ LTEXT "More information about system encryption",IDC_MORE_INFO_ON_SYS_ENCRYPTION,16,153,190,10,SS_NOTIFY
LTEXT "Creates a virtual encrypted disk within a file. Recommended for inexperienced users.",IDT_FILE_CONTAINER,16,20,205,16
- LTEXT "Encrypts a non-system partition on any internal or external drive (e.g. a flash drive). Optionally, creates a hidden volume.",IDT_NON_SYS_DEVICE,16,66,205,16
- LTEXT "Encrypts the partition/drive where Windows is installed. Anyone who wants to gain access and use the system, read and write files, etc., will need to enter the correct password each time before Windows boots. Optionally, creates a hidden system.",IDT_SYS_DEVICE,16,100,205,33
+ LTEXT "Encrypts a non-system partition on any internal or external drive (e.g. a flash drive). Optionally, creates a hidden volume.",IDT_NON_SYS_DEVICE,16,66,205,20
+ LTEXT "Encrypts the partition/drive where Windows is installed. Anyone who wants to gain access and use the system, read and write files, etc., will need to enter the correct password each time before Windows boots. Optionally, creates a hidden system.",IDT_SYS_DEVICE,16,102,205,47
END
IDD_INFO_PAGE_DLG DIALOGEX 0, 0, 226, 172
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
- LTEXT "",IDC_BOX_HELP,0,10,225,137
+ LTEXT "",IDC_BOX_HELP,0,10,225,155
END
IDD_HIDVOL_HOST_FILL_PAGE_DLG DIALOGEX 0, 0, 226, 172
@@ -217,22 +217,22 @@ STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
CONTROL "Normal mode",IDC_HIDVOL_WIZ_MODE_FULL,"Button",BS_AUTORADIOBUTTON,0,7,217,10
- CONTROL "Direct mode",IDC_HIDVOL_WIZ_MODE_DIRECT,"Button",BS_AUTORADIOBUTTON,0,76,217,10
- LTEXT "",IDC_BOX_HELP,16,20,205,48
- LTEXT "",IDC_BOX_HELP2,16,89,205,50
+ CONTROL "Direct mode",IDC_HIDVOL_WIZ_MODE_DIRECT,"Button",BS_AUTORADIOBUTTON,0,87,217,10
+ LTEXT "",IDC_BOX_HELP,16,20,205,63
+ LTEXT "",IDC_BOX_HELP2,16,101,205,59
END
IDD_PASSWORD_ENTRY_PAGE_DLG DIALOGEX 0, 0, 226, 172
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
- EDITTEXT IDC_PASSWORD_DIRECT,50,2,149,14,ES_PASSWORD | ES_AUTOHSCROLL
- COMBOBOX IDC_PKCS5_PRF_ID,50,17,91,90,CBS_DROPDOWNLIST | WS_TABSTOP
+ EDITTEXT IDC_PASSWORD_DIRECT,50,2,173,14,ES_PASSWORD | ES_AUTOHSCROLL
+ COMBOBOX IDC_PKCS5_PRF_ID,50,17,104,90,CBS_DROPDOWNLIST | WS_TABSTOP
EDITTEXT IDC_PIM,50,32,42,14,ES_RIGHT | ES_PASSWORD | ES_AUTOHSCROLL | ES_NUMBER | NOT WS_VISIBLE
LTEXT "(Empty or 0 for default iterations)",IDC_PIM_HELP,96,34,127,8,NOT WS_VISIBLE
CONTROL "&Display password",IDC_SHOW_PASSWORD_SINGLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,50,46,84,11,WS_EX_TRANSPARENT
- CONTROL "U&se keyfiles",IDC_KEYFILES_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,50,57,82,11
- PUSHBUTTON "&Keyfiles...",IDC_KEY_FILES,142,54,64,14
+ CONTROL "U&se keyfiles",IDC_KEYFILES_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,50,57,94,11
+ PUSHBUTTON "&Keyfiles...",IDC_KEY_FILES,149,54,74,14
LTEXT "",IDC_BOX_HELP,0,74,225,94
RTEXT "Password:",IDT_PASSWORD,0,6,48,8
RTEXT "PKCS-5 PRF:",IDT_PKCS5_PRF,0,19,48,8
@@ -245,10 +245,10 @@ STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
CONTROL "Standard VeraCrypt volume",IDC_STD_VOL,"Button",BS_AUTORADIOBUTTON,0,7,212,10
- CONTROL "Hi&dden VeraCrypt volume ",IDC_HIDDEN_VOL,"Button",BS_AUTORADIOBUTTON,0,53,212,10
- LTEXT "More information about hidden volumes",IDC_HIDDEN_VOL_HELP,16,126,205,10,SS_NOTIFY
- LTEXT "",IDC_BOX_HELP_NORMAL_VOL,16,20,205,25
- LTEXT "",IDC_BOX_HELP,16,66,205,57
+ CONTROL "Hi&dden VeraCrypt volume ",IDC_HIDDEN_VOL,"Button",BS_AUTORADIOBUTTON,0,68,212,10
+ LTEXT "More information about hidden volumes",IDC_HIDDEN_VOL_HELP,16,151,205,10,SS_NOTIFY
+ LTEXT "",IDC_BOX_HELP_NORMAL_VOL,16,20,205,41
+ LTEXT "",IDC_BOX_HELP,16,83,205,62
END
IDD_SYSENC_SPAN_PAGE_DLG DIALOGEX 0, 0, 226, 172
@@ -316,7 +316,7 @@ FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
COMBOBOX IDC_WIPE_MODE,67,13,125,90,CBS_DROPDOWNLIST | WS_TABSTOP
PUSHBUTTON "&Pause",IDC_PAUSE,169,40,50,14
- LTEXT "More information",IDC_MORE_INFO_SYS_ENCRYPTION,1,141,202,10,SS_NOTIFY
+ LTEXT "More information",IDC_MORE_INFO_SYS_ENCRYPTION,1,150,202,10,SS_NOTIFY
LTEXT "",IDC_BYTESWRITTEN,29,58,39,11,SS_CENTERIMAGE,WS_EX_TRANSPARENT | WS_EX_RIGHT | WS_EX_STATICEDGE
RTEXT "",IDC_WRITESPEED,103,58,46,11,SS_CENTERIMAGE,WS_EX_TRANSPARENT | WS_EX_RIGHT | WS_EX_STATICEDGE
RTEXT "",IDC_TIMEREMAIN,177,58,42,11,SS_CENTERIMAGE,WS_EX_TRANSPARENT | WS_EX_RIGHT | WS_EX_STATICEDGE
@@ -325,7 +325,7 @@ BEGIN
RTEXT "Done",IDT_DONE,5,59,22,8
RTEXT "Status",IDT_STATUS,72,59,29,8
RTEXT "Left",IDT_LEFT,151,59,24,8
- LTEXT "",IDC_BOX_HELP,1,77,224,64
+ LTEXT "",IDC_BOX_HELP,1,77,224,70
GROUPBOX "Options",IDT_FORMAT_OPTIONS,0,3,225,29
GROUPBOX "",IDC_STATIC,0,32,225,41
END
@@ -377,8 +377,8 @@ IDD_SYSENC_HIDDEN_OS_REQ_CHECK_PAGE_DLG DIALOGEX 0, 0, 226, 172
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
- LTEXT "More information",IDC_HIDDEN_SYSENC_INFO_LINK,0,141,217,10,SS_NOTIFY
- LTEXT "",IDC_BOX_HELP,0,2,225,136
+ LTEXT "More information",IDC_HIDDEN_SYSENC_INFO_LINK,0,150,217,10,SS_NOTIFY
+ LTEXT "",IDC_BOX_HELP,0,2,225,142
END
IDD_DEVICE_WIPE_PAGE_DLG DIALOGEX 0, 0, 226, 172
@@ -394,7 +394,7 @@ BEGIN
RTEXT "Done",IDT_DONE,5,67,22,8
RTEXT "Pass",IDT_PASS,72,67,29,8,NOT WS_VISIBLE
RTEXT "Left",IDT_LEFT,151,67,24,8
- LTEXT "",IDC_BOX_HELP,1,86,224,64
+ LTEXT "",IDC_BOX_HELP,1,86,224,80
GROUPBOX "",IDT_FORMAT_OPTIONS,0,10,225,29
GROUPBOX "",IDC_STATIC,0,40,225,42
LTEXT "",IDC_WIPE_MODE,67,21,125,11,SS_CENTERIMAGE,WS_EX_TRANSPARENT | WS_EX_STATICEDGE
@@ -425,7 +425,7 @@ IDD_EXPANDED_LIST_SELECT_PAGE_DLG DIALOGEX 0, 0, 226, 172
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
- LTEXT "",IDC_BOX_HELP,0,107,225,41
+ LTEXT "",IDC_BOX_HELP,0,107,225,58
LISTBOX IDC_LIST_BOX,0,3,222,100,LBS_NOINTEGRALHEIGHT | LBS_DISABLENOSCROLL | WS_VSCROLL
END
@@ -433,7 +433,7 @@ IDD_DRIVE_LETTER_SELECTION_PAGE DIALOGEX 0, 0, 226, 172
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
- LTEXT "",IDC_BOX_HELP,0,40,225,95
+ LTEXT "",IDC_BOX_HELP,0,40,225,118
COMBOBOX IDC_DRIVE_LETTER_LIST,94,15,38,69,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
RTEXT "Drive letter:",IDT_DRIVE_LETTER,5,17,86,8
END
@@ -619,7 +619,7 @@ BEGIN
IDD_INPLACE_ENCRYPTION_PAGE_DLG, DIALOG
BEGIN
RIGHTMARGIN, 217
- BOTTOMMARGIN, 153
+ BOTTOMMARGIN, 166
HORZGUIDE, 80
HORZGUIDE, 96
END
@@ -665,7 +665,7 @@ BEGIN
IDD_DEVICE_WIPE_PAGE_DLG, DIALOG
BEGIN
RIGHTMARGIN, 217
- BOTTOMMARGIN, 153
+ BOTTOMMARGIN, 166
HORZGUIDE, 80
HORZGUIDE, 96
END
diff --git a/src/Mount/Favorites.cpp b/src/Mount/Favorites.cpp
index 825562f2..45883bc9 100644
--- a/src/Mount/Favorites.cpp
+++ b/src/Mount/Favorites.cpp
@@ -98,6 +98,7 @@ namespace VeraCrypt
favorite.SystemEncryption = prop.partitionInInactiveSysEncScope ? true : false;
favorite.OpenExplorerWindow = (bExplore == TRUE);
favorite.Pim = prop.volumePim;
+ memcpy (favorite.VolumeID, prop.volumeID, VOLUME_ID_SIZE);
if (favorite.VolumePathId.empty()
&& IsVolumeDeviceHosted (favorite.Path.c_str())
@@ -416,6 +417,19 @@ namespace VeraCrypt
case WM_CLOSE:
EndDialog (hwndDlg, IDCLOSE);
return 1;
+ case WM_CTLCOLORSTATIC:
+ {
+ HDC hdc = (HDC) wParam;
+ HWND hw = (HWND) lParam;
+ if (hw == 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;
+ }
+ }
+ break;
}
return 0;
@@ -566,6 +580,17 @@ namespace VeraCrypt
favorite.Path = Utf8StringToWide (volume);
char label[1024];
+
+ XmlGetAttributeText (xml, "ID", label, sizeof (label));
+ if (strlen (label) == (2*VOLUME_ID_SIZE))
+ {
+ std::vector<byte> arr;
+ if (HexWideStringToArray (Utf8StringToWide (label).c_str(), arr) && arr.size() == VOLUME_ID_SIZE)
+ {
+ memcpy (favorite.VolumeID, &arr[0], VOLUME_ID_SIZE);
+ }
+ }
+
XmlGetAttributeText (xml, "label", label, sizeof (label));
favorite.Label = Utf8StringToWide (label);
@@ -612,6 +637,10 @@ namespace VeraCrypt
if (boolVal[0])
favorite.UseLabelInExplorer = (boolVal[0] == '1') && !favorite.ReadOnly;
+ XmlGetAttributeText (xml, "useVolumeID", boolVal, sizeof (boolVal));
+ if (boolVal[0])
+ favorite.UseVolumeID = (boolVal[0] == '1') && !IsRepeatedByteArray (0, favorite.VolumeID, sizeof (favorite.VolumeID));
+
if (favorite.Path.find (L"\\\\?\\Volume{") == 0 && favorite.Path.rfind (L"}\\") == favorite.Path.size() - 2)
{
wstring resolvedPath = VolumeGuidPathToDevicePath (favorite.Path);
@@ -709,6 +738,9 @@ namespace VeraCrypt
wstring s = L"\n\t\t<volume mountpoint=\"" + favorite.MountPoint + L"\"";
+ if (!IsRepeatedByteArray (0, favorite.VolumeID, sizeof (favorite.VolumeID)))
+ s += L" ID=\"" + ArrayToHexWideString (favorite.VolumeID, sizeof (favorite.VolumeID)) + L"\"";
+
if (!favorite.Label.empty())
s += L" label=\"" + favorite.Label + L"\"";
@@ -739,6 +771,9 @@ 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\"";
+
s += L">" + wstring (tq) + L"</volume>";
fwprintf (f, L"%ws", s.c_str());
@@ -805,6 +840,7 @@ namespace VeraCrypt
static void SetControls (HWND hwndDlg, const FavoriteVolume &favorite, bool systemFavoritesMode, bool enable)
{
+ BOOL bIsDevice = favorite.DisconnectedDevice || IsVolumeDeviceHosted (favorite.Path.c_str()) || !enable;
if (favorite.Pim > 0)
{
wchar_t szTmp[MAX_PIM + 1];
@@ -819,6 +855,14 @@ 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);
+
+ if (IsRepeatedByteArray (0, favorite.VolumeID, sizeof (favorite.VolumeID)) || !bIsDevice)
+ {
+ SetDlgItemText (hwndDlg, IDC_FAVORITE_VOLUME_ID, L"");
+ }
+ else
+ SetDlgItemText (hwndDlg, IDC_FAVORITE_VOLUME_ID, ArrayToHexWideString (favorite.VolumeID, sizeof (favorite.VolumeID)).c_str());
if (systemFavoritesMode)
{
@@ -852,6 +896,44 @@ namespace VeraCrypt
EnableWindow (GetDlgItem (hwndDlg, IDC_FAVORITE_MOUNT_REMOVABLE), enable);
EnableWindow (GetDlgItem (hwndDlg, IDC_FAVORITE_OPEN_EXPLORER_WIN_ON_MOUNT), enable || systemFavoritesMode);
EnableWindow (GetDlgItem (hwndDlg, IDC_FAVORITE_DISABLE_HOTKEY), enable || systemFavoritesMode);
+ EnableWindow (GetDlgItem (hwndDlg, IDT_VOLUME_ID), enable && bIsDevice);
+ EnableWindow (GetDlgItem (hwndDlg, IDC_FAVORITE_VOLUME_ID), enable && bIsDevice);
+ EnableWindow (GetDlgItem (hwndDlg, IDC_FAVORITE_USE_VOLUME_ID), enable && bIsDevice && !IsRepeatedByteArray (0, favorite.VolumeID, sizeof (favorite.VolumeID)));
+
+ ShowWindow (GetDlgItem (hwndDlg, IDT_VOLUME_ID), bIsDevice? SW_SHOW : SW_HIDE);
+ ShowWindow (GetDlgItem (hwndDlg, IDC_FAVORITE_VOLUME_ID), bIsDevice? SW_SHOW : SW_HIDE);
+ ShowWindow (GetDlgItem (hwndDlg, IDC_FAVORITE_USE_VOLUME_ID), bIsDevice? SW_SHOW : SW_HIDE);
+
+ // Group box
+ RECT boxRect, checkRect, labelRect;
+
+ GetWindowRect (GetDlgItem (hwndDlg, IDC_FAV_VOL_OPTIONS_GROUP_BOX), &boxRect);
+ GetWindowRect (GetDlgItem (hwndDlg, IDC_FAVORITE_USE_VOLUME_ID), &checkRect);
+ GetWindowRect (GetDlgItem (hwndDlg, IDT_VOLUME_ID), &labelRect);
+
+ if (!bIsDevice && (boxRect.top < checkRect.top))
+ {
+ POINT pt = {boxRect.left, checkRect.bottom};
+ ScreenToClient (hwndDlg, &pt);
+ SetWindowPos (GetDlgItem (hwndDlg, IDC_FAV_VOL_OPTIONS_GROUP_BOX), 0, pt.x, pt.y,
+ boxRect.right - boxRect.left,
+ boxRect.bottom - checkRect.bottom,
+ SWP_NOZORDER);
+
+ InvalidateRect (GetDlgItem (hwndDlg, IDC_FAV_VOL_OPTIONS_GROUP_BOX), NULL, TRUE);
+ }
+
+ if (bIsDevice && (boxRect.top >= checkRect.top))
+ {
+ POINT pt = {boxRect.left, labelRect.top - CompensateYDPI (10)};
+ ScreenToClient (hwndDlg, &pt);
+ SetWindowPos (GetDlgItem (hwndDlg, IDC_FAV_VOL_OPTIONS_GROUP_BOX), 0, pt.x, pt.y,
+ boxRect.right - boxRect.left,
+ boxRect.bottom - labelRect.top + CompensateYDPI (10),
+ SWP_NOZORDER);
+
+ InvalidateRect (GetDlgItem (hwndDlg, IDC_FAV_VOL_OPTIONS_GROUP_BOX), NULL, TRUE);
+ }
}
@@ -873,6 +955,7 @@ namespace VeraCrypt
favorite.Pim = GetPim (hwndDlg, IDC_PIM);
favorite.UseLabelInExplorer = (IsDlgButtonChecked (hwndDlg, IDC_FAVORITE_USE_LABEL_IN_EXPLORER) != 0);
+ favorite.UseVolumeID = (IsDlgButtonChecked (hwndDlg, IDC_FAVORITE_USE_VOLUME_ID) != 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 8195eb7b..84ab2a25 100644
--- a/src/Mount/Favorites.h
+++ b/src/Mount/Favorites.h
@@ -30,8 +30,10 @@ namespace VeraCrypt
ReadOnly (false),
Removable (false),
SystemEncryption (false),
- UseLabelInExplorer (false)
+ UseLabelInExplorer (false),
+ UseVolumeID (false)
{
+ memset (VolumeID, 0, VOLUME_ID_SIZE);
}
wstring Path;
@@ -39,6 +41,7 @@ namespace VeraCrypt
wstring VolumePathId;
wstring Label;
int Pim;
+ BYTE VolumeID[VOLUME_ID_SIZE];
bool DisableHotkeyMount;
bool DisconnectedDevice;
@@ -49,6 +52,7 @@ namespace VeraCrypt
bool Removable;
bool SystemEncryption;
bool UseLabelInExplorer;
+ bool UseVolumeID;
};
struct FavoriteVolumesDlgProcArguments
diff --git a/src/Mount/Mount.c b/src/Mount/Mount.c
index fbf631f8..1851af06 100644
--- a/src/Mount/Mount.c
+++ b/src/Mount/Mount.c
@@ -1900,6 +1900,7 @@ typedef struct
{
BOOL bRequireConfirmation;
wchar_t *lpszVolume;
+ size_t cchVolume;
int* iResult;
} BackupHeaderThreadParam;
@@ -1907,10 +1908,15 @@ void CALLBACK BackupHeaderWaitThreadProc(void* pArg, HWND hwndDlg)
{
BackupHeaderThreadParam* pThreadParam = (BackupHeaderThreadParam*) pArg;
- if (!IsAdmin () && IsUacSupported () && IsVolumeDeviceHosted (pThreadParam->lpszVolume))
- *(pThreadParam->iResult) = UacBackupVolumeHeader (hwndDlg, pThreadParam->bRequireConfirmation, pThreadParam->lpszVolume);
+ if (TranslateVolumeID (hwndDlg, pThreadParam->lpszVolume, pThreadParam->cchVolume))
+ {
+ if (!IsAdmin () && IsUacSupported () && IsVolumeDeviceHosted (pThreadParam->lpszVolume))
+ *(pThreadParam->iResult) = UacBackupVolumeHeader (hwndDlg, pThreadParam->bRequireConfirmation, pThreadParam->lpszVolume);
+ else
+ *(pThreadParam->iResult) = BackupVolumeHeader (hwndDlg, pThreadParam->bRequireConfirmation, pThreadParam->lpszVolume);
+ }
else
- *(pThreadParam->iResult) = BackupVolumeHeader (hwndDlg, pThreadParam->bRequireConfirmation, pThreadParam->lpszVolume);
+ *(pThreadParam->iResult) = ERR_OS_ERROR;
}
// implementation for support of restoring header operation in wait dialog mechanism
@@ -1918,6 +1924,7 @@ void CALLBACK BackupHeaderWaitThreadProc(void* pArg, HWND hwndDlg)
typedef struct
{
wchar_t *lpszVolume;
+ size_t cchVolume;
int* iResult;
} RestoreHeaderThreadParam;
@@ -1925,10 +1932,15 @@ void CALLBACK RestoreHeaderWaitThreadProc(void* pArg, HWND hwndDlg)
{
RestoreHeaderThreadParam* pThreadParam = (RestoreHeaderThreadParam*) pArg;
- if (!IsAdmin () && IsUacSupported () && IsVolumeDeviceHosted (pThreadParam->lpszVolume))
- *(pThreadParam->iResult) = UacRestoreVolumeHeader (hwndDlg, pThreadParam->lpszVolume);
+ if (TranslateVolumeID (hwndDlg, pThreadParam->lpszVolume, pThreadParam->cchVolume))
+ {
+ if (!IsAdmin () && IsUacSupported () && IsVolumeDeviceHosted (pThreadParam->lpszVolume))
+ *(pThreadParam->iResult) = UacRestoreVolumeHeader (hwndDlg, pThreadParam->lpszVolume);
+ else
+ *(pThreadParam->iResult) = RestoreVolumeHeader (hwndDlg, pThreadParam->lpszVolume);
+ }
else
- *(pThreadParam->iResult) = RestoreVolumeHeader (hwndDlg, pThreadParam->lpszVolume);
+ *(pThreadParam->iResult) = ERR_OS_ERROR;
}
/* Except in response to the WM_INITDIALOG message, the dialog box procedure
@@ -3584,6 +3596,60 @@ int GetModeOfOperationByDriveNo (int nDosDriveNo)
return 0;
}
+void DisplayVolumePropertiesListContextMenu (HWND hwndDlg, LPARAM lParam)
+{
+ /* Volume Properties list context menu */
+ DWORD mPos;
+ int menuItem;
+ HWND hList = GetDlgItem (hwndDlg, IDC_VOLUME_PROPERTIES_LIST);
+ int hItem = ListView_GetSelectionMark (hList);
+
+ SetFocus (hList);
+
+ if (hItem >= 0)
+ {
+ HMENU popup = CreatePopupMenu ();
+ AppendMenuW (popup, MF_STRING, IDPM_COPY_VALUE_TO_CLIPBOARD, GetString ("IDPM_COPY_VALUE_TO_CLIPBOARD"));
+
+ if (lParam)
+ {
+ mPos=GetMessagePos();
+ }
+ else
+ {
+ POINT pt = {0};
+ if (ListView_GetItemPosition (hList, hItem, &pt))
+ {
+ pt.x += 2 + ::GetSystemMetrics(SM_CXICON);
+ pt.y += 2;
+ }
+ ClientToScreen (hList, &pt);
+ mPos = MAKELONG (pt.x, pt.y);
+ }
+
+ menuItem = TrackPopupMenu (popup,
+ TPM_RETURNCMD | TPM_LEFTBUTTON,
+ GET_X_LPARAM(mPos),
+ GET_Y_LPARAM(mPos),
+ 0,
+ hwndDlg,
+ NULL);
+
+ DestroyMenu (popup);
+
+ switch (menuItem)
+ {
+ case IDPM_COPY_VALUE_TO_CLIPBOARD:
+ {
+ wchar_t valueText[256] = {0};
+ ListView_GetItemText (hList, hItem, 1, valueText, ARRAYSIZE (valueText));
+ CopyTextToClipboard (valueText);
+ }
+ break;
+ }
+ }
+}
+
BOOL CALLBACK VolumePropertiesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
@@ -3701,6 +3767,16 @@ BOOL CALLBACK VolumePropertiesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LP
else
ListSubItemSet (list, i++, 1, (wchar_t *) (prop.wszVolume[1] != L'?' ? prop.wszVolume : prop.wszVolume + 4));
+ 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));
+ ListItemAdd (list, i, GetString ("VOLUME_ID"));
+
+ ListSubItemSet (list, i++, 1, hexID.c_str());
+ }
+
+
// Size
ListItemAdd (list, i, GetString ("SIZE"));
StringCbPrintfW (sw, sizeof(sw), L"%I64u %s", prop.diskLength, GetString ("BYTES"));
@@ -3901,6 +3977,44 @@ BOOL CALLBACK VolumePropertiesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LP
return 0;
}
+ case WM_NOTIFY:
+
+ if(wParam == IDC_VOLUME_PROPERTIES_LIST)
+ {
+ /* Right click */
+
+ switch (((NM_LISTVIEW *) lParam)->hdr.code)
+ {
+ case NM_RCLICK:
+ case LVN_BEGINRDRAG:
+ /* If the mouse was moving while the right mouse button is pressed, popup menu would
+ not open, because drag&drop operation would be initiated. Therefore, we're handling
+ RMB drag-and-drop operations as well. */
+ {
+
+ DisplayVolumePropertiesListContextMenu (hwndDlg, lParam);
+
+ return 1;
+ }
+ }
+ }
+ return 0;
+
+ case WM_CONTEXTMENU:
+ {
+ HWND hList = GetDlgItem (hwndDlg, IDC_VOLUME_PROPERTIES_LIST);
+ // only handle if it is coming from keyboard and if the drive
+ // list has focus. The other cases are handled elsewhere
+ if ( (-1 == GET_X_LPARAM(lParam))
+ && (-1 == GET_Y_LPARAM(lParam))
+ && (GetFocus () == hList)
+ )
+ {
+ DisplayVolumePropertiesListContextMenu (hwndDlg, NULL);
+ }
+ }
+ return 0;
+
case WM_COMMAND:
if (lw == IDOK)
{
@@ -4442,15 +4556,24 @@ static BOOL Mount (HWND hwndDlg, int nDosDriveNo, wchar_t *szFileName, int pim)
if (szFileName == NULL)
{
GetVolumePath (hwndDlg, fileName, ARRAYSIZE (fileName));
- szFileName = fileName;
}
+ else
+ StringCchCopyW (fileName, ARRAYSIZE (fileName), szFileName);
- if (wcslen(szFileName) == 0)
+ if (wcslen(fileName) == 0)
{
status = FALSE;
goto ret;
}
+ if (!TranslateVolumeID (hwndDlg, fileName, ARRAYSIZE (fileName)))
+ {
+ status = FALSE;
+ goto ret;
+ }
+
+ szFileName = fileName;
+
if (IsMountedVolume (szFileName))
{
Warning ("VOL_ALREADY_MOUNTED", hwndDlg);
@@ -4952,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)
{
@@ -4961,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
@@ -5129,6 +5281,12 @@ static void ChangePassword (HWND hwndDlg)
int newPimValue = -1;
GetVolumePath (hwndDlg, szFileName, ARRAYSIZE (szFileName));
+
+ if (!TranslateVolumeID (hwndDlg, szFileName, ARRAYSIZE (szFileName)))
+ {
+ return;
+ }
+
if (IsMountedVolume (szFileName))
{
Warning (pwdChangeDlgMode == PCDM_CHANGE_PKCS5_PRF ? "MOUNTED_NO_PKCS5_PRF_CHANGE" : "MOUNTED_NOPWCHANGE", hwndDlg);
@@ -6309,7 +6467,11 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
exitCode = 1;
}
- if (szFileName[0] != 0 && !IsMountedVolume (szFileName))
+ if (szFileName[0] != 0 && !TranslateVolumeID (hwndDlg, szFileName, ARRAYSIZE (szFileName)))
+ {
+ exitCode = 1;
+ }
+ else if (szFileName[0] != 0 && !IsMountedVolume (szFileName))
{
BOOL mounted = FALSE;
int EffectiveVolumePkcs5 = CmdVolumePkcs5;
@@ -6547,6 +6709,8 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
taskBarCreatedMsg = RegisterWindowMessage (L"TaskbarCreated");
+ AllowMessageInUIPI (taskBarCreatedMsg);
+
SetFocus (GetDlgItem (hwndDlg, IDC_DRIVELIST));
/* Check system encryption status */
@@ -6757,7 +6921,21 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
foreach (FavoriteVolume favorite, FavoritesOnArrivalMountRequired)
{
- if (!favorite.VolumePathId.empty())
+ if (favorite.UseVolumeID)
+ {
+ if (IsMountedVolumeID (favorite.VolumeID))
+ continue;
+
+ std::wstring volDevPath = FindDeviceByVolumeID (favorite.VolumeID);
+ if (volDevPath.length() > 0)
+ {
+ favorite.Path = volDevPath;
+ favorite.DisconnectedDevice = false;
+ }
+ else
+ continue;
+ }
+ else if (!favorite.VolumePathId.empty())
{
if (IsMountedVolume (favorite.Path.c_str()))
continue;
@@ -6833,6 +7011,16 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
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;
}
@@ -7063,7 +7251,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
{
OPEN_TEST_STRUCT ots = {0};
- if (!OpenDevice (vol, &ots, FALSE))
+ if (!OpenDevice (vol, &ots, FALSE, FALSE, NULL))
{
UnmountVolume (hwndDlg, m, TRUE);
WarningBalloon ("HOST_DEVICE_REMOVAL_DISMOUNT_WARN_TITLE", "HOST_DEVICE_REMOVAL_DISMOUNT_WARN", hwndDlg);
@@ -7410,6 +7598,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
BackupHeaderThreadParam threadParam;
threadParam.bRequireConfirmation = TRUE;
threadParam.lpszVolume = volPath;
+ threadParam.cchVolume = ARRAYSIZE (volPath);
threadParam.iResult = &iStatus;
ShowWaitDialog (hwndDlg, TRUE, BackupHeaderWaitThreadProc, &threadParam);
@@ -7432,6 +7621,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
int iStatus = 0;
RestoreHeaderThreadParam threadParam;
threadParam.lpszVolume = volPath;
+ threadParam.cchVolume = ARRAYSIZE (volPath);
threadParam.iResult = &iStatus;
ShowWaitDialog(hwndDlg, TRUE, RestoreHeaderWaitThreadProc, &threadParam);
@@ -7715,6 +7905,8 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
if (VolumeSelected (hwndDlg)
&& IsMountedVolume (volPathLower))
{
+ TranslateVolumeID (hwndDlg, volPathLower, ARRAYSIZE (volPathLower));
+
if (LOWORD (selectedDrive) != TC_MLIST_ITEM_NONSYS_VOL)
{
driveNo = GetMountedVolumeDriveNo (volPathLower);
@@ -7850,6 +8042,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
BackupHeaderThreadParam threadParam;
threadParam.bRequireConfirmation = TRUE;
threadParam.lpszVolume = volPath;
+ threadParam.cchVolume = ARRAYSIZE (volPath);
threadParam.iResult = &iStatus;
ShowWaitDialog (hwndDlg, TRUE, BackupHeaderWaitThreadProc, &threadParam);
@@ -7876,6 +8069,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
int iStatus = 0;
RestoreHeaderThreadParam threadParam;
threadParam.lpszVolume = volPath;
+ threadParam.cchVolume = ARRAYSIZE (volPath);
threadParam.iResult = &iStatus;
ShowWaitDialog(hwndDlg, TRUE, RestoreHeaderWaitThreadProc, &threadParam);
@@ -8003,9 +8197,16 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
if (favoriteIndex < FavoriteVolumes.size())
{
- if (IsMountedVolume (FavoriteVolumes[favoriteIndex].Path.c_str()))
+ if ((FavoriteVolumes[favoriteIndex].UseVolumeID && IsMountedVolumeID (FavoriteVolumes[favoriteIndex].VolumeID))
+ || (!FavoriteVolumes[favoriteIndex].UseVolumeID && IsMountedVolume (FavoriteVolumes[favoriteIndex].Path.c_str()))
+ )
{
+ std::wstring volName;
WaitCursor();
+ if (FavoriteVolumes[favoriteIndex].UseVolumeID)
+ volName = FindDeviceByVolumeID (FavoriteVolumes[favoriteIndex].VolumeID);
+ else
+ volName = FavoriteVolumes[favoriteIndex].Path;
OpenVolumeExplorerWindow (GetMountedVolumeDriveNo ((wchar_t*) FavoriteVolumes[favoriteIndex].Path.c_str()));
NormalCursor();
}
@@ -8646,6 +8847,7 @@ static BOOL StartSystemFavoritesService ()
ServiceMode = TRUE;
Silent = TRUE;
DeviceChangeBroadcastDisabled = TRUE;
+ bShowDisconnectedNetworkDrives = TRUE;
InitOSVersionInfo();
@@ -8897,6 +9099,7 @@ static BOOL MountFavoriteVolumeBase (HWND hwnd, const FavoriteVolume &favorite,
{
BOOL status = TRUE;
int drive;
+ std::wstring effectiveVolumePath;
drive = towupper (favorite.MountPoint[0]) - L'A';
if ((drive < MIN_MOUNTED_VOLUME_DRIVE_NUMBER) || (drive > MAX_MOUNTED_VOLUME_DRIVE_NUMBER))
@@ -8917,6 +9120,13 @@ static BOOL MountFavoriteVolumeBase (HWND hwnd, const FavoriteVolume &favorite,
else
ZeroMemory (mountOptions.Label, sizeof (mountOptions.Label));
+ if (favorite.UseVolumeID && !IsRepeatedByteArray (0, favorite.VolumeID, sizeof (favorite.VolumeID)))
+ {
+ effectiveVolumePath = FindDeviceByVolumeID (favorite.VolumeID);
+ }
+ else
+ effectiveVolumePath = favorite.Path;
+
if (favorite.SystemEncryption)
{
mountOptions.PartitionInInactiveSysEncScope = TRUE;
@@ -8974,9 +9184,9 @@ static BOOL MountFavoriteVolumeBase (HWND hwnd, const FavoriteVolume &favorite,
BOOL prevReadOnly = mountOptions.ReadOnly;
if (ServiceMode)
- SystemFavoritesServiceLogInfo (wstring (L"Mounting system favorite \"") + favorite.Path + L"\"");
+ SystemFavoritesServiceLogInfo (wstring (L"Mounting system favorite \"") + effectiveVolumePath + L"\"");
- status = Mount (hwnd, drive, (wchar_t *) favorite.Path.c_str(), favorite.Pim);
+ status = Mount (hwnd, drive, (wchar_t *) effectiveVolumePath.c_str(), favorite.Pim);
if (ServiceMode)
{
@@ -8986,11 +9196,11 @@ static BOOL MountFavoriteVolumeBase (HWND hwnd, const FavoriteVolume &favorite,
if (status)
{
- SystemFavoritesServiceLogInfo (wstring (L"Favorite \"") + favorite.Path + wstring (L"\" mounted successfully as ") + (wchar_t) (drive + L'A') + L":");
+ SystemFavoritesServiceLogInfo (wstring (L"Favorite \"") + effectiveVolumePath + wstring (L"\" mounted successfully as ") + (wchar_t) (drive + L'A') + L":");
}
else
{
- SystemFavoritesServiceLogError (wstring (L"Favorite \"") + favorite.Path + L"\" failed to mount");
+ SystemFavoritesServiceLogError (wstring (L"Favorite \"") + effectiveVolumePath + L"\" failed to mount");
}
}
@@ -9031,7 +9241,7 @@ skipMount:
Error ("DRIVE_LETTER_UNAVAILABLE", MainDlg);
else if (ServiceMode && systemFavorites)
{
- SystemFavoritesServiceLogError (wstring (L"The drive letter ") + (wchar_t) (drive + L'A') + wstring (L" used by favorite \"") + favorite.Path + L"\" is already taken.\nThis system favorite will not be mounted");
+ SystemFavoritesServiceLogError (wstring (L"The drive letter ") + (wchar_t) (drive + L'A') + wstring (L" used by favorite \"") + effectiveVolumePath + L"\" is already taken.\nThis system favorite will not be mounted");
}
return status;
@@ -9071,6 +9281,26 @@ BOOL MountFavoriteVolumes (HWND hwnd, BOOL systemFavorites, BOOL logOnMount, BOO
wchar_t szTmp[32];
StringCbPrintf (szTmp, sizeof(szTmp), L"%d", (int) favorites.size());
SystemFavoritesServiceLogInfo (wstring (L"Loaded ") + szTmp + wstring (L" favorites from the file"));
+
+ /* correct set the connected state of the system favorites */
+ for (vector <FavoriteVolume>::iterator favorite = favorites.begin();
+ favorite != favorites.end(); favorite++)
+ {
+ if (favorite->UseVolumeID)
+ {
+ std::wstring path = FindDeviceByVolumeID (favorite->VolumeID);
+ if (path.empty ())
+ {
+ favorite->DisconnectedDevice = true;
+ }
+ else
+ {
+ favorite->DisconnectedDevice = false;
+ favorite->Path = path;
+ favorite->UseVolumeID = false; /* force the use of real path to avoid calling FindDeviceByVolumeID again */
+ }
+ }
+ }
}
}
catch (...)
@@ -9090,7 +9320,10 @@ BOOL MountFavoriteVolumes (HWND hwnd, BOOL systemFavorites, BOOL logOnMount, BOO
if (ServiceMode && systemFavorites && favorite.DisconnectedDevice)
{
skippedSystemFavorites.push_back (favorite);
- SystemFavoritesServiceLogWarning (wstring (L"Favorite \"") + favorite.Path + L"\" is disconnected. It will be ignored.");
+ if (favorite.UseVolumeID)
+ SystemFavoritesServiceLogWarning (wstring (L"Favorite \"ID:") + ArrayToHexWideString (favorite.VolumeID, sizeof (favorite.VolumeID)) + L"\" is disconnected. It will be ignored.");
+ else
+ SystemFavoritesServiceLogWarning (wstring (L"Favorite \"") + favorite.Path + L"\" is disconnected. It will be ignored.");
}
if (favorite.DisconnectedDevice
@@ -9127,7 +9360,13 @@ BOOL MountFavoriteVolumes (HWND hwnd, BOOL systemFavorites, BOOL logOnMount, BOO
if (favorite->DisconnectedDevice)
{
// check if the favorite is here and get its path
- wstring resolvedPath = VolumeGuidPathToDevicePath (favorite->Path);
+ wstring resolvedPath;
+ if (favorite->UseVolumeID)
+ {
+ resolvedPath = FindDeviceByVolumeID (favorite->VolumeID);
+ }
+ else
+ resolvedPath = VolumeGuidPathToDevicePath (favorite->Path);
if (!resolvedPath.empty())
{
favorite->DisconnectedDevice = false;
@@ -9137,7 +9376,10 @@ BOOL MountFavoriteVolumes (HWND hwnd, BOOL systemFavorites, BOOL logOnMount, BOO
remainingFavorites--;
// favorite OK.
- SystemFavoritesServiceLogInfo (wstring (L"Favorite \"") + favorite->VolumePathId + L"\" is connected. Performing mount.");
+ if (favorite->UseVolumeID)
+ SystemFavoritesServiceLogInfo (wstring (L"Favorite \"ID:") + ArrayToHexWideString (favorite->VolumeID, sizeof (favorite->VolumeID)) + L"\" is connected. Performing mount.");
+ else
+ SystemFavoritesServiceLogInfo (wstring (L"Favorite \"") + favorite->VolumePathId + L"\" is connected. Performing mount.");
status = MountFavoriteVolumeBase (hwnd, *favorite, lastbExplore, userForcedReadOnly, systemFavorites, logOnMount, hotKeyMount, favoriteVolumeToMount);
if (!status)
@@ -10146,9 +10388,11 @@ static BOOL CALLBACK PerformanceSettingsDlgProc (HWND hwndDlg, UINT msg, WPARAM
try
{
+ VOLUME_PROPERTIES_STRUCT prop;
try
{
BootEncStatus = BootEncObj->GetStatus();
+ BootEncObj->GetVolumeProperties (&prop);
}
catch (...)
{
@@ -10171,7 +10415,7 @@ static BOOL CALLBACK PerformanceSettingsDlgProc (HWND hwndDlg, UINT msg, WPARAM
else
userConfig &= ~TC_BOOT_USER_CFG_FLAG_DISABLE_HW_ENCRYPTION;
- BootEncObj->WriteBootSectorUserConfig (userConfig, customUserMessage);
+ BootEncObj->WriteBootSectorUserConfig (userConfig, customUserMessage, prop.volumePim);
}
SetDriverConfigurationFlag (TC_DRIVER_CONFIG_DISABLE_HARDWARE_ENCRYPTION, disableHW);
@@ -10511,6 +10755,7 @@ static BOOL CALLBACK BootLoaderPreferencesDlgProc (HWND hwndDlg, UINT msg, WPARA
SendMessage (GetDlgItem (hwndDlg, IDC_CUSTOM_BOOT_LOADER_MESSAGE), EM_LIMITTEXT, TC_BOOT_SECTOR_USER_MESSAGE_MAX_LENGTH, 0);
SetDlgItemTextA (hwndDlg, IDC_CUSTOM_BOOT_LOADER_MESSAGE, customUserMessage.c_str());
+ CheckDlgButton (hwndDlg, IDC_DISABLE_BOOT_LOADER_PIM_PROMPT, (userConfig & TC_BOOT_USER_CFG_FLAG_DISABLE_PIM) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton (hwndDlg, IDC_DISABLE_BOOT_LOADER_OUTPUT, (userConfig & TC_BOOT_USER_CFG_FLAG_SILENT_MODE) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton (hwndDlg, IDC_ALLOW_ESC_PBA_BYPASS, (userConfig & TC_BOOT_USER_CFG_FLAG_DISABLE_ESC) ? BST_UNCHECKED : BST_CHECKED);
CheckDlgButton (hwndDlg, IDC_BOOT_LOADER_CACHE_PASSWORD, bPasswordCacheEnabled ? BST_CHECKED : BST_UNCHECKED);
@@ -10539,12 +10784,25 @@ static BOOL CALLBACK BootLoaderPreferencesDlgProc (HWND hwndDlg, UINT msg, WPARA
case IDOK:
{
+ VOLUME_PROPERTIES_STRUCT prop;
+
if (!BootEncObj->GetStatus().DriveMounted)
{
EndDialog (hwndDlg, IDCANCEL);
return 1;
}
+ try
+ {
+ BootEncObj->GetVolumeProperties (&prop);
+ }
+ catch (Exception &e)
+ {
+ e.Show (hwndDlg);
+ EndDialog (hwndDlg, IDCANCEL);
+ return 1;
+ }
+
char customUserMessage[TC_BOOT_SECTOR_USER_MESSAGE_MAX_LENGTH + 1];
GetDlgItemTextA (hwndDlg, IDC_CUSTOM_BOOT_LOADER_MESSAGE, customUserMessage, sizeof (customUserMessage));
@@ -10559,6 +10817,11 @@ static BOOL CALLBACK BootLoaderPreferencesDlgProc (HWND hwndDlg, UINT msg, WPARA
return 1;
}
+ 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 (IsDlgButtonChecked (hwndDlg, IDC_DISABLE_BOOT_LOADER_OUTPUT))
userConfig |= TC_BOOT_USER_CFG_FLAG_SILENT_MODE;
else
@@ -10573,7 +10836,7 @@ static BOOL CALLBACK BootLoaderPreferencesDlgProc (HWND hwndDlg, UINT msg, WPARA
{
BOOL bPasswordCacheEnabled = IsDlgButtonChecked (hwndDlg, IDC_BOOT_LOADER_CACHE_PASSWORD);
BOOL bPimCacheEnabled = IsDlgButtonChecked (hwndDlg, IDC_BOOT_LOADER_CACHE_PIM);
- BootEncObj->WriteBootSectorUserConfig (userConfig, customUserMessage);
+ BootEncObj->WriteBootSectorUserConfig (userConfig, customUserMessage, prop.volumePim);
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));
@@ -10588,6 +10851,13 @@ static BOOL CALLBACK BootLoaderPreferencesDlgProc (HWND hwndDlg, UINT msg, WPARA
return 1;
}
+ case IDC_DISABLE_BOOT_LOADER_PIM_PROMPT:
+ if ((IsDlgButtonChecked (hwndDlg, IDC_DISABLE_BOOT_LOADER_PIM_PROMPT))
+ && AskWarnYesNo ("DISABLE_BOOT_LOADER_PIM_PROMPT", hwndDlg) == IDNO)
+ {
+ CheckDlgButton (hwndDlg, IDC_DISABLE_BOOT_LOADER_PIM_PROMPT, BST_UNCHECKED);
+ }
+
case IDC_DISABLE_BOOT_LOADER_OUTPUT:
if ((IsDlgButtonChecked (hwndDlg, IDC_DISABLE_BOOT_LOADER_OUTPUT))
&& AskWarnYesNo ("CUSTOM_BOOT_LOADER_MESSAGE_PROMPT", hwndDlg) == IDNO)
diff --git a/src/Mount/Mount.rc b/src/Mount/Mount.rc
index f7f927e3..96bb95c4 100644
--- a/src/Mount/Mount.rc
+++ b/src/Mount/Mount.rc
@@ -95,7 +95,7 @@ BEGIN
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
+ LTEXT "Dismount all when:",IDT_AUTO_DISMOUNT_ON,9,104,71,20
GROUPBOX "Password Cache",IDT_PW_CACHE_OPTIONS,4,227,328,68
GROUPBOX "Actions to perform upon logon to Windows",IDT_LOGON,4,63,328,28
END
@@ -109,43 +109,43 @@ BEGIN
CONTROL "",IDC_VOLUME_PROPERTIES_LIST,"SysListView32",LVS_REPORT | LVS_ALIGNLEFT | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,6,269,192
END
-IDD_PASSWORDCHANGE_DLG DIALOGEX 0, 0, 330, 245
+IDD_PASSWORDCHANGE_DLG DIALOGEX 0, 0, 346, 245
STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Change Password or Keyfiles"
CLASS "VeraCryptCustomDlg"
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
- EDITTEXT IDC_OLD_PASSWORD,89,14,162,13,ES_PASSWORD | ES_AUTOHSCROLL
- COMBOBOX IDC_PKCS5_OLD_PRF_ID,89,33,85,90,CBS_DROPDOWNLIST | WS_TABSTOP
- CONTROL "TrueCrypt Mode",IDC_TRUECRYPT_MODE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,179,35,78,10
+ 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,97,10
- CONTROL "Use keyfiles",IDC_ENABLE_KEYFILES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,89,72,98,10
- PUSHBUTTON "Keyfiles...",IDC_KEYFILES,192,70,59,14
+ 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
CONTROL "Display password",IDC_SHOW_PASSWORD_CHPWD_ORI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,89,85,138,10,WS_EX_TRANSPARENT
- EDITTEXT IDC_PASSWORD,89,121,162,13,ES_PASSWORD | ES_AUTOHSCROLL
- EDITTEXT IDC_VERIFY,89,137,162,13,ES_PASSWORD | ES_AUTOHSCROLL
+ EDITTEXT IDC_PASSWORD,89,121,181,13,ES_PASSWORD | ES_AUTOHSCROLL
+ EDITTEXT IDC_VERIFY,89,137,181,13,ES_PASSWORD | ES_AUTOHSCROLL
EDITTEXT IDC_PIM,89,154,42,14,ES_RIGHT | ES_PASSWORD | ES_AUTOHSCROLL | ES_NUMBER | NOT WS_VISIBLE
CONTROL "Use PIM",IDC_NEW_PIM_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,89,161,97,10
- CONTROL "Use keyfiles",IDC_ENABLE_NEW_KEYFILES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,89,172,99,11
- PUSHBUTTON "Keyfiles...",IDC_NEW_KEYFILES,192,170,59,14
- CONTROL "Display password",IDC_SHOW_PASSWORD_CHPWD_NEW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,89,184,160,11,WS_EX_TRANSPARENT
- COMBOBOX IDC_PKCS5_PRF_ID,89,199,85,90,CBS_DROPDOWNLIST | WS_TABSTOP
- COMBOBOX IDC_WIPE_MODE,89,218,106,90,CBS_DROPDOWNLIST | WS_TABSTOP
- DEFPUSHBUTTON "OK",IDOK,264,7,59,14
- PUSHBUTTON "Cancel",IDCANCEL,264,24,59,14
+ CONTROL "Use keyfiles",IDC_ENABLE_NEW_KEYFILES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,89,172,110,11
+ PUSHBUTTON "Keyfiles...",IDC_NEW_KEYFILES,202,170,68,14
+ CONTROL "Display password",IDC_SHOW_PASSWORD_CHPWD_NEW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,89,184,180,11,WS_EX_TRANSPARENT
+ COMBOBOX IDC_PKCS5_PRF_ID,89,199,181,90,CBS_DROPDOWNLIST | WS_TABSTOP
+ COMBOBOX IDC_WIPE_MODE,89,218,181,90,CBS_DROPDOWNLIST | WS_TABSTOP
+ DEFPUSHBUTTON "OK",IDOK,280,7,59,14
+ PUSHBUTTON "Cancel",IDCANCEL,280,24,59,14
RTEXT "Password:",IDT_PASSWORD,12,16,72,8
RTEXT "Password:",IDT_NEW_PASSWORD,8,124,76,8
RTEXT "Confirm Password:",IDT_CONFIRM_PASSWORD,9,140,75,16
RTEXT "PKCS-5 PRF:",IDT_NEW_PKCS5_PRF,9,200,74,10,SS_CENTERIMAGE
- GROUPBOX "Current",IDT_CURRENT,6,3,252,97
- GROUPBOX "New",IDT_NEW,6,108,252,130
+ GROUPBOX "Current",IDT_CURRENT,6,3,270,97
+ GROUPBOX "New",IDT_NEW,6,108,270,130
RTEXT "Wipe mode:",IDT_WIPE_MODE,9,220,74,8,0,WS_EX_RIGHT
RTEXT "PKCS-5 PRF:",IDT_PKCS5_PRF,12,34,74,10,SS_CENTERIMAGE
RTEXT "Volume PIM:",IDT_OLD_PIM,12,54,74,10,NOT WS_VISIBLE
- LTEXT "(Empty or 0 for default iterations)",IDC_OLD_PIM_HELP,135,54,119,8,NOT WS_VISIBLE
+ LTEXT "(Empty or 0 for default iterations)",IDC_OLD_PIM_HELP,135,54,196,8,NOT WS_VISIBLE
RTEXT "Volume PIM:",IDT_PIM,9,157,75,16,NOT WS_VISIBLE
- LTEXT "(Empty or 0 for default iterations)",IDC_PIM_HELP,135,157,119,8,NOT WS_VISIBLE
+ LTEXT "(Empty or 0 for default iterations)",IDC_PIM_HELP,135,157,197,8,NOT WS_VISIBLE
END
IDD_MOUNT_DLG DIALOGEX 0, 0, 375, 271
@@ -178,25 +178,25 @@ BEGIN
CONTROL "",IDC_STATIC,"Static",SS_ETCHEDFRAME,2,151,372,119
END
-IDD_PASSWORD_DLG DIALOGEX 0, 0, 322, 103
+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
CAPTION "Enter VeraCrypt Volume Password"
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
- EDITTEXT IDC_PASSWORD,69,8,166,14,ES_PASSWORD | ES_AUTOHSCROLL
- COMBOBOX IDC_PKCS5_PRF_ID,69,26,86,90,CBS_DROPDOWNLIST | WS_TABSTOP
- CONTROL "TrueCrypt Mode",IDC_TRUECRYPT_MODE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,28,76,10
+ 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
- CONTROL "U&se keyfiles",IDC_KEYFILES_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,70,87,83,11
- PUSHBUTTON "&Keyfiles...",IDC_KEY_FILES,171,84,64,14
- PUSHBUTTON "Mount Opti&ons...",IDC_MOUNT_OPTIONS,243,84,64,14
- LTEXT "(Empty or 0 for default iterations)",IDC_PIM_HELP,115,46,189,8,NOT WS_VISIBLE
- DEFPUSHBUTTON "OK",IDOK,243,8,64,14
- PUSHBUTTON "Cancel",IDCANCEL,243,25,64,14
+ 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
+ DEFPUSHBUTTON "OK",IDOK,252,8,69,14
+ PUSHBUTTON "Cancel",IDCANCEL,252,25,69,14
RTEXT "Password:",IDT_PASSWORD,0,10,65,13
RTEXT "PKCS-5 PRF:",IDT_PKCS5_PRF,0,27,65,11
RTEXT "Volume PIM:",IDT_PIM,0,46,65,8,NOT WS_VISIBLE
@@ -281,28 +281,30 @@ BEGIN
LTEXT "",IDT_PKCS11_LIB_HELP,16,63,286,65
END
-IDD_SYSENC_SETTINGS DIALOGEX 0, 0, 370, 272
+IDD_SYSENC_SETTINGS DIALOGEX 0, 0, 370, 286
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,22,339,9
- EDITTEXT IDC_CUSTOM_BOOT_LOADER_MESSAGE,18,52,216,14,ES_AUTOHSCROLL
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,37,339,9
+ EDITTEXT IDC_CUSTOM_BOOT_LOADER_MESSAGE,18,67,216,14,ES_AUTOHSCROLL
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,178,339,10
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,192,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,208,340,10
- DEFPUSHBUTTON "OK",IDOK,257,244,50,14
- PUSHBUTTON "Cancel",IDCANCEL,313,244,50,14
- LTEXT "Display this custom message in the pre-boot authentication screen (24 characters maximum):",IDT_CUSTOM_BOOT_LOADER_MESSAGE,18,41,337,8
- GROUPBOX "Boot Loader Screen Options",IDT_BOOT_LOADER_SCREEN_OPTIONS,8,7,355,150
- GROUPBOX "Security Options",IDT_SECURITY_OPTIONS,8,163,355,75
- LTEXT "",IDC_CUSTOM_BOOT_LOADER_MESSAGE_HELP,18,74,337,73
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,222,340,10
+ DEFPUSHBUTTON "OK",IDOK,257,262,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,313,262,50,14
+ LTEXT "Display this custom message in the pre-boot authentication screen (24 characters maximum):",IDT_CUSTOM_BOOT_LOADER_MESSAGE,18,56,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,89,337,73
CONTROL "Disable ""Evil Maid"" attack detection",IDC_DISABLE_EVIL_MAID_ATTACK_DETECTION,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,223,340,10
+ "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,193,340,10
+ "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,20,339,9
END
IDD_PERFORMANCE_SETTINGS DIALOGEX 0, 0, 370, 248
@@ -330,7 +332,7 @@ BEGIN
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,198,337,10
END
-IDD_FAVORITE_VOLUMES DIALOGEX 0, 0, 380, 339
+IDD_FAVORITE_VOLUMES DIALOGEX 0, 0, 380, 368
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "VeraCrypt - Favorite Volumes"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
@@ -339,31 +341,35 @@ BEGIN
PUSHBUTTON "Move &Up",IDC_FAVORITE_MOVE_UP,7,104,63,14
PUSHBUTTON "Move &Down",IDC_FAVORITE_MOVE_DOWN,74,104,63,14
PUSHBUTTON "&Remove",IDC_FAVORITE_REMOVE,310,104,63,14
- EDITTEXT IDC_FAVORITE_LABEL,18,185,204,13,ES_AUTOHSCROLL
+ EDITTEXT IDC_FAVORITE_LABEL,18,225,344,13,ES_AUTOHSCROLL
CONTROL "Mount selected volume as read-o&nly",IDC_FAVORITE_MOUNT_READONLY,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,215,349,10
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,255,349,10
CONTROL "Mount selected volume as remo&vable medium",IDC_FAVORITE_MOUNT_REMOVABLE,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,229,349,10
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,269,349,10
CONTROL "Mount selected volume upon log&on",IDC_FAVORITE_MOUNT_ON_LOGON,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,243,349,10
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,283,349,10
CONTROL "Mount selected volume when its host device gets &connected",IDC_FAVORITE_MOUNT_ON_ARRIVAL,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,257,349,10
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,297,349,10
CONTROL "Open &Explorer window for selected volume when successfully mounted",IDC_FAVORITE_OPEN_EXPLORER_WIN_ON_MOUNT,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,271,349,11
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,311,349,11
CONTROL "Do not mount selected volume when 'Mount Favorite Volumes' &hot key is pressed",IDC_FAVORITE_DISABLE_HOTKEY,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,286,349,11
- LTEXT "Help on favorite volumes",IDC_FAVORITES_HELP_LINK,17,322,237,10,SS_NOTIFY
- DEFPUSHBUTTON "OK",IDOK,269,318,50,14
- PUSHBUTTON "Cancel",IDCANCEL,323,318,50,14
- GROUPBOX "",IDC_FAV_VOL_OPTIONS_GROUP_BOX,7,122,366,180
- LTEXT "Label of selected favorite volume:",IDT_FAVORITE_LABEL,18,175,202,8
- GROUPBOX "Global Settings",IDC_FAV_VOL_OPTIONS_GLOBAL_SETTINGS_BOX,7,260,366,42
- EDITTEXT IDC_PIM,18,143,42,13,ES_RIGHT | ES_PASSWORD | ES_AUTOHSCROLL | ES_NUMBER
- LTEXT "(Empty or 0 for default iterations)",IDC_PIM_HELP,64,145,189,8
- LTEXT "Volume PIM:",IDT_PIM,18,133,65,8
- CONTROL "Display PIM",IDC_SHOW_PIM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,159,150,10
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,326,349,11
+ LTEXT "Help on favorite volumes",IDC_FAVORITES_HELP_LINK,17,351,237,10,SS_NOTIFY
+ DEFPUSHBUTTON "OK",IDOK,269,347,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,323,347,50,14
+ GROUPBOX "",IDC_FAV_VOL_OPTIONS_GROUP_BOX,7,123,366,219
+ LTEXT "Label of selected favorite volume:",IDT_FAVORITE_LABEL,18,215,202,8
+ GROUPBOX "Global Settings",IDC_FAV_VOL_OPTIONS_GLOBAL_SETTINGS_BOX,7,300,366,42
+ EDITTEXT IDC_PIM,18,183,42,13,ES_RIGHT | ES_PASSWORD | ES_AUTOHSCROLL | ES_NUMBER
+ LTEXT "(Empty or 0 for default iterations)",IDC_PIM_HELP,64,185,189,8
+ LTEXT "Volume PIM:",IDT_PIM,18,173,65,8
+ CONTROL "Display PIM",IDC_SHOW_PIM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,199,150,10
CONTROL "Use favorite label as Explorer drive label",IDC_FAVORITE_USE_LABEL_IN_EXPLORER,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,202,349,10
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,242,349,10
+ LTEXT "Volume ID:",IDT_VOLUME_ID,18,131,57,8
+ EDITTEXT IDC_FAVORITE_VOLUME_ID,18,141,344,14,ES_AUTOHSCROLL | ES_READONLY
+ CONTROL "Use Volume ID to mount favorite",IDC_FAVORITE_USE_VOLUME_ID,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,159,337,10
END
IDD_DEFAULT_MOUNT_PARAMETERS DIALOGEX 0, 0, 167, 65
@@ -406,7 +412,7 @@ BEGIN
IDD_PASSWORDCHANGE_DLG, DIALOG
BEGIN
LEFTMARGIN, 7
- RIGHTMARGIN, 323
+ RIGHTMARGIN, 339
TOPMARGIN, 7
BOTTOMMARGIN, 238
END
@@ -419,7 +425,7 @@ BEGIN
IDD_PASSWORD_DLG, DIALOG
BEGIN
- RIGHTMARGIN, 313
+ RIGHTMARGIN, 321
BOTTOMMARGIN, 98
END
@@ -452,7 +458,7 @@ BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 363
TOPMARGIN, 7
- BOTTOMMARGIN, 258
+ BOTTOMMARGIN, 276
END
IDD_PERFORMANCE_SETTINGS, DIALOG
@@ -468,7 +474,7 @@ BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 373
TOPMARGIN, 7
- BOTTOMMARGIN, 332
+ BOTTOMMARGIN, 361
END
IDD_DEFAULT_MOUNT_PARAMETERS, DIALOG
diff --git a/src/Mount/Resource.h b/src/Mount/Resource.h
index 1a3bc9b4..c5a45af4 100644
--- a/src/Mount/Resource.h
+++ b/src/Mount/Resource.h
@@ -176,6 +176,10 @@
#define IDC_PREF_CACHE_PIM 1154
#define IDC_BOOT_LOADER_CACHE_PIM 1155
#define IDC_SHOW_DISCONNECTED_NETWORK_DRIVES 1156
+#define IDT_VOLUME_ID 1157
+#define IDC_FAVORITE_VOLUME_ID 1158
+#define IDC_FAVORITE_USE_VOLUME_ID 1159
+#define IDC_DISABLE_BOOT_LOADER_PIM_PROMPT 1160
#define IDM_HELP 40001
#define IDM_ABOUT 40002
#define IDM_UNMOUNT_VOLUME 40003
@@ -252,7 +256,7 @@
#define _APS_NO_MFC 1
#define _APS_NEXT_RESOURCE_VALUE 119
#define _APS_NEXT_COMMAND_VALUE 40069
-#define _APS_NEXT_CONTROL_VALUE 1157
+#define _APS_NEXT_CONTROL_VALUE 1161
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
diff --git a/src/Release/Setup Files/LICENSE b/src/Release/Setup Files/LICENSE
new file mode 100644
index 00000000..7c96fa48
--- /dev/null
+++ b/src/Release/Setup Files/LICENSE
@@ -0,0 +1,190 @@
+ Apache License
+ Version 2.0, January 2004
+ https://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+Copyright 2013-2015 IDRIX
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ https://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License. \ No newline at end of file
diff --git a/src/Release/Setup Files/NOTICE b/src/Release/Setup Files/NOTICE
new file mode 100644
index 00000000..51a0fa62
--- /dev/null
+++ b/src/Release/Setup Files/NOTICE
@@ -0,0 +1,134 @@
+Copyright 2013-2016 IDRIX
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+____________________________________________________________
+
+Copyright (c) 2008-2012 TrueCrypt Developers Association. All rights reserved.
+
+Governed by the TrueCrypt License 3.0 the full text of which is contained in
+the file License.txt included in TrueCrypt binary and source code distribution
+packages.
+____________________________________________________________
+
+License agreement for Encryption for the Masses.
+
+Copyright (C) 1998-2000 Paul Le Roux. All Rights Reserved.
+
+This product can be copied and distributed free of charge,
+including source code.
+
+You may modify this product and source code, and distribute such
+modifications, and you may derive new works based on this
+product, provided that:
+
+1. Any product which is simply derived from this product cannot
+be called E4M, or Encryption for the Masses.
+
+2. If you use any of the source code in your product, and your
+product is distributed with source code, you must include this
+notice with those portions of this source code that you use.
+
+Or,
+
+If your product is distributed in binary form only, you must
+display on any packaging, and marketing materials which
+reference your product, a notice which states:
+
+"This product uses components written by Paul Le Roux
+<pleroux@swprofessionals.com>"
+
+3. If you use any of the source code originally by Eric Young,
+you must in addition follow his terms and conditions.
+
+4. Nothing requires that you accept this License, as you have
+not signed it. However, nothing else grants you permission to
+modify or distribute the product or its derivative works.
+
+These actions are prohibited by law if you do not accept this
+License.
+
+5. If any of these license terms is found to be to broad in
+scope, and declared invalid by any court or legal process, you
+agree that all other terms shall not be so affected, and shall
+remain valid and enforceable.
+
+6. THIS PROGRAM IS DISTRIBUTED FREE OF CHARGE, THEREFORE THERE
+IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. UNLESS OTHERWISE STATED THE PROGRAM IS PROVIDED
+"AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR
+IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
+ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS
+WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE
+COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+7. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY
+MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE
+LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL,
+INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR
+INABILITY TO USE THE PROGRAM, INCLUDING BUT NOT LIMITED TO LOSS
+OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH
+ANY OTHER PROGRAMS, EVEN IF SUCH HOLDER OR OTHER PARTY HAD
+PREVIOUSLY BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+____________________________________________________________
+
+Copyright (c) 1998-2008, Brian Gladman, Worcester, UK.
+All rights reserved.
+
+LICENSE TERMS
+
+The free distribution and use of this software is allowed (with
+or without changes) provided that:
+
+ 1. source code distributions include the above copyright
+ notice, this list of conditions and the following
+ disclaimer;
+
+ 2. binary distributions include the above copyright notice,
+ this list of conditions and the following disclaimer in
+ their documentation;
+
+ 3. the name of the copyright holder is not used to endorse
+ products built using this software without specific written
+ permission.
+
+DISCLAIMER
+
+This software is provided 'as is' with no explicit or implied
+warranties in respect of its properties, including, but not
+limited to, correctness and/or fitness for purpose.
+____________________________________________________________
+
+Copyright (C) 2002-2004 Mark Adler, all rights reserved
+version 1.8, 9 Jan 2004
+
+This software is provided 'as-is', without any express or
+implied warranty. In no event will the author be held liable
+for any damages arising from the use of this software.
+
+Permission is granted to anyone to use this software for any
+purpose, including commercial applications, and to alter it and
+redistribute it freely, subject to the following restrictions:
+
+1. The origin of this software must not be misrepresented; you
+ must not claim that you wrote the original software. If you
+ use this software in a product, an acknowledgment in the
+ product documentation would be appreciated but is not
+ required.
+2. Altered source versions must be plainly marked as such, and
+ must not be misrepresented as being the original software.
+3. This notice may not be removed or altered from any source
+ distribution.
+____________________________________________________________
diff --git a/src/Release/Setup Files/VeraCrypt User Guide.pdf b/src/Release/Setup Files/VeraCrypt User Guide.pdf
index 0be3dc46..a78cbe87 100644
--- a/src/Release/Setup Files/VeraCrypt User Guide.pdf
+++ b/src/Release/Setup Files/VeraCrypt User Guide.pdf
Binary files differ