From a916135f3c28eae9c3db946c9946d3f75536a0ff Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Wed, 25 Feb 2015 08:56:33 +0100 Subject: [PATCH] Windows: Use default hash in the options of hidden volume protection --- src/Mount/Mount.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/Mount/Mount.c b/src/Mount/Mount.c index 427c1a93..0a104709 100644 --- a/src/Mount/Mount.c +++ b/src/Mount/Mount.c @@ -2329,6 +2329,9 @@ BOOL CALLBACK PasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa if (lw == IDC_MOUNT_OPTIONS) { + /* Use default PRF specified by the user if any */ + if (mountOptions.ProtectedHidVolPkcs5Prf == 0) + mountOptions.ProtectedHidVolPkcs5Prf = *pkcs5; DialogBoxParamW (hInst, MAKEINTRESOURCEW (IDD_MOUNT_OPTIONS), hwndDlg, (DLGPROC) MountOptionsDlgProc, (LPARAM) &mountOptions); @@ -6013,6 +6016,14 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa if (GetAsyncKeyState (VK_CONTROL) < 0) { + /* Priority is given to command line parameters + * Default values used only when nothing specified in command line + */ + if (CmdVolumePkcs5 == 0) + mountOptions.ProtectedHidVolPkcs5Prf = DefaultVolumePkcs5; + else + mountOptions.ProtectedHidVolPkcs5Prf = CmdVolumePkcs5; + if (IDCANCEL == DialogBoxParamW (hInst, MAKEINTRESOURCEW (IDD_MOUNT_OPTIONS), hwndDlg, (DLGPROC) MountOptionsDlgProc, (LPARAM) &mountOptions)) @@ -7765,6 +7776,13 @@ BOOL MountFavoriteVolumes (BOOL systemFavorites, BOOL logOnMount, BOOL hotKeyMou && !favoriteVolumeToMount.Path.empty() && GetAsyncKeyState (VK_CONTROL) < 0) { + /* Priority is given to command line parameters + * Default values used only when nothing specified in command line + */ + if (CmdVolumePkcs5 == 0) + mountOptions.ProtectedHidVolPkcs5Prf = DefaultVolumePkcs5; + else + mountOptions.ProtectedHidVolPkcs5Prf = CmdVolumePkcs5; if (DialogBoxParamW (hInst, MAKEINTRESOURCEW (IDD_MOUNT_OPTIONS), MainDlg, MountOptionsDlgProc, (LPARAM) &mountOptions) == IDCANCEL) { status = FALSE; @@ -9214,6 +9232,13 @@ void MountSelectedVolume (HWND hwndDlg, BOOL mountWithOptions) if (mountWithOptions || GetAsyncKeyState (VK_CONTROL) < 0) { + /* Priority is given to command line parameters + * Default values used only when nothing specified in command line + */ + if (CmdVolumePkcs5 == 0) + mountOptions.ProtectedHidVolPkcs5Prf = DefaultVolumePkcs5; + else + mountOptions.ProtectedHidVolPkcs5Prf = CmdVolumePkcs5; if (IDCANCEL == DialogBoxParamW (hInst, MAKEINTRESOURCEW (IDD_MOUNT_OPTIONS), hwndDlg, (DLGPROC) MountOptionsDlgProc, (LPARAM) &mountOptions))