VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Main/Forms
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2014-12-30 16:01:49 (GMT)
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2014-12-30 16:06:20 (GMT)
commitc178e325b807258199ae45b2c50c265b4d7ce7af (patch)
tree905297a12e86b71d4611ff13d1df7e99c1e20b61 /src/Main/Forms
parent8d787dcd7128fce554f473da62e20162b0b6c9c4 (diff)
downloadVeraCrypt-c178e325b807258199ae45b2c50c265b4d7ce7af.zip
VeraCrypt-c178e325b807258199ae45b2c50c265b4d7ce7af.tar.gz
Linux/MacOSX: Implement TrueCrypt conversion and loading support. Correct many GTK issues linked to multi-threaded origine of events by implementing an automatic mechanism for handling such requests in the main thread.
Diffstat (limited to 'src/Main/Forms')
-rw-r--r--[-rwxr-xr-x]src/Main/Forms/ChangePasswordDialog.cpp14
-rw-r--r--[-rwxr-xr-x]src/Main/Forms/Forms.cpp5
-rw-r--r--[-rwxr-xr-x]src/Main/Forms/Forms.h1
-rw-r--r--src/Main/Forms/MainFrame.cpp4
-rw-r--r--[-rwxr-xr-x]src/Main/Forms/MountOptionsDialog.cpp12
-rw-r--r--[-rwxr-xr-x]src/Main/Forms/TrueCrypt.fbp93
-rw-r--r--src/Main/Forms/VolumeCreationWizard.cpp4
-rw-r--r--[-rwxr-xr-x]src/Main/Forms/VolumePasswordPanel.cpp12
-rw-r--r--[-rwxr-xr-x]src/Main/Forms/VolumePasswordPanel.h3
-rw-r--r--[-rwxr-xr-x]src/Main/Forms/VolumePasswordWizardPage.cpp2
-rw-r--r--src/Main/Forms/VolumePropertiesDialog.cpp2
-rw-r--r--[-rwxr-xr-x]src/Main/Forms/WaitDialog.cpp11
-rw-r--r--[-rwxr-xr-x]src/Main/Forms/WaitDialog.h122
13 files changed, 264 insertions, 21 deletions
diff --git a/src/Main/Forms/ChangePasswordDialog.cpp b/src/Main/Forms/ChangePasswordDialog.cpp
index 75fe717..1bde4be 100755..100644
--- a/src/Main/Forms/ChangePasswordDialog.cpp
+++ b/src/Main/Forms/ChangePasswordDialog.cpp
@@ -48,11 +48,11 @@ namespace VeraCrypt
throw ParameterIncorrect (SRC_POS);
}
- CurrentPasswordPanel = new VolumePasswordPanel (this, password, keyfiles, false, true, true, false, true, true);
+ CurrentPasswordPanel = new VolumePasswordPanel (this, password, false, keyfiles, false, true, true, false, true, true);
CurrentPasswordPanel->UpdateEvent.Connect (EventConnector <ChangePasswordDialog> (this, &ChangePasswordDialog::OnPasswordPanelUpdate));
CurrentPasswordPanelSizer->Add (CurrentPasswordPanel, 1, wxALL | wxEXPAND);
- NewPasswordPanel = new VolumePasswordPanel (this, newPassword, newKeyfiles, false, enableNewPassword, enableNewKeyfiles, enableNewPassword, enablePkcs5Prf);
+ NewPasswordPanel = new VolumePasswordPanel (this, newPassword, true, newKeyfiles, false, enableNewPassword, enableNewKeyfiles, enableNewPassword, enablePkcs5Prf);
NewPasswordPanel->UpdateEvent.Connect (EventConnector <ChangePasswordDialog> (this, &ChangePasswordDialog::OnPasswordPanelUpdate));
NewPasswordPanelSizer->Add (NewPasswordPanel, 1, wxALL | wxEXPAND);
@@ -81,6 +81,14 @@ namespace VeraCrypt
try
{
+ shared_ptr <Pkcs5Kdf> currentKdf = CurrentPasswordPanel->GetPkcs5Kdf();
+ if (currentKdf && CurrentPasswordPanel->GetTrueCryptMode() && (currentKdf->GetName() == L"HMAC-SHA-256"))
+ {
+ Gui->ShowWarning (LangString ["ALGO_NOT_SUPPORTED_FOR_TRUECRYPT_MODE"]);
+ event.Skip();
+ return;
+ }
+
shared_ptr <VolumePassword> newPassword;
if (DialogMode == Mode::ChangePasswordAndKeyfiles)
{
@@ -126,7 +134,7 @@ namespace VeraCrypt
#endif
wxBusyCursor busy;
ChangePasswordThreadRoutine routine(Path, Gui->GetPreferences().DefaultMountOptions.PreserveTimestamps,
- CurrentPasswordPanel->GetPassword(), CurrentPasswordPanel->GetPkcs5Kdf(), CurrentPasswordPanel->GetKeyfiles(),
+ CurrentPasswordPanel->GetPassword(), CurrentPasswordPanel->GetPkcs5Kdf(), CurrentPasswordPanel->GetTrueCryptMode(),CurrentPasswordPanel->GetKeyfiles(),
newPassword, newKeyfiles, NewPasswordPanel->GetPkcs5Kdf(), NewPasswordPanel->GetHeaderWipeCount());
WaitDialog dlg(this, LangString["IDT_STATIC_MODAL_WAIT_DLG_INFO"], &routine);
dlg.Run();
diff --git a/src/Main/Forms/Forms.cpp b/src/Main/Forms/Forms.cpp
index 80a177d..5e28afd 100755..100644
--- a/src/Main/Forms/Forms.cpp
+++ b/src/Main/Forms/Forms.cpp
@@ -3209,7 +3209,10 @@ VolumePasswordPanelBase::VolumePasswordPanelBase( wxWindow* parent, wxWindowID i
int Pkcs5PrfChoiceNChoices = sizeof( Pkcs5PrfChoiceChoices ) / sizeof( wxString );
Pkcs5PrfChoice = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, Pkcs5PrfChoiceNChoices, Pkcs5PrfChoiceChoices, 0 );
Pkcs5PrfChoice->SetSelection( 0 );
- GridBagSizer->Add( Pkcs5PrfChoice, wxGBPosition( 7, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
+ GridBagSizer->Add( Pkcs5PrfChoice, wxGBPosition( 7, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
+
+ TrueCryptModeCheckBox = new wxCheckBox( this, wxID_ANY, _("TrueCrypt Mode"), wxDefaultPosition, wxDefaultSize, 0 );
+ GridBagSizer->Add( TrueCryptModeCheckBox, wxGBPosition( 7, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
HeaderWipeCountText = new wxStaticText( this, wxID_ANY, _("Header Wipe:"), wxDefaultPosition, wxDefaultSize, 0 );
HeaderWipeCountText->Wrap( -1 );
diff --git a/src/Main/Forms/Forms.h b/src/Main/Forms/Forms.h
index b057921..9e8a02b 100755..100644
--- a/src/Main/Forms/Forms.h
+++ b/src/Main/Forms/Forms.h
@@ -962,6 +962,7 @@ namespace VeraCrypt
wxBoxSizer* Pkcs5PrfSizer;
wxStaticText* Pkcs5PrfStaticText;
wxChoice* Pkcs5PrfChoice;
+ wxCheckBox* TrueCryptModeCheckBox;
wxStaticText* HeaderWipeCountText;
wxChoice* HeaderWipeCount;
wxBoxSizer* PasswordPlaceholderSizer;
diff --git a/src/Main/Forms/MainFrame.cpp b/src/Main/Forms/MainFrame.cpp
index fbf2053..ca4d7d6 100644
--- a/src/Main/Forms/MainFrame.cpp
+++ b/src/Main/Forms/MainFrame.cpp
@@ -39,6 +39,7 @@ namespace VeraCrypt
DEFINE_EVENT_TYPE(wxEVT_COMMAND_UPDATE_VOLUME_LIST)
DEFINE_EVENT_TYPE(wxEVT_COMMAND_PREF_UPDATED)
DEFINE_EVENT_TYPE(wxEVT_COMMAND_OPEN_VOLUME_REQUEST)
+ DEFINE_EVENT_TYPE(wxEVT_COMMAND_SHOW_WARNING)
MainFrame::MainFrame (wxWindow* parent) : MainFrameBase (parent),
ListItemRightClickEventPending (false),
@@ -1495,6 +1496,7 @@ namespace VeraCrypt
}
VolumeInfoList protectionTriggeredVolumes;
+ SlotListCtrl->SetColumnWidth(0, wxLIST_AUTOSIZE);
// Update list
long prevItemIndex = -1;
@@ -1516,7 +1518,7 @@ namespace VeraCrypt
#endif
fields[ColumnPath] = volume->Path;
fields[ColumnSize] = Gui->SizeToString (volume->Size);
- fields[ColumnType] = Gui->VolumeTypeToString (volume->Type, volume->Protection);
+ fields[ColumnType] = Gui->VolumeTypeToString (volume->Type, volume->TrueCryptMode, volume->Protection);
if (volume->HiddenVolumeProtectionTriggered)
{
diff --git a/src/Main/Forms/MountOptionsDialog.cpp b/src/Main/Forms/MountOptionsDialog.cpp
index 1ddb779..d4c78cb 100755..100644
--- a/src/Main/Forms/MountOptionsDialog.cpp
+++ b/src/Main/Forms/MountOptionsDialog.cpp
@@ -30,7 +30,7 @@ namespace VeraCrypt
if (disableMountOptions)
OptionsButton->Show (false);
- PasswordPanel = new VolumePasswordPanel (this, options.Password, options.Keyfiles, !disableMountOptions, true, true, false, true, true);
+ PasswordPanel = new VolumePasswordPanel (this, options.Password, disableMountOptions, options.Keyfiles, !disableMountOptions, true, true, false, true, true);
PasswordPanel->SetCacheCheckBoxValidator (wxGenericValidator (&Options.CachePassword));
PasswordSizer->Add (PasswordPanel, 1, wxALL | wxEXPAND);
@@ -61,7 +61,7 @@ namespace VeraCrypt
OptionsButton->SetLabel (OptionsButtonLabel + L" >");
OptionsPanel->Show (false);
- ProtectionPasswordPanel = new VolumePasswordPanel (OptionsPanel, options.ProtectionPassword, options.ProtectionKeyfiles, false, true, true, false, true, true, _("P&assword to hidden volume:"));
+ ProtectionPasswordPanel = new VolumePasswordPanel (OptionsPanel, options.ProtectionPassword, true, options.ProtectionKeyfiles, false, true, true, false, true, true, _("P&assword to hidden volume:"));
ProtectionPasswordSizer->Add (ProtectionPasswordPanel, 1, wxALL | wxEXPAND);
UpdateDialog();
@@ -86,6 +86,7 @@ namespace VeraCrypt
Options.Password = PasswordPanel->GetPassword();
Options.Kdf = PasswordPanel->GetPkcs5Kdf();
+ Options.TrueCryptMode = PasswordPanel->GetTrueCryptMode();
Options.Keyfiles = PasswordPanel->GetKeyfiles();
if (ReadOnlyCheckBox->IsChecked())
@@ -119,6 +120,13 @@ namespace VeraCrypt
{
Gui->ShowWarning (LangString ["UNSUPPORTED_CHARS_IN_PWD_RECOM"]);
}
+
+ if (Options.TrueCryptMode && Options.Kdf && (Options.Kdf->GetName() == L"HMAC-SHA-256"))
+ {
+ Gui->ShowWarning (LangString ["ALGO_NOT_SUPPORTED_FOR_TRUECRYPT_MODE"]);
+ event.Skip();
+ return;
+ }
EndModal (wxID_OK);
}
diff --git a/src/Main/Forms/TrueCrypt.fbp b/src/Main/Forms/TrueCrypt.fbp
index e2fc1ed..c03beab 100755..100644
--- a/src/Main/Forms/TrueCrypt.fbp
+++ b/src/Main/Forms/TrueCrypt.fbp
@@ -26014,7 +26014,7 @@
</object>
<object class="gbsizeritem" expanded="1">
<property name="border">5</property>
- <property name="colspan">2</property>
+ <property name="colspan">1</property>
<property name="column">1</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT</property>
<property name="row">7</property>
@@ -26106,6 +26106,97 @@
<object class="gbsizeritem" expanded="1">
<property name="border">5</property>
<property name="colspan">1</property>
+ <property name="column">2</property>
+ <property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT</property>
+ <property name="row">7</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">TrueCrypt Mode</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">TrueCryptModeCheckBox</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"></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">1</property>
<property name="column">0</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxRIGHT</property>
<property name="row">8</property>
diff --git a/src/Main/Forms/VolumeCreationWizard.cpp b/src/Main/Forms/VolumeCreationWizard.cpp
index 01fa845..99231a9 100644
--- a/src/Main/Forms/VolumeCreationWizard.cpp
+++ b/src/Main/Forms/VolumeCreationWizard.cpp
@@ -863,7 +863,7 @@ namespace VeraCrypt
options->Quick = QuickFormatEnabled;
options->Size = VolumeSize;
options->Type = OuterVolume ? VolumeType::Normal : SelectedVolumeType;
- options->VolumeHeaderKdf = Pkcs5Kdf::GetAlgorithm (*SelectedHash);
+ options->VolumeHeaderKdf = Pkcs5Kdf::GetAlgorithm (*SelectedHash, false);
Creator.reset (new VolumeCreator);
VolumeCreatorThreadRoutine routine(options, Creator);
@@ -941,7 +941,7 @@ namespace VeraCrypt
});
#endif
- shared_ptr <Volume> outerVolume = Core->OpenVolume (make_shared <VolumePath> (SelectedVolumePath), true, Password, Kdf, Keyfiles, VolumeProtection::ReadOnly);
+ shared_ptr <Volume> outerVolume = Core->OpenVolume (make_shared <VolumePath> (SelectedVolumePath), true, Password, Kdf, false, Keyfiles, VolumeProtection::ReadOnly);
MaxHiddenVolumeSize = Core->GetMaxHiddenVolumeSize (outerVolume);
// Add a reserve (in case the user mounts the outer volume and creates new files
diff --git a/src/Main/Forms/VolumePasswordPanel.cpp b/src/Main/Forms/VolumePasswordPanel.cpp
index 50f3eca..e458276 100755..100644
--- a/src/Main/Forms/VolumePasswordPanel.cpp
+++ b/src/Main/Forms/VolumePasswordPanel.cpp
@@ -14,7 +14,7 @@
namespace VeraCrypt
{
- VolumePasswordPanel::VolumePasswordPanel (wxWindow* parent, shared_ptr <VolumePassword> password, shared_ptr <KeyfileList> keyfiles, bool enableCache, bool enablePassword, bool enableKeyfiles, bool enableConfirmation, bool enablePkcs5Prf, bool isMountPassword, const wxString &passwordLabel)
+ VolumePasswordPanel::VolumePasswordPanel (wxWindow* parent, 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)
{
if (keyfiles)
@@ -63,6 +63,7 @@ namespace VeraCrypt
Pkcs5PrfStaticText->Show (enablePkcs5Prf);
Pkcs5PrfChoice->Show (enablePkcs5Prf);
+ TrueCryptModeCheckBox->Show (!disableTruecryptMode);
HeaderWipeCountText->Show (enablePkcs5Prf && !isMountPassword);
HeaderWipeCount->Show (enablePkcs5Prf && !isMountPassword);
@@ -74,7 +75,7 @@ namespace VeraCrypt
Pkcs5PrfChoice->Delete (0);
Pkcs5PrfChoice->Append (LangString["AUTODETECTION"]);
}
- foreach_ref (const Pkcs5Kdf &kdf, Pkcs5Kdf::GetAvailableAlgorithms())
+ foreach_ref (const Pkcs5Kdf &kdf, Pkcs5Kdf::GetAvailableAlgorithms(false))
{
if (!kdf.IsDeprecated() || isMountPassword)
Pkcs5PrfChoice->Append (kdf.GetName());
@@ -190,7 +191,7 @@ namespace VeraCrypt
{
try
{
- return Pkcs5Kdf::GetAlgorithm (wstring (Pkcs5PrfChoice->GetStringSelection()));
+ return Pkcs5Kdf::GetAlgorithm (wstring (Pkcs5PrfChoice->GetStringSelection()), GetTrueCryptMode());
}
catch (ParameterIncorrect&)
{
@@ -198,6 +199,11 @@ namespace VeraCrypt
}
}
+ bool VolumePasswordPanel::GetTrueCryptMode () const
+ {
+ return TrueCryptModeCheckBox->GetValue ();
+ }
+
int VolumePasswordPanel::GetHeaderWipeCount () const
{
try
diff --git a/src/Main/Forms/VolumePasswordPanel.h b/src/Main/Forms/VolumePasswordPanel.h
index 465a430..c3e59da 100755..100644
--- a/src/Main/Forms/VolumePasswordPanel.h
+++ b/src/Main/Forms/VolumePasswordPanel.h
@@ -18,13 +18,14 @@ namespace VeraCrypt
class VolumePasswordPanel : public VolumePasswordPanelBase
{
public:
- VolumePasswordPanel (wxWindow* parent, shared_ptr <VolumePassword> password, shared_ptr <KeyfileList> keyfiles, bool enableCache = false, bool enablePassword = true, bool enableKeyfiles = true, bool enableConfirmation = false, bool enablePkcs5Prf = false, bool isMountPassword = false, const wxString &passwordLabel = wxString());
+ VolumePasswordPanel (wxWindow* parent, shared_ptr <VolumePassword> password, bool disableTruecryptMode, shared_ptr <KeyfileList> keyfiles, bool enableCache = false, bool enablePassword = true, bool enableKeyfiles = true, bool enableConfirmation = false, bool enablePkcs5Prf = false, bool isMountPassword = false, const wxString &passwordLabel = wxString());
virtual ~VolumePasswordPanel ();
void AddKeyfile (shared_ptr <Keyfile> keyfile);
shared_ptr <KeyfileList> GetKeyfiles () const { return UseKeyfilesCheckBox->IsChecked() ? Keyfiles : shared_ptr <KeyfileList> (); }
shared_ptr <VolumePassword> GetPassword () const;
shared_ptr <Pkcs5Kdf> GetPkcs5Kdf () const;
+ bool GetTrueCryptMode () const;
int GetHeaderWipeCount () const;
void SetCacheCheckBoxValidator (const wxGenericValidator &validator) { CacheCheckBox->SetValidator (validator); }
void SetFocusToPasswordTextCtrl () { PasswordTextCtrl->SetSelection (-1, -1); PasswordTextCtrl->SetFocus(); }
diff --git a/src/Main/Forms/VolumePasswordWizardPage.cpp b/src/Main/Forms/VolumePasswordWizardPage.cpp
index 61ff999..0f80ce8 100755..100644
--- a/src/Main/Forms/VolumePasswordWizardPage.cpp
+++ b/src/Main/Forms/VolumePasswordWizardPage.cpp
@@ -15,7 +15,7 @@ namespace VeraCrypt
VolumePasswordWizardPage::VolumePasswordWizardPage (wxPanel* parent, shared_ptr <VolumePassword> password, shared_ptr <KeyfileList> keyfiles, bool enableConfirmation)
: VolumePasswordWizardPageBase (parent), ConfirmationMode (enableConfirmation)
{
- PasswordPanel = new VolumePasswordPanel (this, password, keyfiles, false, true, true, enableConfirmation, !enableConfirmation, !enableConfirmation);
+ PasswordPanel = new VolumePasswordPanel (this, password, true, keyfiles, false, true, true, enableConfirmation, !enableConfirmation, !enableConfirmation);
PasswordPanel->UpdateEvent.Connect (EventConnector <VolumePasswordWizardPage> (this, &VolumePasswordWizardPage::OnPasswordPanelUpdate));
PasswordPanelSizer->Add (PasswordPanel, 1, wxALL | wxEXPAND);
diff --git a/src/Main/Forms/VolumePropertiesDialog.cpp b/src/Main/Forms/VolumePropertiesDialog.cpp
index c995618..9d17f04 100644
--- a/src/Main/Forms/VolumePropertiesDialog.cpp
+++ b/src/Main/Forms/VolumePropertiesDialog.cpp
@@ -32,7 +32,7 @@ namespace VeraCrypt
AppendToList ("VIRTUAL_DEVICE", wstring (volumeInfo.VirtualDevice));
#endif
AppendToList ("SIZE", Gui->SizeToString (volumeInfo.Size));
- AppendToList ("TYPE", Gui->VolumeTypeToString (volumeInfo.Type, volumeInfo.Protection));
+ AppendToList ("TYPE", Gui->VolumeTypeToString (volumeInfo.Type, volumeInfo.TrueCryptMode, volumeInfo.Protection));
AppendToList ("READ_ONLY", LangString [volumeInfo.Protection == VolumeProtection::ReadOnly ? "UISTR_YES" : "UISTR_NO"]);
wxString protection;
diff --git a/src/Main/Forms/WaitDialog.cpp b/src/Main/Forms/WaitDialog.cpp
index a8290d1..a60c5e4 100755..100644
--- a/src/Main/Forms/WaitDialog.cpp
+++ b/src/Main/Forms/WaitDialog.cpp
@@ -15,11 +15,12 @@
namespace VeraCrypt
{
DEFINE_EVENT_TYPE(wxEVT_COMMAND_WAITDIALOGTHREAD_COMPLETED)
+ DEFINE_EVENT_TYPE(wxEVT_COMMAND_WAITDIALOG_ADMIN_PASSWORD)
+ DEFINE_EVENT_TYPE(wxEVT_COMMAND_WAITDIALOG_PIN)
+ DEFINE_EVENT_TYPE(wxEVT_COMMAND_WAITDIALOG_SHOW_MSG)
wxThread::ExitCode WaitThread::Entry()
- {
- wxCommandEvent finishEvent( wxEVT_COMMAND_WAITDIALOGTHREAD_COMPLETED,0);
-
+ {
m_pRoutine->Execute();
wxQueueEvent (m_pHandler, new wxCommandEvent( wxEVT_COMMAND_WAITDIALOGTHREAD_COMPLETED,0));
return (wxThread::ExitCode)0; // success
@@ -88,7 +89,9 @@ namespace VeraCrypt
VC_CONVERT_EXCEPTION (InvalidSecurityTokenKeyfilePath);
VC_CONVERT_EXCEPTION (SecurityTokenLibraryNotInitialized);
VC_CONVERT_EXCEPTION (SecurityTokenKeyfileAlreadyExists);
- VC_CONVERT_EXCEPTION (SecurityTokenKeyfileNotFound);
+ VC_CONVERT_EXCEPTION (SecurityTokenKeyfileNotFound);
+ VC_CONVERT_EXCEPTION (UnsupportedAlgoInTrueCryptMode);
+ VC_CONVERT_EXCEPTION (UnsupportedTrueCryptFormat);
throw *ex;
}
}
diff --git a/src/Main/Forms/WaitDialog.h b/src/Main/Forms/WaitDialog.h
index c9e0d56..b12ad02 100755..100644
--- a/src/Main/Forms/WaitDialog.h
+++ b/src/Main/Forms/WaitDialog.h
@@ -11,11 +11,16 @@
#include "Forms.h"
#include "Main/Main.h"
+#include "Main/Application.h"
+#include <wx/msgqueue.h>
namespace VeraCrypt
{
DECLARE_LOCAL_EVENT_TYPE(wxEVT_COMMAND_WAITDIALOGTHREAD_COMPLETED, -1);
+ DECLARE_LOCAL_EVENT_TYPE(wxEVT_COMMAND_WAITDIALOG_ADMIN_PASSWORD, -1);
+ DECLARE_LOCAL_EVENT_TYPE(wxEVT_COMMAND_WAITDIALOG_PIN, -1);
+ DECLARE_LOCAL_EVENT_TYPE(wxEVT_COMMAND_WAITDIALOG_SHOW_MSG, -1);
class WaitDialog;
@@ -50,6 +55,10 @@ namespace VeraCrypt
GetSizer()->Fit( this );
Centre( wxBOTH );
Connect( wxID_ANY, wxEVT_COMMAND_WAITDIALOGTHREAD_COMPLETED, wxCommandEventHandler( WaitDialog::OnThreadCompletion ) );
+ Connect( wxID_ANY, wxEVT_COMMAND_WAITDIALOG_ADMIN_PASSWORD, wxCommandEventHandler( WaitDialog::OnAdminPasswordRequest ) );
+ Connect( wxID_ANY, wxEVT_COMMAND_WAITDIALOG_PIN, wxCommandEventHandler( WaitDialog::OnPinRequest ) );
+ Connect( wxID_ANY, wxEVT_COMMAND_WAITDIALOG_SHOW_MSG, wxCommandEventHandler( WaitDialog::OnShowMsg ) );
+
Connect( wxEVT_TIMER, wxTimerEventHandler( WaitDialog::OnProgressTimer ), NULL, this );
m_thread = new WaitThread(this, pRoutine);
}
@@ -58,6 +67,9 @@ namespace VeraCrypt
{
Disconnect( wxEVT_TIMER, wxTimerEventHandler( WaitDialog::OnProgressTimer ));
Disconnect( wxID_ANY, wxEVT_COMMAND_WAITDIALOGTHREAD_COMPLETED, wxCommandEventHandler( WaitDialog::OnThreadCompletion ) );
+ Disconnect( wxID_ANY, wxEVT_COMMAND_WAITDIALOG_ADMIN_PASSWORD, wxCommandEventHandler( WaitDialog::OnAdminPasswordRequest ) );
+ Disconnect( wxID_ANY, wxEVT_COMMAND_WAITDIALOG_PIN, wxCommandEventHandler( WaitDialog::OnPinRequest ) );
+ Disconnect( wxID_ANY, wxEVT_COMMAND_WAITDIALOG_SHOW_MSG, wxCommandEventHandler( WaitDialog::OnShowMsg ) );
}
virtual void OnWaitDialogInit( wxInitDialogEvent& event )
@@ -65,12 +77,119 @@ namespace VeraCrypt
m_thread->Run();
m_timer.Start(100);
}
+
+ int GetCharWidth (wxWindow *window) const
+ {
+ int width;
+ int height;
+ window->GetTextExtent (L"a", &width, &height);
+
+ if (width < 1)
+ return 7;
+
+ return width;
+ }
+
+ class ShowMessageParam
+ {
+ public:
+ wxString m_message;
+ wxString m_caption;
+ long m_style;
+ bool m_topMost;
+ ShowMessageParam(const wxString &message, const wxString &caption,long style, bool topMost)
+ : m_message(message), m_caption(caption), m_style(style), m_topMost(topMost)
+ {}
+ };
+
+ int RequestShowMessage (const wxString &message, const wxString &caption,long style, bool topMost)
+ {
+ long lResult = -1;
+ if (m_queue.IsOk())
+ {
+ wxString sResult;
+ ShowMessageParam* pParam = new ShowMessageParam(message, caption, style, topMost);
+ wxCommandEvent* pEvent = new wxCommandEvent( wxEVT_COMMAND_WAITDIALOG_SHOW_MSG,0);
+ pEvent->SetClientData (pParam);
+ wxQueueEvent (this, pEvent);
+ m_queue.Receive (sResult);
+ sResult.ToLong(&lResult);
+ }
+ return (int) lResult;
+ }
+
+ void RequestAdminPassword (wxString& adminPassword)
+ {
+ if (m_queue.IsOk())
+ {
+ wxQueueEvent (this, new wxCommandEvent( wxEVT_COMMAND_WAITDIALOG_ADMIN_PASSWORD,0));
+ if (wxMSGQUEUE_NO_ERROR != m_queue.Receive (adminPassword))
+ adminPassword = wxT("");
+ }
+ else
+ adminPassword = wxT("");
+ }
+
+ void RequestPin (wxString& pin)
+ {
+ if (m_queue.IsOk())
+ {
+ wxCommandEvent* pEvent = new wxCommandEvent( wxEVT_COMMAND_WAITDIALOG_PIN,0);
+ pEvent->SetString (pin);
+ wxQueueEvent (this, pEvent);
+ if (wxMSGQUEUE_NO_ERROR != m_queue.Receive (pin))
+ pin = wxT("");
+ }
+ else
+ pin = wxT("");
+ }
// virtual void OnWaitDialogClose( wxCloseEvent& event ) { }
void OnThreadCompletion(wxCommandEvent &)
{
+ m_queue.Clear();
EndModal(0);
}
+
+ void OnAdminPasswordRequest(wxCommandEvent &)
+ {
+
+ wxPasswordEntryDialog dialog (this, _("Enter your user password or administrator password:"), _("Administrator privileges required"));
+ if (dialog.ShowModal() != wxID_OK)
+ m_queue.Post(wxT(""));
+ else
+ m_queue.Post(dialog.GetValue());
+ }
+
+
+
+ void OnPinRequest(wxCommandEvent &e)
+ {
+
+ wxPasswordEntryDialog dialog (this, wxString::Format (LangString["ENTER_TOKEN_PASSWORD"], e.GetString()), LangString["IDD_TOKEN_PASSWORD"]);
+ dialog.SetSize (wxSize (GetCharWidth (&dialog) * 50, -1));
+
+ if (dialog.ShowModal() != wxID_OK)
+ m_queue.Post(wxT(""));
+ else
+ m_queue.Post(dialog.GetValue());
+ }
+
+ void OnShowMsg(wxCommandEvent &e)
+ {
+ ShowMessageParam* pParam = (ShowMessageParam*) e.GetClientData();
+ if (pParam->m_topMost)
+ {
+ if (!IsActive())
+ RequestUserAttention (wxUSER_ATTENTION_ERROR);
+
+ pParam->m_style |= wxSTAY_ON_TOP;
+ }
+
+ int iResult = wxMessageBox (pParam->m_message, pParam->m_caption, pParam->m_style, this);
+ delete pParam;
+ m_queue.Post(wxString::Format(wxT("%d"), iResult));
+ }
void OnProgressTimer(wxTimerEvent& event)
{
@@ -83,7 +202,8 @@ namespace VeraCrypt
protected:
WaitThread* m_thread;
- wxTimer m_timer;
+ wxTimer m_timer;
+ wxMessageQueue<wxString> m_queue;
};
}