VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Main/Forms
diff options
context:
space:
mode:
Diffstat (limited to 'src/Main/Forms')
-rwxr-xr-xsrc/Main/Forms/ChangePasswordDialog.cpp5
-rwxr-xr-x[-rw-r--r--]src/Main/Forms/Forms.cpp35
-rwxr-xr-x[-rw-r--r--]src/Main/Forms/Forms.h23
-rw-r--r--src/Main/Forms/MainFrame.cpp31
-rw-r--r--src/Main/Forms/MainFrame.h15
-rwxr-xr-x[-rw-r--r--]src/Main/Forms/TrueCrypt.fbp239
-rw-r--r--src/Main/Forms/VolumeCreationWizard.cpp5
-rw-r--r--src/Main/Forms/VolumeCreationWizard.h2
-rwxr-xr-xsrc/Main/Forms/WaitDialog.cpp94
-rwxr-xr-xsrc/Main/Forms/WaitDialog.h90
10 files changed, 530 insertions, 9 deletions
diff --git a/src/Main/Forms/ChangePasswordDialog.cpp b/src/Main/Forms/ChangePasswordDialog.cpp
index e07b7d3b..75fe717c 100755
--- a/src/Main/Forms/ChangePasswordDialog.cpp
+++ b/src/Main/Forms/ChangePasswordDialog.cpp
@@ -10,6 +10,7 @@
#include "Main/Main.h"
#include "Main/GraphicUserInterface.h"
#include "ChangePasswordDialog.h"
+#include "WaitDialog.h"
namespace VeraCrypt
{
@@ -124,9 +125,11 @@ namespace VeraCrypt
});
#endif
wxBusyCursor busy;
- Core->ChangePassword (Path, Gui->GetPreferences().DefaultMountOptions.PreserveTimestamps,
+ ChangePasswordThreadRoutine routine(Path, Gui->GetPreferences().DefaultMountOptions.PreserveTimestamps,
CurrentPasswordPanel->GetPassword(), CurrentPasswordPanel->GetPkcs5Kdf(), CurrentPasswordPanel->GetKeyfiles(),
newPassword, newKeyfiles, NewPasswordPanel->GetPkcs5Kdf(), NewPasswordPanel->GetHeaderWipeCount());
+ WaitDialog dlg(this, LangString["IDT_STATIC_MODAL_WAIT_DLG_INFO"], &routine);
+ dlg.Run();
}
switch (DialogMode)
diff --git a/src/Main/Forms/Forms.cpp b/src/Main/Forms/Forms.cpp
index ad732534..1c536b31 100644..100755
--- a/src/Main/Forms/Forms.cpp
+++ b/src/Main/Forms/Forms.cpp
@@ -3349,3 +3349,38 @@ VolumeSizeWizardPageBase::~VolumeSizeWizardPageBase()
VolumeSizePrefixChoice->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( VolumeSizeWizardPageBase::OnVolumeSizePrefixSelected ), NULL, this );
}
+
+WaitDialogBase::WaitDialogBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
+{
+ this->SetSizeHints( wxDefaultSize, wxDefaultSize );
+
+ wxBoxSizer* bSizer160;
+ bSizer160 = new wxBoxSizer( wxVERTICAL );
+
+ WaitStaticText = new wxStaticText( this, wxID_ANY, _("MyLabel"), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE );
+ WaitStaticText->Wrap( -1 );
+ bSizer160->Add( WaitStaticText, 0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND, 5 );
+
+ WaitProgessBar = new wxGauge( this, wxID_ANY, 100, wxDefaultPosition, wxDefaultSize, wxGA_HORIZONTAL|wxGA_SMOOTH );
+ WaitProgessBar->SetValue( 0 );
+ bSizer160->Add( WaitProgessBar, 0, wxALL|wxEXPAND, 5 );
+
+
+ this->SetSizer( bSizer160 );
+ this->Layout();
+ bSizer160->Fit( this );
+
+ this->Centre( wxBOTH );
+
+ // Connect Events
+ this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( WaitDialogBase::OnWaitDialogClose ) );
+ this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( WaitDialogBase::OnWaitDialogInit ) );
+}
+
+WaitDialogBase::~WaitDialogBase()
+{
+ // Disconnect Events
+ this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( WaitDialogBase::OnWaitDialogClose ) );
+ this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( WaitDialogBase::OnWaitDialogInit ) );
+
+}
diff --git a/src/Main/Forms/Forms.h b/src/Main/Forms/Forms.h
index a59a9bf7..b0579219 100644..100755
--- a/src/Main/Forms/Forms.h
+++ b/src/Main/Forms/Forms.h
@@ -1025,6 +1025,29 @@ namespace VeraCrypt
};
+ ///////////////////////////////////////////////////////////////////////////////
+ /// Class WaitDialogBase
+ ///////////////////////////////////////////////////////////////////////////////
+ class WaitDialogBase : public wxDialog
+ {
+ private:
+
+ protected:
+ wxStaticText* WaitStaticText;
+ wxGauge* WaitProgessBar;
+
+ // Virtual event handlers, overide them in your derived class
+ virtual void OnWaitDialogClose( wxCloseEvent& event ) { event.Skip(); }
+ virtual void OnWaitDialogInit( wxInitDialogEvent& event ) { event.Skip(); }
+
+
+ public:
+
+ WaitDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("VeraCrypt"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxCAPTION );
+ ~WaitDialogBase();
+
+ };
+
} // namespace VeraCrypt
#endif //__FORMS_H__
diff --git a/src/Main/Forms/MainFrame.cpp b/src/Main/Forms/MainFrame.cpp
index b48f3718..fbf20537 100644
--- a/src/Main/Forms/MainFrame.cpp
+++ b/src/Main/Forms/MainFrame.cpp
@@ -36,6 +36,10 @@
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)
+
MainFrame::MainFrame (wxWindow* parent) : MainFrameBase (parent),
ListItemRightClickEventPending (false),
SelectedItemIndex (-1),
@@ -84,6 +88,11 @@ namespace VeraCrypt
Gui->ShowError (e);
}
}
+
+ Connect( wxID_ANY, wxEVT_COMMAND_UPDATE_VOLUME_LIST, wxCommandEventHandler( MainFrame::OnUpdateVolumeList ) );
+ Connect( wxID_ANY, wxEVT_COMMAND_PREF_UPDATED, wxCommandEventHandler( MainFrame::OnPreferencesUpdated ) );
+ Connect( wxID_ANY, wxEVT_COMMAND_OPEN_VOLUME_REQUEST, wxCommandEventHandler( MainFrame::OnOpenVolumeSystemRequest ) );
+
}
MainFrame::~MainFrame ()
@@ -100,6 +109,9 @@ namespace VeraCrypt
}
#endif
+ Disconnect( wxID_ANY, wxEVT_COMMAND_UPDATE_VOLUME_LIST, wxCommandEventHandler( MainFrame::OnUpdateVolumeList ) );
+ Disconnect( wxID_ANY, wxEVT_COMMAND_PREF_UPDATED, wxCommandEventHandler( MainFrame::OnPreferencesUpdated ) );
+ Disconnect( wxID_ANY, wxEVT_COMMAND_OPEN_VOLUME_REQUEST, wxCommandEventHandler( MainFrame::OnOpenVolumeSystemRequest ) );
Core->VolumeMountedEvent.Disconnect (this);
Core->VolumeDismountedEvent.Disconnect (this);
Gui->OpenVolumeSystemRequestEvent.Disconnect (this);
@@ -343,7 +355,7 @@ namespace VeraCrypt
Core->VolumeMountedEvent.Connect (EventConnector <MainFrame> (this, &MainFrame::OnVolumeMounted));
Core->VolumeDismountedEvent.Connect (EventConnector <MainFrame> (this, &MainFrame::OnVolumeDismounted));
Gui->OpenVolumeSystemRequestEvent.Connect (EventConnector <MainFrame> (this, &MainFrame::OnOpenVolumeSystemRequestEvent));
- Gui->PreferencesUpdatedEvent.Connect (EventConnector <MainFrame> (this, &MainFrame::OnPreferencesUpdated));
+ Gui->PreferencesUpdatedEvent.Connect (EventConnector <MainFrame> (this, &MainFrame::OnPreferencesUpdatedEvent));
// Drag & drop
class FileDropTarget : public wxFileDropTarget
@@ -1139,7 +1151,22 @@ namespace VeraCrypt
dialog.ShowModal();
}
- void MainFrame::OnPreferencesUpdated (EventArgs &args)
+ void MainFrame::OnOpenVolumeSystemRequest (wxCommandEvent& event)
+ {
+ wstring* eventPath = (wstring*) event.GetClientData();
+ SetVolumePath (*eventPath);
+ delete eventPath;
+ }
+
+ void MainFrame::OnOpenVolumeSystemRequestEvent (EventArgs &args)
+ {
+ wstring* eventPath = new wstring (dynamic_cast <OpenVolumeSystemRequestEventArgs &> (args).mVolumePath);
+ wxCommandEvent* pEvent = new wxCommandEvent( wxEVT_COMMAND_OPEN_VOLUME_REQUEST,0);
+ pEvent->SetClientData(eventPath);
+ wxQueueEvent (this, pEvent);
+ }
+
+ void MainFrame::OnPreferencesUpdated (wxCommandEvent& event)
{
const UserPreferences &prefs = GetPreferences();
diff --git a/src/Main/Forms/MainFrame.h b/src/Main/Forms/MainFrame.h
index a759cfcd..b31128cb 100644
--- a/src/Main/Forms/MainFrame.h
+++ b/src/Main/Forms/MainFrame.h
@@ -16,6 +16,10 @@ namespace VeraCrypt
{
struct FavoriteVolume;
+ DECLARE_LOCAL_EVENT_TYPE(wxEVT_COMMAND_UPDATE_VOLUME_LIST, -1);
+ DECLARE_LOCAL_EVENT_TYPE(wxEVT_COMMAND_PREF_UPDATED, -1);
+ DECLARE_LOCAL_EVENT_TYPE(wxEVT_COMMAND_OPEN_VOLUME_REQUEST, -1);
+
class MainFrame : public MainFrameBase
{
public:
@@ -109,10 +113,12 @@ namespace VeraCrypt
void OnNoHistoryCheckBoxClick (wxCommandEvent& event);
void OnOnlineHelpMenuItemSelected (wxCommandEvent& event) { Gui->OpenOnlineHelp (this); }
void OnOpenVolumeMenuItemSelected (wxCommandEvent& event) { OpenSelectedVolume(); }
- void OnOpenVolumeSystemRequestEvent (EventArgs &args) { SetVolumePath (wstring (dynamic_cast <OpenVolumeSystemRequestEventArgs &> (args).mVolumePath)); }
+ void OnOpenVolumeSystemRequest (wxCommandEvent& event);
+ void OnOpenVolumeSystemRequestEvent (EventArgs &args);
void OnOrganizeFavoritesMenuItemSelected (wxCommandEvent& event);
void OnPreferencesMenuItemSelected (wxCommandEvent& event);
- void OnPreferencesUpdated (EventArgs &args);
+ void OnPreferencesUpdated (wxCommandEvent& event);
+ void OnPreferencesUpdatedEvent (EventArgs &args) { wxQueueEvent (this, new wxCommandEvent( wxEVT_COMMAND_PREF_UPDATED,0)); }
void OnRemoveKeyfilesMenuItemSelected (wxCommandEvent& event) { ChangePassword (ChangePasswordDialog::Mode::RemoveAllKeyfiles); }
void OnRepairFilesystemMenuItemSelected( wxCommandEvent& event ) { CheckFilesystem (true); }
void OnRestoreVolumeHeaderMenuItemSelected (wxCommandEvent& event);
@@ -126,8 +132,9 @@ namespace VeraCrypt
void OnVolumePropertiesButtonClick (wxCommandEvent& event);
void OnVolumeToolsButtonClick (wxCommandEvent& event);
void OnVolumeButtonClick (wxCommandEvent& event);
- void OnVolumeDismounted (EventArgs &args) { UpdateVolumeList(); }
- void OnVolumeMounted (EventArgs &args) { UpdateVolumeList(); }
+ void OnUpdateVolumeList (wxCommandEvent& event) { UpdateVolumeList(); }
+ void OnVolumeDismounted (EventArgs &args) { wxQueueEvent (this, new wxCommandEvent( wxEVT_COMMAND_UPDATE_VOLUME_LIST,0)); }
+ void OnVolumeMounted (EventArgs &args) { wxQueueEvent (this, new wxCommandEvent( wxEVT_COMMAND_UPDATE_VOLUME_LIST,0)); }
void OnUserGuideMenuItemSelected (wxCommandEvent& event) { Gui->OpenUserGuide (this); }
void OnWebsiteMenuItemSelected (wxCommandEvent& event) { Gui->OpenHomepageLink (this, L"website"); }
void OnWipeCacheButtonClick (wxCommandEvent& event);
diff --git a/src/Main/Forms/TrueCrypt.fbp b/src/Main/Forms/TrueCrypt.fbp
index 0e14502d..998b00d1 100644..100755
--- a/src/Main/Forms/TrueCrypt.fbp
+++ b/src/Main/Forms/TrueCrypt.fbp
@@ -26918,5 +26918,244 @@
</object>
</object>
</object>
+ <object class="Dialog" expanded="0">
+ <property name="aui_managed">0</property>
+ <property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
+ <property name="bg"></property>
+ <property name="center">wxBOTH</property>
+ <property name="context_help"></property>
+ <property name="context_menu">1</property>
+ <property name="enabled">1</property>
+ <property name="event_handler">impl_virtual</property>
+ <property name="extra_style"></property>
+ <property name="fg"></property>
+ <property name="font"></property>
+ <property name="hidden">0</property>
+ <property name="id">wxID_ANY</property>
+ <property name="maximum_size"></property>
+ <property name="minimum_size"></property>
+ <property name="name">WaitDialogBase</property>
+ <property name="pos"></property>
+ <property name="size">-1,-1</property>
+ <property name="style">wxCAPTION</property>
+ <property name="subclass"></property>
+ <property name="title">VeraCrypt</property>
+ <property name="tooltip"></property>
+ <property name="window_extra_style"></property>
+ <property name="window_name"></property>
+ <property name="window_style"></property>
+ <event name="OnActivate"></event>
+ <event name="OnActivateApp"></event>
+ <event name="OnAuiFindManager"></event>
+ <event name="OnAuiPaneButton"></event>
+ <event name="OnAuiPaneClose"></event>
+ <event name="OnAuiPaneMaximize"></event>
+ <event name="OnAuiPaneRestore"></event>
+ <event name="OnAuiRender"></event>
+ <event name="OnChar"></event>
+ <event name="OnClose">OnWaitDialogClose</event>
+ <event name="OnEnterWindow"></event>
+ <event name="OnEraseBackground"></event>
+ <event name="OnHibernate"></event>
+ <event name="OnIconize"></event>
+ <event name="OnIdle"></event>
+ <event name="OnInitDialog">OnWaitDialogInit</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 class="wxBoxSizer" expanded="0">
+ <property name="minimum_size"></property>
+ <property name="name">bSizer160</property>
+ <property name="orient">wxVERTICAL</property>
+ <property name="permission">none</property>
+ <object class="sizeritem" expanded="0">
+ <property name="border">5</property>
+ <property name="flag">wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND</property>
+ <property name="proportion">0</property>
+ <object class="wxStaticText" 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="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">MyLabel</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">WaitStaticText</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">wxALIGN_CENTRE</property>
+ <property name="subclass"></property>
+ <property name="toolbar_pane">0</property>
+ <property name="tooltip"></property>
+ <property name="window_extra_style"></property>
+ <property name="window_name"></property>
+ <property name="window_style"></property>
+ <property name="wrap">-1</property>
+ <event name="OnChar"></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="sizeritem" expanded="0">
+ <property name="border">5</property>
+ <property name="flag">wxALL|wxEXPAND</property>
+ <property name="proportion">0</property>
+ <object class="wxGauge" 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="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="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">WaitProgessBar</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="range">100</property>
+ <property name="resize">Resizable</property>
+ <property name="show">1</property>
+ <property name="size"></property>
+ <property name="style">wxGA_HORIZONTAL|wxGA_SMOOTH</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="value">0</property>
+ <property name="window_extra_style"></property>
+ <property name="window_name"></property>
+ <property name="window_style"></property>
+ <event name="OnChar"></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>
+ </object>
</object>
</wxFormBuilder_Project>
diff --git a/src/Main/Forms/VolumeCreationWizard.cpp b/src/Main/Forms/VolumeCreationWizard.cpp
index 1dac1315..01fa8450 100644
--- a/src/Main/Forms/VolumeCreationWizard.cpp
+++ b/src/Main/Forms/VolumeCreationWizard.cpp
@@ -27,6 +27,7 @@
#include "VolumeLocationWizardPage.h"
#include "VolumePasswordWizardPage.h"
#include "VolumeSizeWizardPage.h"
+#include "WaitDialog.h"
namespace VeraCrypt
{
@@ -865,7 +866,9 @@ namespace VeraCrypt
options->VolumeHeaderKdf = Pkcs5Kdf::GetAlgorithm (*SelectedHash);
Creator.reset (new VolumeCreator);
- Creator->CreateVolume (options);
+ VolumeCreatorThreadRoutine routine(options, Creator);
+ WaitDialog dlg(this, LangString["IDT_STATIC_MODAL_WAIT_DLG_INFO"], &routine);
+ dlg.Run();
page->SetKeyInfo (Creator->GetKeyInfo());
diff --git a/src/Main/Forms/VolumeCreationWizard.h b/src/Main/Forms/VolumeCreationWizard.h
index 3a87c4cb..09bc1c34 100644
--- a/src/Main/Forms/VolumeCreationWizard.h
+++ b/src/Main/Forms/VolumeCreationWizard.h
@@ -54,7 +54,7 @@ namespace VeraCrypt
volatile bool AbortConfirmationPending;
volatile bool AbortRequested;
volatile bool CreationAborted;
- auto_ptr <VolumeCreator> Creator;
+ shared_ptr <VolumeCreator> Creator;
bool CrossPlatformSupport;
static bool DeviceWarningConfirmed;
bool DisplayKeyInfo;
diff --git a/src/Main/Forms/WaitDialog.cpp b/src/Main/Forms/WaitDialog.cpp
new file mode 100755
index 00000000..a8290d10
--- /dev/null
+++ b/src/Main/Forms/WaitDialog.cpp
@@ -0,0 +1,94 @@
+/*
+ Copyright (c) 2014 IDRIX. All rights reserved.
+
+ Governed by the VeraCrypt License the full text of which is contained in
+ the file License.txt included in VeraCrypt binary and source code distribution
+ packages.
+*/
+
+#include "System.h"
+#include "Volume/EncryptionModeXTS.h"
+#include "Main/GraphicUserInterface.h"
+#include "Common/SecurityToken.h"
+#include "WaitDialog.h"
+
+namespace VeraCrypt
+{
+ DEFINE_EVENT_TYPE(wxEVT_COMMAND_WAITDIALOGTHREAD_COMPLETED)
+
+ 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
+ }
+
+ void WaitDialog::ThrowException(Exception* ex)
+ {
+ #define VC_CONVERT_EXCEPTION(NAME) if (dynamic_cast<NAME*> (ex)) throw (NAME&) *ex;
+ VC_CONVERT_EXCEPTION (PasswordIncorrect);
+ VC_CONVERT_EXCEPTION (PasswordKeyfilesIncorrect);
+ VC_CONVERT_EXCEPTION (PasswordOrKeyboardLayoutIncorrect);
+ VC_CONVERT_EXCEPTION (PasswordOrMountOptionsIncorrect);
+ VC_CONVERT_EXCEPTION (ProtectionPasswordIncorrect);
+ VC_CONVERT_EXCEPTION (ProtectionPasswordKeyfilesIncorrect);
+ VC_CONVERT_EXCEPTION (PasswordEmpty);
+ VC_CONVERT_EXCEPTION (PasswordTooLong);
+ VC_CONVERT_EXCEPTION (UnportablePassword);
+ VC_CONVERT_EXCEPTION (ElevationFailed);
+ VC_CONVERT_EXCEPTION (RootDeviceUnavailable);
+ VC_CONVERT_EXCEPTION (DriveLetterUnavailable);
+ VC_CONVERT_EXCEPTION (DriverError);
+ VC_CONVERT_EXCEPTION (EncryptedSystemRequired);
+ VC_CONVERT_EXCEPTION (HigherFuseVersionRequired);
+ VC_CONVERT_EXCEPTION (KernelCryptoServiceTestFailed);
+ VC_CONVERT_EXCEPTION (LoopDeviceSetupFailed);
+ VC_CONVERT_EXCEPTION (MountPointRequired);
+ VC_CONVERT_EXCEPTION (MountPointUnavailable);
+ VC_CONVERT_EXCEPTION (NoDriveLetterAvailable);
+ VC_CONVERT_EXCEPTION (TemporaryDirectoryFailure);
+ VC_CONVERT_EXCEPTION (UnsupportedSectorSizeHiddenVolumeProtection);
+ VC_CONVERT_EXCEPTION (UnsupportedSectorSizeNoKernelCrypto);
+ VC_CONVERT_EXCEPTION (VolumeAlreadyMounted);
+ VC_CONVERT_EXCEPTION (VolumeSlotUnavailable);
+ VC_CONVERT_EXCEPTION (UserInterfaceException);
+ VC_CONVERT_EXCEPTION (MissingArgument);
+ VC_CONVERT_EXCEPTION (NoItemSelected);
+ VC_CONVERT_EXCEPTION (StringFormatterException);
+ VC_CONVERT_EXCEPTION (ExecutedProcessFailed);
+ VC_CONVERT_EXCEPTION (AlreadyInitialized);
+ VC_CONVERT_EXCEPTION (AssertionFailed);
+ VC_CONVERT_EXCEPTION (ExternalException);
+ VC_CONVERT_EXCEPTION (InsufficientData);
+ VC_CONVERT_EXCEPTION (NotApplicable);
+ VC_CONVERT_EXCEPTION (NotImplemented);
+ VC_CONVERT_EXCEPTION (NotInitialized);
+ VC_CONVERT_EXCEPTION (ParameterIncorrect);
+ VC_CONVERT_EXCEPTION (ParameterTooLarge);
+ VC_CONVERT_EXCEPTION (PartitionDeviceRequired);
+ VC_CONVERT_EXCEPTION (StringConversionFailed);
+ VC_CONVERT_EXCEPTION (TestFailed);
+ VC_CONVERT_EXCEPTION (TimeOut);
+ VC_CONVERT_EXCEPTION (UnknownException);
+ VC_CONVERT_EXCEPTION (UserAbort)
+ VC_CONVERT_EXCEPTION (CipherInitError);
+ VC_CONVERT_EXCEPTION (WeakKeyDetected);
+ VC_CONVERT_EXCEPTION (HigherVersionRequired);
+ VC_CONVERT_EXCEPTION (KeyfilePathEmpty);
+ VC_CONVERT_EXCEPTION (MissingVolumeData);
+ VC_CONVERT_EXCEPTION (MountedVolumeInUse);
+ VC_CONVERT_EXCEPTION (UnsupportedSectorSize);
+ VC_CONVERT_EXCEPTION (VolumeEncryptionNotCompleted);
+ VC_CONVERT_EXCEPTION (VolumeHostInUse);
+ VC_CONVERT_EXCEPTION (VolumeProtected);
+ VC_CONVERT_EXCEPTION (VolumeReadOnly);
+ VC_CONVERT_EXCEPTION (Pkcs11Exception);
+ VC_CONVERT_EXCEPTION (InvalidSecurityTokenKeyfilePath);
+ VC_CONVERT_EXCEPTION (SecurityTokenLibraryNotInitialized);
+ VC_CONVERT_EXCEPTION (SecurityTokenKeyfileAlreadyExists);
+ VC_CONVERT_EXCEPTION (SecurityTokenKeyfileNotFound);
+ throw *ex;
+ }
+}
diff --git a/src/Main/Forms/WaitDialog.h b/src/Main/Forms/WaitDialog.h
new file mode 100755
index 00000000..c9e0d56e
--- /dev/null
+++ b/src/Main/Forms/WaitDialog.h
@@ -0,0 +1,90 @@
+/*
+ Copyright (c) 2014 IDRIX. All rights reserved.
+
+ Governed by the VeraCrypt License the full text of which is contained in
+ the file License.txt included in VeraCrypt binary and source code distribution
+ packages.
+*/
+
+#ifndef TC_HEADER_Main_Forms_WaitDialog
+#define TC_HEADER_Main_Forms_WaitDialog
+
+#include "Forms.h"
+#include "Main/Main.h"
+
+namespace VeraCrypt
+{
+
+ DECLARE_LOCAL_EVENT_TYPE(wxEVT_COMMAND_WAITDIALOGTHREAD_COMPLETED, -1);
+
+ class WaitDialog;
+
+
+
+ class WaitThread : public wxThread
+ {
+ public:
+ WaitThread(WaitDialog *handler, WaitThreadRoutine* pRoutine) : wxThread(wxTHREAD_DETACHED), m_pRoutine(pRoutine)
+ {
+ m_pHandler = handler;
+ }
+ ~WaitThread()
+ {
+ }
+
+ protected:
+ virtual ExitCode Entry();
+ WaitDialog *m_pHandler;
+ WaitThreadRoutine* m_pRoutine;
+ };
+
+ class WaitDialog : public WaitDialogBase, public WaitThreadUI
+ {
+ public:
+ WaitDialog (wxWindow *parent, const wxString& label, WaitThreadRoutine* pRoutine)
+ : WaitDialogBase(parent), WaitThreadUI(pRoutine), m_timer (this)
+ {
+ WaitStaticText->SetLabel (label);
+ WaitProgessBar->Pulse();
+ Layout();
+ GetSizer()->Fit( this );
+ Centre( wxBOTH );
+ Connect( wxID_ANY, wxEVT_COMMAND_WAITDIALOGTHREAD_COMPLETED, wxCommandEventHandler( WaitDialog::OnThreadCompletion ) );
+ Connect( wxEVT_TIMER, wxTimerEventHandler( WaitDialog::OnProgressTimer ), NULL, this );
+ m_thread = new WaitThread(this, pRoutine);
+ }
+
+ ~WaitDialog()
+ {
+ Disconnect( wxEVT_TIMER, wxTimerEventHandler( WaitDialog::OnProgressTimer ));
+ Disconnect( wxID_ANY, wxEVT_COMMAND_WAITDIALOGTHREAD_COMPLETED, wxCommandEventHandler( WaitDialog::OnThreadCompletion ) );
+ }
+
+ virtual void OnWaitDialogInit( wxInitDialogEvent& event )
+ {
+ m_thread->Run();
+ m_timer.Start(100);
+ }
+
+ // virtual void OnWaitDialogClose( wxCloseEvent& event ) { }
+ void OnThreadCompletion(wxCommandEvent &)
+ {
+ EndModal(0);
+ }
+
+ void OnProgressTimer(wxTimerEvent& event)
+ {
+ WaitProgessBar->Pulse();
+ }
+
+ virtual void Run(void) { ShowModal(); if (m_pRoutine->HasException()) ThrowException(m_pRoutine->m_pException); }
+
+ void ThrowException(Exception* ex);
+
+ protected:
+ WaitThread* m_thread;
+ wxTimer m_timer;
+ };
+}
+
+#endif // TC_HEADER_Main_Forms_WaitDialog