diff options
author | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2015-07-19 08:46:27 +0200 |
---|---|---|
committer | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2015-07-19 11:29:45 +0200 |
commit | 515895342820a9d0a35391ec4d316c3782a75768 (patch) | |
tree | b3c64668eba1bd654914acd42e986d6f90d80462 /src | |
parent | 63818bcaa44b9ce0b59ac2c56afdee1f5e1976ba (diff) | |
download | VeraCrypt-515895342820a9d0a35391ec4d316c3782a75768.tar.gz VeraCrypt-515895342820a9d0a35391ec4d316c3782a75768.zip |
User Interface enhancements for PIM
Diffstat (limited to 'src')
-rw-r--r-- | src/Main/CommandLineInterface.cpp | 14 | ||||
-rw-r--r-- | src/Main/Forms/ChangePasswordDialog.cpp | 7 | ||||
-rw-r--r-- | src/Main/Forms/Forms.cpp | 31 | ||||
-rw-r--r-- | src/Main/Forms/Forms.h | 2 | ||||
-rw-r--r-- | src/Main/Forms/MainFrame.cpp | 17 | ||||
-rw-r--r-- | src/Main/Forms/TrueCrypt.fbp | 115 | ||||
-rw-r--r-- | src/Main/Forms/VolumeCreationWizard.cpp | 33 | ||||
-rw-r--r-- | src/Main/Forms/VolumePasswordPanel.cpp | 97 | ||||
-rw-r--r-- | src/Main/Forms/VolumePasswordPanel.h | 11 | ||||
-rw-r--r-- | src/Main/Forms/VolumePasswordWizardPage.h | 5 | ||||
-rw-r--r-- | src/Main/Forms/VolumePimWizardPage.cpp | 25 | ||||
-rw-r--r-- | src/Main/Forms/VolumePimWizardPage.h | 2 |
12 files changed, 305 insertions, 54 deletions
diff --git a/src/Main/CommandLineInterface.cpp b/src/Main/CommandLineInterface.cpp index 7eaef070..c3c82f42 100644 --- a/src/Main/CommandLineInterface.cpp +++ b/src/Main/CommandLineInterface.cpp @@ -378,13 +378,16 @@ namespace VeraCrypt try { ArgNewPim = StringConverter::ToInt32 (wstring (str)); - if (ArgNewPim < 0) - throw_err (LangString["PARAMETER_INCORRECT"] + L": " + str); } catch (...) { throw_err (LangString["PARAMETER_INCORRECT"] + L": " + str); } + + if (ArgNewPim < 0) + throw_err (LangString["PARAMETER_INCORRECT"] + L": " + str); + else if (ArgNewPim > 0 && ArgTrueCryptMode) + throw_err (LangString["PIM_NOT_SUPPORTED_FOR_TRUECRYPT_MODE"]); } if (parser.Found (L"non-interactive")) @@ -403,13 +406,16 @@ namespace VeraCrypt try { ArgPim = StringConverter::ToInt32 (wstring (str)); - if (ArgPim < 0) - throw_err (LangString["PARAMETER_INCORRECT"] + L": " + str); } catch (...) { throw_err (LangString["PARAMETER_INCORRECT"] + L": " + str); } + + if (ArgPim < 0) + throw_err (LangString["PARAMETER_INCORRECT"] + L": " + str); + else if (ArgPim > 0 && ArgTrueCryptMode) + throw_err (LangString["PIM_NOT_SUPPORTED_FOR_TRUECRYPT_MODE"]); } if (parser.Found (L"protect-hidden", &str)) diff --git a/src/Main/Forms/ChangePasswordDialog.cpp b/src/Main/Forms/ChangePasswordDialog.cpp index 702b01e4..1cb920ee 100644 --- a/src/Main/Forms/ChangePasswordDialog.cpp +++ b/src/Main/Forms/ChangePasswordDialog.cpp @@ -227,5 +227,12 @@ namespace VeraCrypt } OKButton->Enable (ok); + + if (DialogMode == Mode::ChangePasswordAndKeyfiles) + { + bool pimChanged = (CurrentPasswordPanel->GetVolumePim() != NewPasswordPanel->GetVolumePim()); + NewPasswordPanel->UpdatePimHelpText(pimChanged); + } + } } diff --git a/src/Main/Forms/Forms.cpp b/src/Main/Forms/Forms.cpp index ea769954..f6c20cec 100644 --- a/src/Main/Forms/Forms.cpp +++ b/src/Main/Forms/Forms.cpp @@ -861,7 +861,7 @@ ChangePasswordDialogBase::ChangePasswordDialogBase( wxWindow* parent, wxWindowID CurrentPasswordPanelSizer = new wxBoxSizer( wxVERTICAL );
- CurrentSizer->Add( CurrentPasswordPanelSizer, 0, wxALIGN_RIGHT, 5 );
+ CurrentSizer->Add( CurrentPasswordPanelSizer, 0, wxALIGN_LEFT, 5 );
bSizer32->Add( CurrentSizer, 0, wxEXPAND, 5 );
@@ -871,7 +871,7 @@ ChangePasswordDialogBase::ChangePasswordDialogBase( wxWindow* parent, wxWindowID NewPasswordPanelSizer = new wxBoxSizer( wxVERTICAL );
- NewSizer->Add( NewPasswordPanelSizer, 0, wxALIGN_RIGHT, 5 );
+ NewSizer->Add( NewPasswordPanelSizer, 0, wxALIGN_LEFT, 5 );
bSizer32->Add( NewSizer, 0, wxTOP|wxEXPAND, 5 );
@@ -3217,50 +3217,53 @@ VolumePasswordPanelBase::VolumePasswordPanelBase( wxWindow* parent, wxWindowID i VolumePimHelpStaticText->Wrap( -1 );
GridBagSizer->Add( VolumePimHelpStaticText, wxGBPosition( 3, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxBOTTOM|wxLEFT|wxRIGHT, 5 );
+ PimCheckBox = new wxCheckBox( this, wxID_ANY, _("Use PIM"), wxDefaultPosition, wxDefaultSize, 0 );
+ GridBagSizer->Add( PimCheckBox, wxGBPosition( 4, 1 ), wxGBSpan( 1, 2 ), wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
+
CacheCheckBox = new wxCheckBox( this, wxID_ANY, _("Cach&e passwords and keyfiles in memory "), wxDefaultPosition, wxDefaultSize, 0 );
- GridBagSizer->Add( CacheCheckBox, wxGBPosition( 4, 1 ), wxGBSpan( 1, 2 ), wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
+ GridBagSizer->Add( CacheCheckBox, wxGBPosition( 5, 1 ), wxGBSpan( 1, 2 ), wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
DisplayPasswordCheckBox = new wxCheckBox( this, wxID_ANY, _("&Display password"), wxDefaultPosition, wxDefaultSize, 0 );
- GridBagSizer->Add( DisplayPasswordCheckBox, wxGBPosition( 5, 1 ), wxGBSpan( 1, 2 ), wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
+ GridBagSizer->Add( DisplayPasswordCheckBox, wxGBPosition( 6, 1 ), wxGBSpan( 1, 2 ), wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
UseKeyfilesCheckBox = new wxCheckBox( this, wxID_ANY, _("U&se keyfiles"), wxDefaultPosition, wxDefaultSize, 0 );
- GridBagSizer->Add( UseKeyfilesCheckBox, wxGBPosition( 6, 1 ), wxGBSpan( 1, 1 ), wxTOP|wxRIGHT|wxLEFT, 5 );
+ GridBagSizer->Add( UseKeyfilesCheckBox, wxGBPosition( 7, 1 ), wxGBSpan( 1, 1 ), wxTOP|wxRIGHT|wxLEFT, 5 );
KeyfilesButton = new wxButton( this, wxID_ANY, _("&Keyfiles..."), wxDefaultPosition, wxDefaultSize, 0 );
- GridBagSizer->Add( KeyfilesButton, wxGBPosition( 6, 2 ), wxGBSpan( 1, 1 ), wxALIGN_RIGHT|wxALIGN_BOTTOM|wxLEFT, 5 );
+ GridBagSizer->Add( KeyfilesButton, wxGBPosition( 7, 2 ), wxGBSpan( 1, 1 ), wxALIGN_RIGHT|wxALIGN_BOTTOM|wxLEFT, 5 );
Pkcs5PrfSizer = new wxBoxSizer( wxVERTICAL );
- GridBagSizer->Add( Pkcs5PrfSizer, wxGBPosition( 7, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxTOP|wxBOTTOM, 5 );
+ GridBagSizer->Add( Pkcs5PrfSizer, wxGBPosition( 8, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxTOP|wxBOTTOM, 5 );
Pkcs5PrfStaticText = new wxStaticText( this, wxID_ANY, _("PKCS-5 PRF:"), wxDefaultPosition, wxDefaultSize, 0 );
Pkcs5PrfStaticText->Wrap( -1 );
- GridBagSizer->Add( Pkcs5PrfStaticText, wxGBPosition( 8, 0 ), wxGBSpan( 1, 1 ), wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
+ GridBagSizer->Add( Pkcs5PrfStaticText, wxGBPosition( 9, 0 ), wxGBSpan( 1, 1 ), wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
wxString Pkcs5PrfChoiceChoices[] = { _("Unchanged") };
int Pkcs5PrfChoiceNChoices = sizeof( Pkcs5PrfChoiceChoices ) / sizeof( wxString );
Pkcs5PrfChoice = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, Pkcs5PrfChoiceNChoices, Pkcs5PrfChoiceChoices, 0 );
Pkcs5PrfChoice->SetSelection( 0 );
- GridBagSizer->Add( Pkcs5PrfChoice, wxGBPosition( 8, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
+ GridBagSizer->Add( Pkcs5PrfChoice, wxGBPosition( 9, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
TrueCryptModeCheckBox = new wxCheckBox( this, wxID_ANY, _("TrueCrypt Mode"), wxDefaultPosition, wxDefaultSize, 0 );
- GridBagSizer->Add( TrueCryptModeCheckBox, wxGBPosition( 8, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
+ GridBagSizer->Add( TrueCryptModeCheckBox, wxGBPosition( 9, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
HeaderWipeCountText = new wxStaticText( this, wxID_ANY, _("Header Wipe:"), wxDefaultPosition, wxDefaultSize, 0 );
HeaderWipeCountText->Wrap( -1 );
- GridBagSizer->Add( HeaderWipeCountText, wxGBPosition( 9, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxRIGHT, 5 );
+ GridBagSizer->Add( HeaderWipeCountText, wxGBPosition( 10, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxRIGHT, 5 );
wxString HeaderWipeCountChoices[] = { _("1-pass"), _("3-pass"), _("7-pass"), _("35-pass"), _("256-pass") };
int HeaderWipeCountNChoices = sizeof( HeaderWipeCountChoices ) / sizeof( wxString );
HeaderWipeCount = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, HeaderWipeCountNChoices, HeaderWipeCountChoices, 0 );
HeaderWipeCount->SetSelection( 1 );
- GridBagSizer->Add( HeaderWipeCount, wxGBPosition( 9, 1 ), wxGBSpan( 1, 1 ), wxALL, 5 );
+ GridBagSizer->Add( HeaderWipeCount, wxGBPosition( 10, 1 ), wxGBSpan( 1, 1 ), wxALL, 5 );
PasswordPlaceholderSizer = new wxBoxSizer( wxVERTICAL );
- GridBagSizer->Add( PasswordPlaceholderSizer, wxGBPosition( 10, 1 ), wxGBSpan( 1, 2 ), wxTOP|wxEXPAND, 5 );
+ GridBagSizer->Add( PasswordPlaceholderSizer, wxGBPosition( 11, 1 ), wxGBSpan( 1, 2 ), wxTOP|wxEXPAND, 5 );
GridBagSizer->AddGrowableCol( 1 );
@@ -3276,6 +3279,7 @@ VolumePasswordPanelBase::VolumePasswordPanelBase( wxWindow* parent, wxWindowID i PasswordTextCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( VolumePasswordPanelBase::OnTextChanged ), NULL, this );
ConfirmPasswordTextCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( VolumePasswordPanelBase::OnTextChanged ), NULL, this );
VolumePimTextCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( VolumePasswordPanelBase::OnPimChanged ), NULL, this );
+ PimCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( VolumePasswordPanelBase::OnUsePimCheckBoxClick ), NULL, this );
DisplayPasswordCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( VolumePasswordPanelBase::OnDisplayPasswordCheckBoxClick ), NULL, this );
UseKeyfilesCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( VolumePasswordPanelBase::OnUseKeyfilesCheckBoxClick ), NULL, this );
KeyfilesButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( VolumePasswordPanelBase::OnKeyfilesButtonClick ), NULL, this );
@@ -3290,6 +3294,7 @@ VolumePasswordPanelBase::~VolumePasswordPanelBase() PasswordTextCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( VolumePasswordPanelBase::OnTextChanged ), NULL, this );
ConfirmPasswordTextCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( VolumePasswordPanelBase::OnTextChanged ), NULL, this );
VolumePimTextCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( VolumePasswordPanelBase::OnPimChanged ), NULL, this );
+ PimCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( VolumePasswordPanelBase::OnUsePimCheckBoxClick ), NULL, this );
DisplayPasswordCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( VolumePasswordPanelBase::OnDisplayPasswordCheckBoxClick ), NULL, this );
UseKeyfilesCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( VolumePasswordPanelBase::OnUseKeyfilesCheckBoxClick ), NULL, this );
KeyfilesButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( VolumePasswordPanelBase::OnKeyfilesButtonClick ), NULL, this );
diff --git a/src/Main/Forms/Forms.h b/src/Main/Forms/Forms.h index 1c4baa79..e950ac2e 100644 --- a/src/Main/Forms/Forms.h +++ b/src/Main/Forms/Forms.h @@ -963,6 +963,7 @@ namespace VeraCrypt wxStaticText* VolumePimStaticText;
wxTextCtrl* VolumePimTextCtrl;
wxStaticText* VolumePimHelpStaticText;
+ wxCheckBox* PimCheckBox;
wxCheckBox* CacheCheckBox;
wxCheckBox* DisplayPasswordCheckBox;
wxCheckBox* UseKeyfilesCheckBox;
@@ -978,6 +979,7 @@ namespace VeraCrypt // Virtual event handlers, overide them in your derived class
virtual void OnTextChanged( wxCommandEvent& event ) { event.Skip(); }
virtual void OnPimChanged( wxCommandEvent& event ) { event.Skip(); }
+ virtual void OnUsePimCheckBoxClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnDisplayPasswordCheckBoxClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnUseKeyfilesCheckBoxClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnKeyfilesButtonClick( wxCommandEvent& event ) { event.Skip(); }
diff --git a/src/Main/Forms/MainFrame.cpp b/src/Main/Forms/MainFrame.cpp index b4f2983f..0799f325 100644 --- a/src/Main/Forms/MainFrame.cpp +++ b/src/Main/Forms/MainFrame.cpp @@ -638,6 +638,10 @@ namespace VeraCrypt { mountOptions.Kdf = Pkcs5Kdf::GetAlgorithm (*CmdLine->ArgHash, mountOptions.TrueCryptMode); } + if (CmdLine->ArgPim > 0) + { + mountOptions.Pim = CmdLine->ArgPim; + } if (SlotListCtrl->GetSelectedItemCount() == 1) mountOptions.SlotNumber = SelectedSlotNumber; @@ -663,6 +667,11 @@ namespace VeraCrypt { mountOptions.Kdf = Pkcs5Kdf::GetAlgorithm (*CmdLine->ArgHash, mountOptions.TrueCryptMode); } + if (CmdLine->ArgPim > 0) + { + mountOptions.Pim = CmdLine->ArgPim; + } + Gui->MountAllFavoriteVolumes (mountOptions); } catch (exception &e) @@ -693,6 +702,10 @@ namespace VeraCrypt { mountOptions.Kdf = Pkcs5Kdf::GetAlgorithm (*CmdLine->ArgHash, mountOptions.TrueCryptMode); } + if (CmdLine->ArgPim > 0) + { + mountOptions.Pim = CmdLine->ArgPim; + } try { @@ -945,6 +958,10 @@ namespace VeraCrypt { mountOptions.Kdf = Pkcs5Kdf::GetAlgorithm (*CmdLine->ArgHash, mountOptions.TrueCryptMode); } + if (CmdLine->ArgPim > 0) + { + mountOptions.Pim = CmdLine->ArgPim; + } favorite.ToMountOptions (mountOptions); shared_ptr <VolumeInfo> volume = Gui->MountVolume (mountOptions); diff --git a/src/Main/Forms/TrueCrypt.fbp b/src/Main/Forms/TrueCrypt.fbp index 78ecb556..25dfe831 100644 --- a/src/Main/Forms/TrueCrypt.fbp +++ b/src/Main/Forms/TrueCrypt.fbp @@ -5063,7 +5063,7 @@ <event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
- <property name="flag">wxALIGN_RIGHT</property>
+ <property name="flag">wxALIGN_LEFT</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
@@ -5088,7 +5088,7 @@ <event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
- <property name="flag">wxALIGN_RIGHT</property>
+ <property name="flag">wxALIGN_LEFT</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
@@ -26135,6 +26135,97 @@ <property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
+ <property name="label">Use PIM</property>
+ <property name="max_size"></property>
+ <property name="maximize_button">0</property>
+ <property name="maximum_size"></property>
+ <property name="min_size"></property>
+ <property name="minimize_button">0</property>
+ <property name="minimum_size"></property>
+ <property name="moveable">1</property>
+ <property name="name">PimCheckBox</property>
+ <property name="pane_border">1</property>
+ <property name="pane_position"></property>
+ <property name="pane_size"></property>
+ <property name="permission">protected</property>
+ <property name="pin_button">1</property>
+ <property name="pos"></property>
+ <property name="resize">Resizable</property>
+ <property name="show">1</property>
+ <property name="size"></property>
+ <property name="style"></property>
+ <property name="subclass"></property>
+ <property name="toolbar_pane">0</property>
+ <property name="tooltip"></property>
+ <property name="validator_data_type"></property>
+ <property name="validator_style">wxFILTER_NONE</property>
+ <property name="validator_type">wxDefaultValidator</property>
+ <property name="validator_variable"></property>
+ <property name="window_extra_style"></property>
+ <property name="window_name"></property>
+ <property name="window_style"></property>
+ <event name="OnChar"></event>
+ <event name="OnCheckBox">OnUsePimCheckBoxClick</event>
+ <event name="OnEnterWindow"></event>
+ <event name="OnEraseBackground"></event>
+ <event name="OnKeyDown"></event>
+ <event name="OnKeyUp"></event>
+ <event name="OnKillFocus"></event>
+ <event name="OnLeaveWindow"></event>
+ <event name="OnLeftDClick"></event>
+ <event name="OnLeftDown"></event>
+ <event name="OnLeftUp"></event>
+ <event name="OnMiddleDClick"></event>
+ <event name="OnMiddleDown"></event>
+ <event name="OnMiddleUp"></event>
+ <event name="OnMotion"></event>
+ <event name="OnMouseEvents"></event>
+ <event name="OnMouseWheel"></event>
+ <event name="OnPaint"></event>
+ <event name="OnRightDClick"></event>
+ <event name="OnRightDown"></event>
+ <event name="OnRightUp"></event>
+ <event name="OnSetFocus"></event>
+ <event name="OnSize"></event>
+ <event name="OnUpdateUI"></event>
+ </object>
+ </object>
+ <object class="gbsizeritem" expanded="0">
+ <property name="border">5</property>
+ <property name="colspan">2</property>
+ <property name="column">1</property>
+ <property name="flag">wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_VERTICAL</property>
+ <property name="row">5</property>
+ <property name="rowspan">1</property>
+ <object class="wxCheckBox" expanded="0">
+ <property name="BottomDockable">1</property>
+ <property name="LeftDockable">1</property>
+ <property name="RightDockable">1</property>
+ <property name="TopDockable">1</property>
+ <property name="aui_layer"></property>
+ <property name="aui_name"></property>
+ <property name="aui_position"></property>
+ <property name="aui_row"></property>
+ <property name="best_size"></property>
+ <property name="bg"></property>
+ <property name="caption"></property>
+ <property name="caption_visible">1</property>
+ <property name="center_pane">0</property>
+ <property name="checked">0</property>
+ <property name="close_button">1</property>
+ <property name="context_help"></property>
+ <property name="context_menu">1</property>
+ <property name="default_pane">0</property>
+ <property name="dock">Dock</property>
+ <property name="dock_fixed">0</property>
+ <property name="docking">Left</property>
+ <property name="enabled">1</property>
+ <property name="fg"></property>
+ <property name="floatable">1</property>
+ <property name="font"></property>
+ <property name="gripper">0</property>
+ <property name="hidden">0</property>
+ <property name="id">wxID_ANY</property>
<property name="label">Cach&e passwords and keyfiles in memory </property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -26195,7 +26286,7 @@ <property name="colspan">2</property>
<property name="column">1</property>
<property name="flag">wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_VERTICAL</property>
- <property name="row">5</property>
+ <property name="row">6</property>
<property name="rowspan">1</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
@@ -26286,7 +26377,7 @@ <property name="colspan">1</property>
<property name="column">1</property>
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
- <property name="row">6</property>
+ <property name="row">7</property>
<property name="rowspan">1</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
@@ -26377,7 +26468,7 @@ <property name="colspan">1</property>
<property name="column">2</property>
<property name="flag">wxALIGN_RIGHT|wxALIGN_BOTTOM|wxLEFT</property>
- <property name="row">6</property>
+ <property name="row">7</property>
<property name="rowspan">1</property>
<object class="wxButton" expanded="1">
<property name="BottomDockable">1</property>
@@ -26468,7 +26559,7 @@ <property name="colspan">1</property>
<property name="column">1</property>
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM</property>
- <property name="row">7</property>
+ <property name="row">8</property>
<property name="rowspan">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
@@ -26482,7 +26573,7 @@ <property name="colspan">1</property>
<property name="column">0</property>
<property name="flag">wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxRIGHT</property>
- <property name="row">8</property>
+ <property name="row">9</property>
<property name="rowspan">1</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
@@ -26568,7 +26659,7 @@ <property name="colspan">1</property>
<property name="column">1</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT</property>
- <property name="row">8</property>
+ <property name="row">9</property>
<property name="rowspan">1</property>
<object class="wxChoice" expanded="1">
<property name="BottomDockable">1</property>
@@ -26659,7 +26750,7 @@ <property name="colspan">1</property>
<property name="column">2</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT</property>
- <property name="row">8</property>
+ <property name="row">9</property>
<property name="rowspan">1</property>
<object class="wxCheckBox" expanded="0">
<property name="BottomDockable">1</property>
@@ -26750,7 +26841,7 @@ <property name="colspan">1</property>
<property name="column">0</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxRIGHT</property>
- <property name="row">9</property>
+ <property name="row">10</property>
<property name="rowspan">1</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
@@ -26836,7 +26927,7 @@ <property name="colspan">1</property>
<property name="column">1</property>
<property name="flag">wxALL</property>
- <property name="row">9</property>
+ <property name="row">10</property>
<property name="rowspan">1</property>
<object class="wxChoice" expanded="1">
<property name="BottomDockable">1</property>
@@ -26927,7 +27018,7 @@ <property name="colspan">2</property>
<property name="column">1</property>
<property name="flag">wxTOP|wxEXPAND</property>
- <property name="row">10</property>
+ <property name="row">11</property>
<property name="rowspan">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
diff --git a/src/Main/Forms/VolumeCreationWizard.cpp b/src/Main/Forms/VolumeCreationWizard.cpp index 8382127a..440155c7 100644 --- a/src/Main/Forms/VolumeCreationWizard.cpp +++ b/src/Main/Forms/VolumeCreationWizard.cpp @@ -42,6 +42,7 @@ namespace VeraCrypt SelectedFilesystemType (VolumeCreationOptions::FilesystemType::FAT), SelectedVolumeHostType (VolumeHostType::File), SelectedVolumeType (VolumeType::Normal), + Pim (0), SectorSize (0), VolumeSize (0) { @@ -85,6 +86,7 @@ namespace VeraCrypt OuterVolume = false; LargeFilesSupport = false; QuickFormatEnabled = false; + Pim = 0; SingleChoiceWizardPage <VolumeHostType::Enum> *page = new SingleChoiceWizardPage <VolumeHostType::Enum> (GetPageParent(), wxEmptyString, true); page->SetMinSize (wxSize (Gui->GetCharWidth (this) * 58, Gui->GetCharHeight (this) * 18 + 5)); @@ -186,6 +188,8 @@ namespace VeraCrypt case Step::VolumePassword: { VolumePasswordWizardPage *page = new VolumePasswordWizardPage (GetPageParent(), Password, Keyfiles); + page->EnableUsePim (); // force displaying "Use PIM" + page->SetPimSelected (Pim > 0); if (OuterVolume) page->SetPageTitle (LangString["PASSWORD_HIDVOL_HOST_TITLE"]); @@ -210,6 +214,7 @@ namespace VeraCrypt page->SetPageTitle (LangString["PIM_TITLE"]); page->SetPageText (LangString["PIM_HELP"]); + page->SetVolumePim (Pim); return page; } @@ -339,6 +344,7 @@ namespace VeraCrypt ClearHistory(); OuterVolume = false; LargeFilesSupport = false; + Pim = 0; InfoWizardPage *page = new InfoWizardPage (GetPageParent()); page->SetPageTitle (LangString["HIDVOL_PRE_CIPHER_TITLE"]); @@ -747,8 +753,33 @@ namespace VeraCrypt } } } + + if (page->IsPimSelected ()) + return Step::VolumePim; + else + { + // Clear PIM + Pim = 0; + + // Skip PIM + if (forward && OuterVolume) + { + // Use FAT to prevent problems with free space + QuickFormatEnabled = false; + SelectedFilesystemType = VolumeCreationOptions::FilesystemType::FAT; + return Step::CreationProgress; + } - return Step::VolumePim; + if (VolumeSize > 4 * BYTES_PER_GB) + { + if (VolumeSize <= TC_MAX_FAT_SECTOR_COUNT * SectorSize) + return Step::LargeFilesSupport; + else + SelectedFilesystemType = VolumeCreationOptions::FilesystemType::GetPlatformNative(); + } + + return Step::FormatOptions; + } } case Step::VolumePim: diff --git a/src/Main/Forms/VolumePasswordPanel.cpp b/src/Main/Forms/VolumePasswordPanel.cpp index 0d1e6931..08b9b828 100644 --- a/src/Main/Forms/VolumePasswordPanel.cpp +++ b/src/Main/Forms/VolumePasswordPanel.cpp @@ -15,7 +15,7 @@ namespace VeraCrypt { VolumePasswordPanel::VolumePasswordPanel (wxWindow* parent, MountOptions* options, shared_ptr <VolumePassword> password, bool disableTruecryptMode, shared_ptr <KeyfileList> keyfiles, bool enableCache, bool enablePassword, bool enableKeyfiles, bool enableConfirmation, bool enablePkcs5Prf, bool isMountPassword, const wxString &passwordLabel) - : VolumePasswordPanelBase (parent), Keyfiles (new KeyfileList) + : VolumePasswordPanelBase (parent), Keyfiles (new KeyfileList), EnablePimEntry (true) { if (keyfiles) { @@ -55,9 +55,17 @@ namespace VeraCrypt PasswordTextCtrl->Show (enablePassword); DisplayPasswordCheckBox->Show (enablePassword); - VolumePimStaticText->Show (enablePassword && (!enableConfirmation || (enablePkcs5Prf && !isMountPassword))); - VolumePimTextCtrl->Show (enablePassword && (!enableConfirmation || (enablePkcs5Prf && !isMountPassword))); - VolumePimHelpStaticText->Show (enablePassword && (!enableConfirmation || (enablePkcs5Prf && !isMountPassword))); + + EnablePimEntry = enablePassword && (!enableConfirmation || (enablePkcs5Prf && !isMountPassword)); + PimCheckBox->Show (EnablePimEntry); + VolumePimStaticText->Show (false); + VolumePimTextCtrl->Show (false); + VolumePimHelpStaticText->Show (false); + + wxTextValidator validator (wxFILTER_INCLUDE_CHAR_LIST); // wxFILTER_NUMERIC does not exclude - . , etc. + const wxChar *valArr[] = { L"0", L"1", L"2", L"3", L"4", L"5", L"6", L"7", L"8", L"9" }; + validator.SetIncludes (wxArrayString (array_capacity (valArr), (const wxChar **) &valArr)); + VolumePimTextCtrl->SetValidator (validator); ConfirmPasswordStaticText->Show (enableConfirmation); ConfirmPasswordTextCtrl->Show (enableConfirmation); @@ -76,12 +84,23 @@ namespace VeraCrypt TrueCryptModeCheckBox->SetValue (options->TrueCryptMode); if (options->TrueCryptMode) { + PimCheckBox->Enable (false); VolumePimStaticText->Enable (false); VolumePimTextCtrl->Enable (false); VolumePimHelpStaticText->Enable (false); } } + if (EnablePimEntry && options && options->Pim > 0) + { + PimCheckBox->SetValue (true); + PimCheckBox->Show (false); + VolumePimStaticText->Show (true); + VolumePimTextCtrl->Show (true); + VolumePimHelpStaticText->Show (true); + SetVolumePim (options->Pim); + } + if (enablePkcs5Prf) { int index, prfInitialIndex = 0; @@ -225,7 +244,7 @@ namespace VeraCrypt int VolumePasswordPanel::GetVolumePim () const { - if (VolumePimTextCtrl->IsEnabled ()) + if (VolumePimTextCtrl->IsEnabled () && VolumePimTextCtrl->IsShown ()) { wxString pimStr (VolumePimTextCtrl->GetValue()); long pim = 0; @@ -239,7 +258,19 @@ namespace VeraCrypt else return 0; } - + + void VolumePasswordPanel::SetVolumePim (int pim) + { + if (pim > 0) + { + VolumePimTextCtrl->SetValue (StringConverter::FromNumber (pim)); + } + else + { + VolumePimTextCtrl->SetValue (wxT("")); + } + } + bool VolumePasswordPanel::GetTrueCryptMode () const { return TrueCryptModeCheckBox->GetValue (); @@ -379,27 +410,53 @@ namespace VeraCrypt textCtrl->SetValue (wxString (L'X', textCtrl->GetLineLength(0))); GetPassword (textCtrl); } - - void VolumePasswordPanel::OnPimChanged (wxCommandEvent& event) - { - if (ConfirmPasswordTextCtrl->IsShown()) + + bool VolumePasswordPanel::UpdatePimHelpText (bool pimChanged) + { + bool guiUpdated = false; + if (pimChanged && VolumePimHelpStaticText->GetForegroundColour() != *wxRED) { - if (GetVolumePim() != 0) - { - VolumePimHelpStaticText->SetForegroundColour(*wxRED); - VolumePimHelpStaticText->SetLabel(LangString["PIM_CHANGE_WARNING"]); - } - else - { - VolumePimHelpStaticText->SetForegroundColour(*wxBLACK); - VolumePimHelpStaticText->SetLabel(LangString["IDC_PIM_HELP"]); - } + VolumePimHelpStaticText->SetForegroundColour(*wxRED); + VolumePimHelpStaticText->SetLabel(LangString["PIM_CHANGE_WARNING"]); + guiUpdated = true; + } + if (!pimChanged && VolumePimHelpStaticText->GetForegroundColour() != *wxBLACK) + { + VolumePimHelpStaticText->SetForegroundColour(*wxBLACK); + VolumePimHelpStaticText->SetLabel(LangString["IDC_PIM_HELP"]); + guiUpdated = true; + } + + if (guiUpdated) + { + Layout(); + Fit(); + GetParent()->Layout(); + GetParent()->Fit(); + } + return guiUpdated; + } + + void VolumePasswordPanel::OnUsePimCheckBoxClick( wxCommandEvent& event ) + { + if (EnablePimEntry) + { + PimCheckBox->Show (false); + VolumePimStaticText->Show (true); + VolumePimTextCtrl->Show (true); + VolumePimHelpStaticText->Show (true); + + Layout(); + Fit(); + GetParent()->Layout(); + GetParent()->Fit(); } } void VolumePasswordPanel::OnTrueCryptModeChecked( wxCommandEvent& event ) { bool bEnablePIM = !GetTrueCryptMode (); + PimCheckBox->Enable (bEnablePIM); VolumePimStaticText->Enable (bEnablePIM); VolumePimTextCtrl->Enable (bEnablePIM); VolumePimHelpStaticText->Enable (bEnablePIM); diff --git a/src/Main/Forms/VolumePasswordPanel.h b/src/Main/Forms/VolumePasswordPanel.h index f090a2bc..3518b2bb 100644 --- a/src/Main/Forms/VolumePasswordPanel.h +++ b/src/Main/Forms/VolumePasswordPanel.h @@ -30,8 +30,13 @@ namespace VeraCrypt int GetHeaderWipeCount () const; void SetCacheCheckBoxValidator (const wxGenericValidator &validator) { CacheCheckBox->SetValidator (validator); } void SetFocusToPasswordTextCtrl () { PasswordTextCtrl->SetSelection (-1, -1); PasswordTextCtrl->SetFocus(); } - void SetFocusToPimTextCtrl () { VolumePimTextCtrl->SetSelection (-1, -1); VolumePimTextCtrl->SetFocus(); } + void SetFocusToPimTextCtrl () { VolumePimTextCtrl->SetSelection (-1, -1); VolumePimTextCtrl->SetFocus(); } + void SetVolumePim (int pim); bool PasswordsMatch () const; + void EnableUsePim () { PimCheckBox->Enable (true); PimCheckBox->Show (true); } + bool IsUsePimChecked () const { return PimCheckBox->GetValue (); } + void SetUsePimChecked (bool checked) const { PimCheckBox->SetValue (checked); } + bool UpdatePimHelpText (bool pimChanged); Event UpdateEvent; @@ -46,7 +51,8 @@ namespace VeraCrypt void OnKeyfilesButtonRightClick (wxMouseEvent& event); void OnKeyfilesButtonRightDown (wxMouseEvent& event); void OnTextChanged (wxCommandEvent& event) { OnUpdate(); } - void OnPimChanged (wxCommandEvent& event); + void OnPimChanged (wxCommandEvent& event) { OnUpdate(); } + void OnUsePimCheckBoxClick( wxCommandEvent& event ); void OnUpdate () { UpdateEvent.Raise(); } void OnUseKeyfilesCheckBoxClick (wxCommandEvent& event) { OnUpdate(); } void WipeTextCtrl (wxTextCtrl *textCtrl); @@ -54,6 +60,7 @@ namespace VeraCrypt shared_ptr <KeyfileList> Keyfiles; shared_ptr <Functor> UpdateCallback; + bool EnablePimEntry; }; } diff --git a/src/Main/Forms/VolumePasswordWizardPage.h b/src/Main/Forms/VolumePasswordWizardPage.h index aad86c86..652aed88 100644 --- a/src/Main/Forms/VolumePasswordWizardPage.h +++ b/src/Main/Forms/VolumePasswordWizardPage.h @@ -22,7 +22,10 @@ namespace VeraCrypt shared_ptr <KeyfileList> GetKeyfiles () const { return PasswordPanel->GetKeyfiles(); } shared_ptr <VolumePassword> GetPassword () const { return PasswordPanel->GetPassword(); } - int GetVolumePim () const { return PasswordPanel->GetVolumePim(); } + void EnableUsePim () { PasswordPanel->EnableUsePim (); } + bool IsPimSelected () const { return PasswordPanel->IsUsePimChecked ();} + void SetPimSelected (bool selected) const { PasswordPanel->SetUsePimChecked (selected);} + shared_ptr <Pkcs5Kdf> GetPkcs5Kdf () const { return PasswordPanel->GetPkcs5Kdf(); } bool IsValid (); void SetMaxStaticTextWidth (int width) { InfoStaticText->Wrap (width); } diff --git a/src/Main/Forms/VolumePimWizardPage.cpp b/src/Main/Forms/VolumePimWizardPage.cpp index 58d9d6af..36dc4c7f 100644 --- a/src/Main/Forms/VolumePimWizardPage.cpp +++ b/src/Main/Forms/VolumePimWizardPage.cpp @@ -23,6 +23,10 @@ namespace VeraCrypt VolumePimWizardPage::VolumePimWizardPage (wxPanel* parent) : VolumePimWizardPageBase (parent) { + wxTextValidator validator (wxFILTER_INCLUDE_CHAR_LIST); // wxFILTER_NUMERIC does not exclude - . , etc. + const wxChar *valArr[] = { L"0", L"1", L"2", L"3", L"4", L"5", L"6", L"7", L"8", L"9" }; + validator.SetIncludes (wxArrayString (array_capacity (valArr), (const wxChar **) &valArr)); + VolumePimTextCtrl->SetValidator (validator); } VolumePimWizardPage::~VolumePimWizardPage () @@ -46,6 +50,20 @@ namespace VeraCrypt return 0; } + void VolumePimWizardPage::SetVolumePim (int pim) + { + if (pim > 0) + { + VolumePimTextCtrl->SetValue (StringConverter::FromNumber (pim)); + } + else + { + VolumePimTextCtrl->SetValue (wxT("")); + } + + OnPimChanged (pim); + } + bool VolumePimWizardPage::IsValid () { return true; @@ -53,7 +71,12 @@ namespace VeraCrypt void VolumePimWizardPage::OnPimChanged (wxCommandEvent& event) { - if (GetVolumePim() != 0) + OnPimChanged (GetVolumePim ()); + } + + void VolumePimWizardPage::OnPimChanged (int pim) + { + if (pim > 0) { VolumePimHelpStaticText->SetForegroundColour(*wxRED); VolumePimHelpStaticText->SetLabel(LangString["PIM_CHANGE_WARNING"]); diff --git a/src/Main/Forms/VolumePimWizardPage.h b/src/Main/Forms/VolumePimWizardPage.h index eff35e1e..ae097004 100644 --- a/src/Main/Forms/VolumePimWizardPage.h +++ b/src/Main/Forms/VolumePimWizardPage.h @@ -28,12 +28,14 @@ namespace VeraCrypt ~VolumePimWizardPage (); int GetVolumePim () const; + void SetVolumePim (int pim); bool IsValid (); void SetMaxStaticTextWidth (int width) { InfoStaticText->Wrap (width); } void SetPageText (const wxString &text) { InfoStaticText->SetLabel (text); } protected: void OnPimChanged (wxCommandEvent& event); + void OnPimChanged (int pim); }; } |