VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Format
diff options
context:
space:
mode:
Diffstat (limited to 'src/Format')
-rw-r--r--src/Format/Format.rc25
-rw-r--r--src/Format/Resource.h3
-rw-r--r--src/Format/Tcformat.c115
3 files changed, 113 insertions, 30 deletions
diff --git a/src/Format/Format.rc b/src/Format/Format.rc
index 26d35961..15f3f97f 100644
--- a/src/Format/Format.rc
+++ b/src/Format/Format.rc
@@ -116,15 +116,12 @@ 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_PIM,53,35,42,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER
- CONTROL "&Display password",IDC_SHOW_PASSWORD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,53,65,95,11,WS_EX_TRANSPARENT
- CONTROL "U&se keyfiles",IDC_KEYFILES_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,53,55,95,10
- PUSHBUTTON "&Keyfiles...",IDC_KEY_FILES,152,56,64,14,WS_DISABLED
+ CONTROL "&Display password",IDC_SHOW_PASSWORD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,53,45,95,11,WS_EX_TRANSPARENT
+ 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
RTEXT "Password:",IDT_PASSWORD,1,6,50,8
RTEXT "&Confirm:",IDT_CONFIRM,1,23,50,8
LTEXT "",IDC_BOX_HELP,0,79,225,89
- RTEXT "Volume PIM:",IDT_PIM,1,38,50,8
- LTEXT "(Empty or 0 for default iterations)",IDC_PIM_HELP,97,38,126,8
END
IDD_SIZE_PAGE_DLG DIALOGEX 0, 0, 226, 172
@@ -434,6 +431,16 @@ BEGIN
RTEXT "Drive letter:",IDT_DRIVE_LETTER,5,17,86,8
END
+IDD_PIM_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_PIM,53,8,42,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER
+ LTEXT "",IDC_BOX_HELP,0,33,225,110
+ RTEXT "Volume PIM:",IDT_PIM,1,11,50,8
+ LTEXT "(Empty or 0 for default iterations)",IDC_PIM_HELP,97,11,126,8
+END
+
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
@@ -685,6 +692,12 @@ BEGIN
TOPMARGIN, 7
BOTTOMMARGIN, 165
END
+
+ IDD_PIM_PAGE_DLG, DIALOG
+ BEGIN
+ RIGHTMARGIN, 223
+ BOTTOMMARGIN, 143
+ END
END
#endif // APSTUDIO_INVOKED
diff --git a/src/Format/Resource.h b/src/Format/Resource.h
index 4cb2e579..1d2f4687 100644
--- a/src/Format/Resource.h
+++ b/src/Format/Resource.h
@@ -35,6 +35,7 @@
#define IDD_DEVICE_TRANSFORM_MODE_DLG 130
#define IDD_EXPANDED_LIST_SELECT_PAGE_DLG 131
#define IDD_DRIVE_LETTER_SELECTION_PAGE 132
+#define IDD_PIM_PAGE_DLG 133
#define IDC_BOX_TITLE 1000
#define IDC_RESCUE_DISK_ISO_PATH 1001
#define IDC_COMBO_BOX 1002
@@ -146,7 +147,7 @@
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NO_MFC 1
-#define _APS_NEXT_RESOURCE_VALUE 133
+#define _APS_NEXT_RESOURCE_VALUE 134
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1105
#define _APS_NEXT_SYMED_VALUE 101
diff --git a/src/Format/Tcformat.c b/src/Format/Tcformat.c
index 0c50ad34..e1a1d65e 100644
--- a/src/Format/Tcformat.c
+++ b/src/Format/Tcformat.c
@@ -80,6 +80,7 @@ enum wizard_pages
SIZE_PAGE,
HIDDEN_VOL_HOST_PASSWORD_PAGE,
PASSWORD_PAGE,
+ PIM_PAGE,
FILESYS_PAGE,
SYSENC_COLLECTING_RANDOM_DATA_PAGE,
SYSENC_KEYS_GEN_PAGE,
@@ -2899,6 +2900,10 @@ static void LoadPage (HWND hwndDlg, int nPageNo)
hCurPage = CreateDialogW (hInst, MAKEINTRESOURCEW (IDD_PASSWORD_PAGE_DLG), hwndDlg,
(DLGPROC) PageDialogProc);
break;
+ case PIM_PAGE:
+ hCurPage = CreateDialogW (hInst, MAKEINTRESOURCEW (IDD_PIM_PAGE_DLG), hwndDlg,
+ (DLGPROC) PageDialogProc);
+ break;
case FILESYS_PAGE:
hCurPage = CreateDialogW (hInst, MAKEINTRESOURCEW (IDD_UNIVERSAL_DUAL_CHOICE_PAGE_DLG), hwndDlg,
(DLGPROC) PageDialogProc);
@@ -4152,17 +4157,6 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
SetFocus (GetDlgItem (hwndDlg, IDC_PASSWORD));
- SendMessage (GetDlgItem (hwndDlg, IDC_PIM), EM_LIMITTEXT, SysEncInEffect()? MAX_BOOT_PIM: MAX_PIM, 0);
- if (volumePin > 0)
- {
- char szTmp[MAX_PIM + 1];
- StringCbPrintfA(szTmp, sizeof(szTmp), "%d", volumePin);
- SetWindowText (GetDlgItem (hwndDlg, IDC_PIM), szTmp);
-
- PinValueChangedWarning = TRUE;
- SetDlgItemTextW (hwndDlg, IDC_PIM_HELP, GetString (SysEncInEffect ()? "PIM_SYSENC_CHANGE_WARNING" : "PIM_CHANGE_WARNING"));
- }
-
SetCheckBox (hwndDlg, IDC_KEYFILES_ENABLE, KeyFilesEnable && !SysEncInEffect());
EnableWindow (GetDlgItem (hwndDlg, IDC_KEY_FILES), KeyFilesEnable);
@@ -4193,6 +4187,40 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
}
break;
+ case PIM_PAGE:
+ {
+ SendMessage (GetDlgItem (hwndDlg, IDC_PIM), EM_LIMITTEXT, SysEncInEffect()? MAX_BOOT_PIM: MAX_PIM, 0);
+ if (volumePin > 0)
+ {
+ char szTmp[MAX_PIM + 1];
+ StringCbPrintfA(szTmp, sizeof(szTmp), "%d", volumePin);
+ SetWindowText (GetDlgItem (hwndDlg, IDC_PIM), szTmp);
+
+ PinValueChangedWarning = TRUE;
+ SetDlgItemTextW (hwndDlg, IDC_PIM_HELP, GetString (SysEncInEffect ()? "PIM_SYSENC_CHANGE_WARNING" : "PIM_CHANGE_WARNING"));
+ }
+
+ SetFocus (GetDlgItem (hwndDlg, IDC_PIM));
+
+ SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP), GetString (SysEncInEffect ()? "PIM_SYSENC_HELP" : "PIM_HELP"));
+
+ if (CreatingHiddenSysVol())
+ SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString ("PIM_HIDDEN_OS_TITLE"));
+ else if (bHiddenVol)
+ SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString (bHiddenVolHost ? "PIM_HIDVOL_HOST_TITLE" : "PIM_HIDVOL_TITLE"));
+ else if (WizardMode == WIZARD_MODE_SYS_DEVICE)
+ SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString ("PIM"));
+ else
+ SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString ("PIM_TITLE"));
+
+ SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), GetString ("NEXT"));
+ SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_PREV), GetString ("PREV"));
+
+ EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_PREV), TRUE);
+ EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), TRUE);
+ }
+ break;
+
case FILESYS_PAGE:
{
wchar_t szTmp[8192];
@@ -5331,6 +5359,25 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
return 1;
}
+ if (hw == EN_CHANGE && nCurPageNo == PIM_PAGE)
+ {
+ if (lw == IDC_PIM)
+ {
+ if(GetPin (hwndDlg, IDC_PIM) != 0)
+ {
+ PinValueChangedWarning = TRUE;
+ SetDlgItemTextW (hwndDlg, IDC_PIM_HELP, GetString (SysEncInEffect ()? "PIM_SYSENC_CHANGE_WARNING" : "PIM_CHANGE_WARNING"));
+ }
+ else
+ {
+ PinValueChangedWarning = FALSE;
+ SetDlgItemTextW (hwndDlg, IDC_PIM_HELP, (wchar_t *) GetDictionaryValueByInt (IDC_PIM_HELP));
+ }
+ }
+
+ return 1;
+ }
+
if (lw == IDC_SHOW_PASSWORD && nCurPageNo == PASSWORD_PAGE)
{
SendMessage (GetDlgItem (hwndDlg, IDC_PASSWORD),
@@ -6995,8 +7042,6 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
volumePassword.Length = (unsigned __int32) strlen ((char *) volumePassword.Text);
- volumePin = GetPin (hCurPage, IDC_PIM);
-
if (volumePassword.Length > 0)
{
// Password character encoding
@@ -7005,14 +7050,8 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
Error ("UNSUPPORTED_CHARS_IN_PWD", hwndDlg);
return 1;
}
- else if (SysEncInEffect() && (volumePin > MAX_BOOT_PIM_VALUE))
- {
- SetFocus (GetDlgItem(hCurPage, IDC_PIM));
- Error ("PIM_SYSENC_TOO_BIG", hwndDlg);
- return 1;
- }
// Check password length (check also done for outer volume which is not the case in TrueCrypt).
- else if (!CheckPasswordLength (hwndDlg, GetDlgItem (hCurPage, IDC_PASSWORD), volumePin, SysEncInEffect()))
+ else if (!CheckPasswordLength (hwndDlg, volumePassword.Length, 0, SysEncInEffect(), FALSE))
{
return 1;
}
@@ -7050,6 +7089,32 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
bKeyboardLayoutChanged = FALSE;
}
+ }
+ }
+
+ else if (nCurPageNo == PIM_PAGE)
+ {
+ volumePin = GetPin (hCurPage, IDC_PIM);
+
+ if (volumePassword.Length > 0)
+ {
+ // Password character encoding
+ if (SysEncInEffect() && (volumePin > MAX_BOOT_PIM_VALUE))
+ {
+ SetFocus (GetDlgItem(hCurPage, IDC_PIM));
+ Error ("PIM_SYSENC_TOO_BIG", hwndDlg);
+ return 1;
+ }
+ // Check password length (check also done for outer volume which is not the case in TrueCrypt).
+ else if (!CheckPasswordLength (hwndDlg, volumePassword.Length, volumePin, SysEncInEffect(), TRUE))
+ {
+ return 1;
+ }
+ }
+
+ if (SysEncInEffect ())
+ {
+
nNewPageNo = SYSENC_COLLECTING_RANDOM_DATA_PAGE - 1; // Skip irrelevant pages
}
@@ -8160,7 +8225,6 @@ ovf_end:
volumePassword.Length = (unsigned __int32) strlen ((char *) volumePassword.Text);
- volumePin = GetPin (hCurPage, IDC_PIM);
nNewPageNo = SIZE_PAGE + 1; // Skip the hidden volume host password page
@@ -8183,6 +8247,11 @@ ovf_end:
nNewPageNo = CIPHER_PAGE + 1;
}
+ else if (nCurPageNo == PIM_PAGE)
+ {
+ volumePin = GetPin (hCurPage, IDC_PIM);
+ }
+
else if (nCurPageNo == HIDDEN_VOL_HOST_PASSWORD_PAGE
|| nCurPageNo == NONSYS_INPLACE_ENC_RESUME_PASSWORD_PAGE)
{
@@ -8208,7 +8277,7 @@ ovf_end:
tmp [sizeof(tmp)-1] = 0;
SetWindowText (hRandPoolSys, tmp);
- nNewPageNo = PASSWORD_PAGE + 1; // Skip irrelevant pages
+ nNewPageNo = PIM_PAGE + 1; // Skip irrelevant pages
}
else if (nCurPageNo == SYSENC_KEYS_GEN_PAGE)
@@ -8252,7 +8321,7 @@ ovf_end:
nNewPageNo = FILESYS_PAGE + 1;
}
else
- nNewPageNo = PASSWORD_PAGE + 1;
+ nNewPageNo = PIM_PAGE + 1;
}
}