VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Mount/Mount.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/Mount/Mount.c')
-rw-r--r--src/Mount/Mount.c316
1 files changed, 293 insertions, 23 deletions
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)