diff options
author | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2015-07-13 02:00:26 +0200 |
---|---|---|
committer | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2015-07-13 23:35:15 +0200 |
commit | a43a5ebb2136a77be8e79546f329412e4bef14c4 (patch) | |
tree | e32491754c66e078ca1fa9a52adb1dce22400dcb /src/Format | |
parent | 8fc08b1e468482301fa5c31fcba742e24e197afc (diff) | |
download | VeraCrypt-a43a5ebb2136a77be8e79546f329412e4bef14c4.tar.gz VeraCrypt-a43a5ebb2136a77be8e79546f329412e4bef14c4.zip |
Windows: Modify PIM parts in GUI to make it easier to use. Users must explicitly check "User PIM" to enable its use.
Diffstat (limited to 'src/Format')
-rw-r--r-- | src/Format/Format.rc | 13 | ||||
-rw-r--r-- | src/Format/Resource.h | 3 | ||||
-rw-r--r-- | src/Format/Tcformat.c | 77 |
3 files changed, 71 insertions, 22 deletions
diff --git a/src/Format/Format.rc b/src/Format/Format.rc index 13833f79..f34cae1f 100644 --- a/src/Format/Format.rc +++ b/src/Format/Format.rc @@ -119,9 +119,10 @@ BEGIN 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
CONTROL "&Display password",IDC_SHOW_PASSWORD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,53,45,95,11,WS_EX_TRANSPARENT
+ CONTROL "Use PIM",IDC_PIM_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,53,56,97,10
RTEXT "Password:",IDT_PASSWORD,1,6,50,8
RTEXT "&Confirm:",IDT_CONFIRM,1,23,50,8
- LTEXT "",IDC_BOX_HELP,0,63,225,105
+ LTEXT "",IDC_BOX_HELP,0,71,225,97
END
IDD_SIZE_PAGE_DLG DIALOGEX 0, 0, 226, 172
@@ -224,15 +225,16 @@ 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_PIM,50,32,42,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER
+ EDITTEXT IDC_PIM,50,32,42,14,ES_RIGHT | 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
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
- RTEXT "Volume PIM:",IDT_PIM,0,34,48,8
- LTEXT "(Empty or 0 for default iterations)",IDC_PIM_HELP,96,34,127,8
+ RTEXT "Volume PIM:",IDT_PIM,0,35,48,8,NOT WS_VISIBLE
+ CONTROL "Use PIM",IDC_PIM_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,50,35,97,10
END
IDD_VOLUME_TYPE_PAGE_DLG DIALOGEX 0, 0, 226, 172
@@ -436,9 +438,10 @@ STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
EDITTEXT IDC_PIM,53,8,42,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER
- LTEXT "",IDC_BOX_HELP,0,28,225,143
+ LTEXT "",IDC_BOX_HELP,0,28,225,130
RTEXT "Volume PIM:",IDT_PIM,1,11,50,8
LTEXT "(Empty or 0 for default iterations)",IDC_PIM_HELP,97,11,126,8
+ LTEXT "Information on PIM",IDC_LINK_PIM_INFO,0,161,213,8,SS_NOTIFY
END
diff --git a/src/Format/Resource.h b/src/Format/Resource.h index 1d2f4687..3b717e84 100644 --- a/src/Format/Resource.h +++ b/src/Format/Resource.h @@ -141,6 +141,7 @@ #define IDC_DEVICE_TRANSFORM_MODE_INPLACE 1102
#define IDC_DRIVE_LETTER_LIST 1103
#define IDT_DRIVE_LETTER 1104
+#define IDC_LINK_PIM_INFO 1105
// Next default values for new objects
//
@@ -149,7 +150,7 @@ #define _APS_NO_MFC 1
#define _APS_NEXT_RESOURCE_VALUE 134
#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1105
+#define _APS_NEXT_CONTROL_VALUE 1106
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
diff --git a/src/Format/Tcformat.c b/src/Format/Tcformat.c index bd83078f..7106a230 100644 --- a/src/Format/Tcformat.c +++ b/src/Format/Tcformat.c @@ -2700,6 +2700,8 @@ static void __cdecl volTransformThreadFunction (void *hwndDlgArg) RestoreDefaultKeyFilesParam ();
+ PimEnable = FALSE;
+
if (bDevice && !bInPlaceEncNonSys)
{
// Handle assigned drive letter (if any)
@@ -4134,6 +4136,11 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa SetWindowText (GetDlgItem (hwndDlg, IDC_PIM), szTmp);
}
+ ShowWindow (GetDlgItem( hwndDlg, IDC_PIM_ENABLE), PimEnable? SW_HIDE : SW_SHOW);
+ ShowWindow (GetDlgItem( hwndDlg, IDT_PIM), PimEnable? SW_SHOW : SW_HIDE);
+ ShowWindow (GetDlgItem( hwndDlg, IDC_PIM), PimEnable? SW_SHOW : SW_HIDE);
+ ShowWindow (GetDlgItem( hwndDlg, IDC_PIM_HELP), PimEnable? SW_SHOW : SW_HIDE);
+
SetCheckBox (hwndDlg, IDC_KEYFILES_ENABLE, KeyFilesEnable);
SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP), GetString (bInPlaceEncNonSys ? (bInPlaceEncNonSysResumed ? "NONSYS_INPLACE_ENC_RESUME_PASSWORD_PAGE_HELP" : "NONSYS_INPLACE_DEC_PASSWORD_PAGE_HELP") : "PASSWORD_HIDDENVOL_HOST_DIRECT_HELP"));
@@ -4207,6 +4214,8 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa SetWindowText (GetDlgItem (hwndDlg, IDC_VERIFY), szVerify);
SetFocus (GetDlgItem (hwndDlg, IDC_PASSWORD));
+
+ SetCheckBox (hwndDlg, IDC_PIM_ENABLE, PimEnable);
SetCheckBox (hwndDlg, IDC_KEYFILES_ENABLE, KeyFilesEnable && !SysEncInEffect());
EnableWindow (GetDlgItem (hwndDlg, IDC_KEY_FILES), KeyFilesEnable);
@@ -4255,6 +4264,8 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP), GetString (SysEncInEffect ()? "PIM_SYSENC_HELP" : "PIM_HELP"));
+ ToHyperlink (hwndDlg, IDC_LINK_PIM_INFO);
+
if (CreatingHiddenSysVol())
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString ("PIM_HIDDEN_OS_TITLE"));
else if (bHiddenVol)
@@ -5348,6 +5359,12 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa return 1;
}
+ if (lw == IDC_LINK_PIM_INFO && nCurPageNo == PIM_PAGE)
+ {
+ Applink ("pim", TRUE, "");
+ return 1;
+ }
+
if (hw == CBN_EDITCHANGE && nCurPageNo == VOLUME_LOCATION_PAGE)
{
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_NEXT),
@@ -5393,20 +5410,6 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa KeyFilesEnable && FirstKeyFile!=NULL && !SysEncInEffect());
volumePassword.Length = (unsigned __int32) strlen ((char *) volumePassword.Text);
- if (lw == IDC_PIM)
- {
- if(GetPim (hwndDlg, IDC_PIM) != 0)
- {
- PimValueChangedWarning = TRUE;
- SetDlgItemTextW (hwndDlg, IDC_PIM_HELP, GetString (SysEncInEffect ()? "PIM_SYSENC_CHANGE_WARNING" : "PIM_CHANGE_WARNING"));
- }
- else
- {
- PimValueChangedWarning = FALSE;
- SetDlgItemTextW (hwndDlg, IDC_PIM_HELP, (wchar_t *) GetDictionaryValueByInt (IDC_PIM_HELP));
- }
- }
-
return 1;
}
@@ -5443,6 +5446,23 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa InvalidateRect (GetDlgItem (hwndDlg, IDC_VERIFY), NULL, TRUE);
return 1;
}
+
+ if (lw == IDC_PIM_ENABLE)
+ {
+ PimEnable = GetCheckBox (hwndDlg, IDC_PIM_ENABLE);
+ if (!PimEnable)
+ volumePim = 0;
+ if (nCurPageNo == HIDDEN_VOL_HOST_PASSWORD_PAGE
+ || nCurPageNo == NONSYS_INPLACE_ENC_RESUME_PASSWORD_PAGE
+ )
+ {
+ ShowWindow (GetDlgItem( hwndDlg, IDC_PIM_ENABLE), PimEnable? SW_HIDE : SW_SHOW);
+ ShowWindow (GetDlgItem( hwndDlg, IDT_PIM), PimEnable? SW_SHOW : SW_HIDE);
+ ShowWindow (GetDlgItem( hwndDlg, IDC_PIM), PimEnable? SW_SHOW : SW_HIDE);
+ ShowWindow (GetDlgItem( hwndDlg, IDC_PIM_HELP), PimEnable? SW_SHOW : SW_HIDE);
+ }
+ return 1;
+ }
if (nCurPageNo == PASSWORD_PAGE
|| nCurPageNo == HIDDEN_VOL_HOST_PASSWORD_PAGE
@@ -7141,6 +7161,31 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa }
}
+
+ if (!PimEnable)
+ {
+ // PIM not activated. Skip PIM page
+ volumePim = 0;
+
+ if (SysEncInEffect ())
+ {
+ nNewPageNo = SYSENC_COLLECTING_RANDOM_DATA_PAGE - 1; // Skip irrelevant pages
+ }
+
+ if (bInPlaceEncNonSys)
+ {
+ nNewPageNo = NONSYS_INPLACE_ENC_RAND_DATA_PAGE - 1; // Skip irrelevant pages
+ }
+ else if (WizardMode != WIZARD_MODE_SYS_DEVICE
+ && !FileSize4GBLimitQuestionNeeded ()
+ || CreatingHiddenSysVol()) // If we're creating a hidden volume for a hidden OS, we don't need to format it with any filesystem (the entire OS will be copied to the hidden volume sector by sector).
+ {
+ nNewPageNo = FORMAT_PAGE - 1; // Skip irrelevant pages
+ }
+ else
+ nNewPageNo = PIM_PAGE; // Skip PIM page
+
+ }
}
else if (nCurPageNo == PIM_PAGE)
@@ -8328,7 +8373,7 @@ ovf_end: tmp [sizeof(tmp)-1] = 0;
SetWindowText (hRandPoolSys, tmp);
- nNewPageNo = PIM_PAGE + 1; // Skip irrelevant pages
+ nNewPageNo = (PimEnable? PIM_PAGE : PASSWORD_PAGE) + 1; // Skip irrelevant pages
}
else if (nCurPageNo == SYSENC_KEYS_GEN_PAGE)
@@ -8372,7 +8417,7 @@ ovf_end: nNewPageNo = FILESYS_PAGE + 1;
}
else
- nNewPageNo = PIM_PAGE + 1;
+ nNewPageNo = (PimEnable? PIM_PAGE : PASSWORD_PAGE) + 1;
}
}
|