VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Mount/Favorites.cpp
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2017-07-02 15:03:03 (GMT)
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2017-07-02 17:36:52 (GMT)
commita0f2ffb90bf004b08fc4d3e317718d5a78fb54d5 (patch)
treeb2ac6755898c977f9a4dac1a35710995722e8252 /src/Mount/Favorites.cpp
parent2db0061741792c5303e31785d41ad07694646492 (diff)
downloadVeraCrypt-a0f2ffb90bf004b08fc4d3e317718d5a78fb54d5.zip
VeraCrypt-a0f2ffb90bf004b08fc4d3e317718d5a78fb54d5.tar.gz
Windows: when mounting multiple favorites, use PIM of previous favorite alongside its password if option "Include PIM when caching password" is selected alongside option "Temporarily cache password during Mount Favorite Volumes operations".
Diffstat (limited to 'src/Mount/Favorites.cpp')
-rw-r--r--src/Mount/Favorites.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/Mount/Favorites.cpp b/src/Mount/Favorites.cpp
index ed5e96e..dab58bc 100644
--- a/src/Mount/Favorites.cpp
+++ b/src/Mount/Favorites.cpp
@@ -391,7 +391,7 @@ namespace VeraCrypt
case IDC_PIM:
if (hw == EN_CHANGE)
{
- int pim = GetPim (hwndDlg, IDC_PIM);
+ int pim = GetPim (hwndDlg, IDC_PIM, -1);
if (pim > (SystemFavoritesMode? MAX_BOOT_PIM_VALUE: MAX_PIM_VALUE))
{
SetDlgItemText (hwndDlg, IDC_PIM, L"");
@@ -618,9 +618,14 @@ namespace VeraCrypt
/* support old attribute name before it was changed to PIM*/
XmlGetAttributeText (xml, "pin", label, sizeof (label));
}
- favorite.Pim = strtol (label, NULL, 10);
- if (favorite.Pim < 0 || favorite.Pim > (systemFavorites? MAX_BOOT_PIM_VALUE : MAX_PIM_VALUE))
- favorite.Pim = 0;
+ if (label[0])
+ {
+ favorite.Pim = strtol (label, NULL, 10);
+ if (favorite.Pim < 0 || favorite.Pim > (systemFavorites? MAX_BOOT_PIM_VALUE : MAX_PIM_VALUE))
+ favorite.Pim = -1;
+ }
+ else
+ favorite.Pim = -1;
char boolVal[2];
XmlGetAttributeText (xml, "readonly", boolVal, sizeof (boolVal));
@@ -786,7 +791,7 @@ namespace VeraCrypt
if (!favorite.Label.empty())
s += L" label=\"" + favorite.Label + L"\"";
- if (favorite.Pim > 0)
+ if ((favorite.Pim >= 0) && (favorite.TrueCryptMode <= 0))
s += L" pim=\"" + IntToWideString(favorite.Pim) + L"\"";
if (favorite.Pkcs5 > 0)
@@ -1029,7 +1034,7 @@ namespace VeraCrypt
else
favorite.Label.clear();
- favorite.Pim = GetPim (hwndDlg, IDC_PIM);
+ favorite.Pim = GetPim (hwndDlg, IDC_PIM, -1);
favorite.UseLabelInExplorer = (IsDlgButtonChecked (hwndDlg, IDC_FAVORITE_USE_LABEL_IN_EXPLORER) != 0);
favorite.UseVolumeID = (IsDlgButtonChecked (hwndDlg, IDC_FAVORITE_USE_VOLUME_ID) != 0);
int nSelected = (int) SendMessage (GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID), CB_GETCURSEL, 0, 0);