VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Main/Forms
diff options
context:
space:
mode:
Diffstat (limited to 'src/Main/Forms')
-rw-r--r--src/Main/Forms/AboutDialog.cpp6
-rw-r--r--src/Main/Forms/DeviceSelectionDialog.cpp40
-rw-r--r--src/Main/Forms/EncryptionOptionsWizardPage.cpp18
-rw-r--r--src/Main/Forms/EncryptionOptionsWizardPage.h6
-rw-r--r--src/Main/Forms/Forms.cpp21
-rw-r--r--src/Main/Forms/KeyfilesPanel.cpp2
-rw-r--r--src/Main/Forms/MainFrame.cpp18
-rw-r--r--src/Main/Forms/MainFrame.h36
-rw-r--r--src/Main/Forms/PreferencesDialog.cpp2
-rw-r--r--src/Main/Forms/PreferencesDialog.h2
-rw-r--r--src/Main/Forms/ProgressWizardPage.h2
-rw-r--r--src/Main/Forms/TrueCrypt.fbp24
-rw-r--r--src/Main/Forms/VolumeCreationProgressWizardPage.h2
-rw-r--r--src/Main/Forms/VolumeCreationWizard.cpp165
-rw-r--r--src/Main/Forms/VolumeCreationWizard.h6
-rw-r--r--src/Main/Forms/VolumeFormatOptionsWizardPage.cpp21
-rw-r--r--src/Main/Forms/VolumePasswordPanel.cpp16
-rw-r--r--src/Main/Forms/VolumeSizeWizardPage.cpp10
-rw-r--r--src/Main/Forms/VolumeSizeWizardPage.h1
-rw-r--r--src/Main/Forms/WaitDialog.cpp2
20 files changed, 304 insertions, 96 deletions
diff --git a/src/Main/Forms/AboutDialog.cpp b/src/Main/Forms/AboutDialog.cpp
index 60edc58..300db72 100644
--- a/src/Main/Forms/AboutDialog.cpp
+++ b/src/Main/Forms/AboutDialog.cpp
@@ -57,7 +57,7 @@ namespace VeraCrypt
L"Paulo Barreto, Brian Gladman, Wei Dai, Peter Gutmann, and many others.\n\n"
L"Portions of this software:\n"
- L"Copyright \xA9 2013-2019 IDRIX. All rights reserved.\n"
+ L"Copyright \xA9 2013-2020 IDRIX. All rights reserved.\n"
L"Copyright \xA9 2003-2012 TrueCrypt Developers Association. All Rights Reserved.\n"
L"Copyright \xA9 1998-2000 Paul Le Roux. All Rights Reserved.\n"
L"Copyright \xA9 1998-2008 Brian Gladman. All Rights Reserved.\n"
@@ -66,10 +66,10 @@ namespace VeraCrypt
L"Copyright \xA9 1999-2017 Dieter Baron and Thomas Klausner.\n"
L"Copyright \xA9 2013, Alexey Degtyarev. All rights reserved.\n"
L"Copyright \xA9 1999-2016 Jack Lloyd. All rights reserved.\n"
- L"Copyright \xA9 2013-2018 Stephan Mueller <smueller@chronox.de>\n\n"
+ L"Copyright \xA9 2013-2019 Stephan Mueller <smueller@chronox.de>\n\n"
L"\nThis software as a whole:\n"
- L"Copyright \xA9 2013-2019 IDRIX. All rights reserved.\n\n"
+ L"Copyright \xA9 2013-2020 IDRIX. All rights reserved.\n\n"
L"This software uses wxWidgets library, which is copyright \xA9 1998-2011 Julian Smart, Robert Roebling et al.\n\n"
diff --git a/src/Main/Forms/DeviceSelectionDialog.cpp b/src/Main/Forms/DeviceSelectionDialog.cpp
index c3a3d84..c886e18 100644
--- a/src/Main/Forms/DeviceSelectionDialog.cpp
+++ b/src/Main/Forms/DeviceSelectionDialog.cpp
@@ -48,13 +48,31 @@ namespace VeraCrypt
foreach_ref (HostDevice &device, DeviceList)
{
- if (device.Size == 0)
- continue;
-
vector <wstring> fields (DeviceListCtrl->GetColumnCount());
-
+
if (DeviceListCtrl->GetItemCount() > 0)
Gui->AppendToListCtrl (DeviceListCtrl, fields);
+
+ // i.e. /dev/rdisk0 might have size = 0 in case open() fails because, for example on OSX,
+ // SIP is enabled on the machine ;
+ // This does not mean that it does not have partitions that have been successfully opened
+ // and have a size != 0 ;
+ // Therefore, we do not show the device ONLY if it does not have partitions with size != 0 ;
+ if (device.Size == 0)
+ {
+ bool bHasNonEmptyPartition = false;
+ foreach_ref (HostDevice &partition, device.Partitions)
+ {
+ if (partition.Size)
+ {
+ bHasNonEmptyPartition = true;
+ break;
+ }
+ }
+
+ if (!bHasNonEmptyPartition)
+ continue;
+ }
#ifdef TC_WINDOWS
fields[ColumnDevice] = StringFormatter (L"{0} {1}:", _("Harddisk"), device.SystemNumber);
@@ -64,11 +82,20 @@ namespace VeraCrypt
fields[ColumnDevice] = wstring (device.Path) + L":";
fields[ColumnMountPoint] = device.MountPoint;
#endif
- fields[ColumnSize] = Gui->SizeToString (device.Size);
+ // If the size of the device is 0, we do not show the size to avoid confusing the user ;
+ if (device.Size)
+ fields[ColumnSize] = Gui->SizeToString (device.Size);
+ else
+ fields[ColumnSize] = L"";
Gui->AppendToListCtrl (DeviceListCtrl, fields, 0, &device);
foreach_ref (HostDevice &partition, device.Partitions)
{
+ // If a partition's size is 0, there is no need to show it in the list
+ // since this means it is not usable (i.e on OSX, because of SIP enabled in the machine) ;
+ if (!partition.Size)
+ continue;
+
fields[ColumnDevice] =
#ifndef TC_WINDOWS
wstring (L" ") +
@@ -113,7 +140,8 @@ namespace VeraCrypt
void DeviceSelectionDialog::OnListItemSelected (wxListEvent& event)
{
HostDevice *device = (HostDevice *) (event.GetItem().GetData());
- if (device)
+ // If a device's size is 0, we do not enable the 'OK' button since it is not usable
+ if (device && device->Size)
{
SelectedDevice = *device;
StdButtonsOK->Enable();
diff --git a/src/Main/Forms/EncryptionOptionsWizardPage.cpp b/src/Main/Forms/EncryptionOptionsWizardPage.cpp
index e20a659..0d899fb 100644
--- a/src/Main/Forms/EncryptionOptionsWizardPage.cpp
+++ b/src/Main/Forms/EncryptionOptionsWizardPage.cpp
@@ -24,6 +24,9 @@ namespace VeraCrypt
: EncryptionOptionsWizardPageBase (parent)
{
+#ifdef TC_MACOSX
+ EncryptionAlgorithmStaticText->Connect( wxEVT_SIZE, wxSizeEventHandler( EncryptionOptionsWizardPage::HandleOnSize ), NULL, this );
+#endif
EncryptionAlgorithms = EncryptionAlgorithm::GetAvailableAlgorithms();
foreach (shared_ptr <EncryptionAlgorithm> ea, EncryptionAlgorithms)
{
@@ -45,6 +48,21 @@ namespace VeraCrypt
}
+#ifdef TC_MACOSX
+ EncryptionOptionsWizardPage::~EncryptionOptionsWizardPage()
+ {
+ EncryptionAlgorithmStaticText->Disconnect( wxEVT_SIZE, wxSizeEventHandler( EncryptionOptionsWizardPage::HandleOnSize ), NULL, this );
+ }
+
+ void EncryptionOptionsWizardPage::HandleOnSize( wxSizeEvent& event )
+ {
+ int width, height;
+ EncryptionAlgorithmStaticText->GetClientSize (&width, &height);
+ EncryptionAlgorithmStaticText->Wrap (width);
+ event.Skip();
+ }
+#endif
+
shared_ptr <EncryptionAlgorithm> EncryptionOptionsWizardPage::GetEncryptionAlgorithm () const
{
return Gui->GetSelectedData <EncryptionAlgorithm> (EncryptionAlgorithmChoice)->GetNew();
diff --git a/src/Main/Forms/EncryptionOptionsWizardPage.h b/src/Main/Forms/EncryptionOptionsWizardPage.h
index b8d42d7..fbc63f9 100644
--- a/src/Main/Forms/EncryptionOptionsWizardPage.h
+++ b/src/Main/Forms/EncryptionOptionsWizardPage.h
@@ -22,6 +22,9 @@ namespace VeraCrypt
public:
EncryptionOptionsWizardPage (wxPanel* parent);
+#ifdef TC_MACOSX
+ ~EncryptionOptionsWizardPage ();
+#endif
shared_ptr <EncryptionAlgorithm> GetEncryptionAlgorithm () const;
shared_ptr <Hash> GetHash () const;
bool IsValid () { return true; }
@@ -37,6 +40,9 @@ namespace VeraCrypt
void OnHashHyperlinkClick (wxHyperlinkEvent& event);
void OnTestButtonClick (wxCommandEvent& event);
+#ifdef TC_MACOSX
+ void HandleOnSize( wxSizeEvent& event );
+#endif
EncryptionAlgorithmList EncryptionAlgorithms;
HashList Hashes;
};
diff --git a/src/Main/Forms/Forms.cpp b/src/Main/Forms/Forms.cpp
index ad1a3ee..c0a4070 100644
--- a/src/Main/Forms/Forms.cpp
+++ b/src/Main/Forms/Forms.cpp
@@ -328,7 +328,7 @@ MainFrameBase::MainFrameBase( wxWindow* parent, wxWindowID id, const wxString& t
VolumeStaticBoxSizer->Add( VolumeGridBagSizer, 1, wxEXPAND|wxALL, 4 );
- LowStaticBoxSizer->Add( VolumeStaticBoxSizer, 1, wxEXPAND, 5 );
+ LowStaticBoxSizer->Add( VolumeStaticBoxSizer, 1, wxEXPAND|wxALL, 5 );
LowStaticBoxSizer->Add( 0, 0, 0, 0, 5 );
@@ -344,46 +344,49 @@ MainFrameBase::MainFrameBase( wxWindow* parent, wxWindowID id, const wxString& t
VolumeButton->SetDefault();
VolumeButton->SetMinSize( wxSize( -1,32 ) );
- sbSizer4->Add( VolumeButton, 1, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxTOP, 2 );
+ sbSizer4->Add( VolumeButton, 1, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxALL, 2 );
gSizer2->Add( sbSizer4, 1, wxEXPAND, 0 );
wxStaticBoxSizer* sbSizer41;
sbSizer41 = new wxStaticBoxSizer( new wxStaticBox( MainPanel, wxID_ANY, wxEmptyString ), wxVERTICAL );
+ sbSizer41->SetMinSize( wxSize( 139,-1 ) );
MountAllDevicesButton = new wxButton( MainPanel, wxID_ANY, _("&Auto-Mount Devices"), wxDefaultPosition, wxDefaultSize, 0 );
MountAllDevicesButton->SetMinSize( wxSize( -1,32 ) );
- sbSizer41->Add( MountAllDevicesButton, 1, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxTOP, 2 );
+ sbSizer41->Add( MountAllDevicesButton, 1, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxALL, 2 );
- gSizer2->Add( sbSizer41, 1, wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
+ gSizer2->Add( sbSizer41, 1, wxEXPAND, 5 );
wxStaticBoxSizer* sbSizer42;
sbSizer42 = new wxStaticBoxSizer( new wxStaticBox( MainPanel, wxID_ANY, wxEmptyString ), wxVERTICAL );
+ sbSizer42->SetMinSize( wxSize( 139,-1 ) );
DismountAllButton = new wxButton( MainPanel, wxID_ANY, _("Di&smount All"), wxDefaultPosition, wxDefaultSize, 0 );
DismountAllButton->SetMinSize( wxSize( -1,32 ) );
- sbSizer42->Add( DismountAllButton, 1, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxTOP, 2 );
+ sbSizer42->Add( DismountAllButton, 1, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxALL, 2 );
- gSizer2->Add( sbSizer42, 1, wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
+ gSizer2->Add( sbSizer42, 1, wxEXPAND, 5 );
wxStaticBoxSizer* sbSizer43;
sbSizer43 = new wxStaticBoxSizer( new wxStaticBox( MainPanel, wxID_ANY, wxEmptyString ), wxVERTICAL );
+ sbSizer43->SetMinSize( wxSize( 139,-1 ) );
ExitButton = new wxButton( MainPanel, wxID_ANY, _("E&xit"), wxDefaultPosition, wxDefaultSize, 0 );
ExitButton->SetMinSize( wxSize( -1,32 ) );
- sbSizer43->Add( ExitButton, 1, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxTOP, 2 );
+ sbSizer43->Add( ExitButton, 1, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxALL, 2 );
- gSizer2->Add( sbSizer43, 1, wxALIGN_RIGHT|wxEXPAND, 5 );
+ gSizer2->Add( sbSizer43, 1, wxEXPAND, 5 );
- LowStaticBoxSizer->Add( gSizer2, 0, wxEXPAND, 5 );
+ LowStaticBoxSizer->Add( gSizer2, 0, wxEXPAND|wxALL, 5 );
bSizer48->Add( LowStaticBoxSizer, 0, wxEXPAND, 5 );
diff --git a/src/Main/Forms/KeyfilesPanel.cpp b/src/Main/Forms/KeyfilesPanel.cpp
index 71077e8..c1f26d8 100644
--- a/src/Main/Forms/KeyfilesPanel.cpp
+++ b/src/Main/Forms/KeyfilesPanel.cpp
@@ -59,10 +59,8 @@ namespace VeraCrypt
SetDropTarget (new FileDropTarget (this));
KeyfilesListCtrl->SetDropTarget (new FileDropTarget (this));
-#ifdef TC_MACOSX
foreach (wxWindow *c, GetChildren())
c->SetDropTarget (new FileDropTarget (this));
-#endif
UpdateButtons();
}
diff --git a/src/Main/Forms/MainFrame.cpp b/src/Main/Forms/MainFrame.cpp
index ad5bf5b..417c2a6 100644
--- a/src/Main/Forms/MainFrame.cpp
+++ b/src/Main/Forms/MainFrame.cpp
@@ -99,6 +99,9 @@ namespace VeraCrypt
Connect( wxID_ANY, wxEVT_COMMAND_PREF_UPDATED, wxCommandEventHandler( MainFrame::OnPreferencesUpdated ) );
Connect( wxID_ANY, wxEVT_COMMAND_OPEN_VOLUME_REQUEST, wxCommandEventHandler( MainFrame::OnOpenVolumeSystemRequest ) );
+#ifdef TC_MACOSX
+ Connect( wxID_ANY, wxEVT_MOVE, wxMoveEventHandler( MainFrame::OnMoveHandler ) );
+#endif
}
MainFrame::~MainFrame ()
@@ -119,6 +122,9 @@ namespace VeraCrypt
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 ) );
+#ifdef TC_MACOSX
+ Disconnect( wxID_ANY, wxEVT_MOVE, wxMoveEventHandler( MainFrame::OnMoveHandler ) );
+#endif
Core->VolumeMountedEvent.Disconnect (this);
Core->VolumeDismountedEvent.Disconnect (this);
Gui->OpenVolumeSystemRequestEvent.Disconnect (this);
@@ -393,10 +399,8 @@ namespace VeraCrypt
};
SetDropTarget (new FileDropTarget (this));
-#ifdef TC_MACOSX
foreach (wxWindow *c, MainPanel->GetChildren())
c->SetDropTarget (new FileDropTarget (this));
-#endif
// Volume history
VolumeHistory::ConnectComboBox (VolumePathComboBox);
@@ -505,7 +509,7 @@ namespace VeraCrypt
wxMenu *CreatePopupMenu ()
{
- auto_ptr <wxMenu> popup (new wxMenu);
+ unique_ptr <wxMenu> popup (new wxMenu);
Gui->AppendToMenu (*popup, LangString[Gui->IsInBackgroundMode() ? "SHOW_TC" : "HIDE_TC"], this, wxCommandEventHandler (TaskBarIcon::OnShowHideMenuItemSelected));
@@ -727,6 +731,7 @@ namespace VeraCrypt
#ifdef TC_MACOSX
if (Gui->IsInBackgroundMode())
Gui->SetBackgroundMode (false);
+ EnsureVisible ();
#endif
AboutDialog dialog (this);
dialog.ShowModal();
@@ -1724,4 +1729,11 @@ namespace VeraCrypt
Core->WipePasswordCache();
UpdateWipeCacheButton();
}
+
+#ifdef TC_MACOSX
+ void MainFrame::OnMoveHandler(wxMoveEvent& event)
+ {
+ EnsureVisible (true);
+ }
+#endif
}
diff --git a/src/Main/Forms/MainFrame.h b/src/Main/Forms/MainFrame.h
index 39c411a..9089ce7 100644
--- a/src/Main/Forms/MainFrame.h
+++ b/src/Main/Forms/MainFrame.h
@@ -15,6 +15,9 @@
#include "Forms.h"
#include "ChangePasswordDialog.h"
+#ifdef TC_MACOSX
+#include <wx/display.h>
+#endif
namespace VeraCrypt
{
@@ -162,6 +165,35 @@ namespace VeraCrypt
void UpdateWipeCacheButton ();
void WipeCache ();
+#ifdef TC_MACOSX
+ void OnMoveHandler(wxMoveEvent& event);
+
+ void EnsureVisible(bool bOnlyHeadingBar = false)
+ {
+ wxDisplay display (this);
+ wxRect displayRect = display.GetClientArea();
+
+ bool bMove = false;
+ wxPoint p = GetScreenPosition();
+ wxRect r = GetRect ();
+ wxRect rc = GetClientRect ();
+ int titleBarHeight = r.height - rc.height;
+
+ if (!bOnlyHeadingBar && (p.x < displayRect.x))
+ p.x = 0, bMove = true;
+ if (p.y < displayRect.y)
+ p.y = displayRect.y, bMove = true;
+ if (!bOnlyHeadingBar && (p.x + r.width > displayRect.x + displayRect.width))
+ p.x = displayRect.x + displayRect.width - r.width, bMove = true;
+ if (!bOnlyHeadingBar && (p.y + r.height > displayRect.y + displayRect.height))
+ p.y = displayRect.y + displayRect.height - r.height, bMove = true;
+ if (bOnlyHeadingBar && (p.y > (displayRect.y + displayRect.height - titleBarHeight)))
+ p.y = displayRect.y + displayRect.height - titleBarHeight, bMove = true;
+ if (bMove)
+ Move (p);
+ }
+#endif
+
struct VolumeActivityMapEntry
{
VolumeActivityMapEntry () { }
@@ -182,8 +214,8 @@ namespace VeraCrypt
map <int, FavoriteVolume> FavoriteVolumesMenuMap;
bool ListItemRightClickEventPending;
VolumeInfoList MountedVolumes;
- auto_ptr <wxTaskBarIcon> mTaskBarIcon;
- auto_ptr <wxTimer> mTimer;
+ unique_ptr <wxTaskBarIcon> mTaskBarIcon;
+ unique_ptr <wxTimer> mTimer;
long SelectedItemIndex;
VolumeSlotNumber SelectedSlotNumber;
int ShowRequestFifo;
diff --git a/src/Main/Forms/PreferencesDialog.cpp b/src/Main/Forms/PreferencesDialog.cpp
index e2b4f62..ee4b2d5 100644
--- a/src/Main/Forms/PreferencesDialog.cpp
+++ b/src/Main/Forms/PreferencesDialog.cpp
@@ -87,7 +87,7 @@ namespace VeraCrypt
// Encryption
AesHwCpuSupportedStaticText->SetLabel (
#ifdef TC_AES_HW_CPU
- (is_aes_hw_cpu_supported() ? LangString["UISTR_YES"] : LangString["UISTR_NO"]));
+ (HasAESNI() ? LangString["UISTR_YES"] : LangString["UISTR_NO"]));
#else
LangString["NOT_APPLICABLE_OR_NOT_AVAILABLE"]);
#endif
diff --git a/src/Main/Forms/PreferencesDialog.h b/src/Main/Forms/PreferencesDialog.h
index 25a0f85..0cd1482 100644
--- a/src/Main/Forms/PreferencesDialog.h
+++ b/src/Main/Forms/PreferencesDialog.h
@@ -54,7 +54,7 @@ namespace VeraCrypt
KeyfilesPanel *DefaultKeyfilesPanel;
int LastVirtualKeyPressed;
- auto_ptr <wxTimer> mTimer;
+ unique_ptr <wxTimer> mTimer;
UserPreferences Preferences;
bool RestoreValidatorBell;
HotkeyList UnregisteredHotkeys;
diff --git a/src/Main/Forms/ProgressWizardPage.h b/src/Main/Forms/ProgressWizardPage.h
index cc50fa6..34f5cf4 100644
--- a/src/Main/Forms/ProgressWizardPage.h
+++ b/src/Main/Forms/ProgressWizardPage.h
@@ -36,7 +36,7 @@ namespace VeraCrypt
void OnAbortButtonClick (wxCommandEvent& event);
void OnTimer ();
- auto_ptr <wxTimer> mTimer;
+ unique_ptr <wxTimer> mTimer;
int PreviousGaugeValue;
uint64 ProgressBarRange;
int RealProgressBarRange;
diff --git a/src/Main/Forms/TrueCrypt.fbp b/src/Main/Forms/TrueCrypt.fbp
index 7509f1e..d512ce8 100644
--- a/src/Main/Forms/TrueCrypt.fbp
+++ b/src/Main/Forms/TrueCrypt.fbp
@@ -1373,7 +1373,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
- <property name="flag">wxEXPAND</property>
+ <property name="flag">wxEXPAND|wxALL</property>
<property name="proportion">1</property>
<object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property>
@@ -1989,7 +1989,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
- <property name="flag">wxEXPAND</property>
+ <property name="flag">wxEXPAND|wxALL</property>
<property name="proportion">0</property>
<object class="wxGridSizer" expanded="1">
<property name="cols">4</property>
@@ -2013,7 +2013,7 @@
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="1">
<property name="border">2</property>
- <property name="flag">wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxTOP</property>
+ <property name="flag">wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxALL</property>
<property name="proportion">1</property>
<object class="wxButton" expanded="1">
<property name="BottomDockable">1</property>
@@ -2103,19 +2103,19 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
- <property name="flag">wxALIGN_CENTER_HORIZONTAL|wxEXPAND</property>
+ <property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property>
<property name="label"></property>
- <property name="minimum_size">-1,-1</property>
+ <property name="minimum_size">139,-1</property>
<property name="name">sbSizer41</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="1">
<property name="border">2</property>
- <property name="flag">wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxTOP</property>
+ <property name="flag">wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxALL</property>
<property name="proportion">1</property>
<object class="wxButton" expanded="1">
<property name="BottomDockable">1</property>
@@ -2205,19 +2205,19 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
- <property name="flag">wxALIGN_CENTER_HORIZONTAL|wxEXPAND</property>
+ <property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property>
<property name="label"></property>
- <property name="minimum_size">-1,-1</property>
+ <property name="minimum_size">139,-1</property>
<property name="name">sbSizer42</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="1">
<property name="border">2</property>
- <property name="flag">wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxTOP</property>
+ <property name="flag">wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxALL</property>
<property name="proportion">1</property>
<object class="wxButton" expanded="1">
<property name="BottomDockable">1</property>
@@ -2307,19 +2307,19 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
- <property name="flag">wxALIGN_RIGHT|wxEXPAND</property>
+ <property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property>
<property name="label"></property>
- <property name="minimum_size">-1,-1</property>
+ <property name="minimum_size">139,-1</property>
<property name="name">sbSizer43</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="1">
<property name="border">2</property>
- <property name="flag">wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxTOP</property>
+ <property name="flag">wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxALL</property>
<property name="proportion">1</property>
<object class="wxButton" expanded="1">
<property name="BottomDockable">1</property>
diff --git a/src/Main/Forms/VolumeCreationProgressWizardPage.h b/src/Main/Forms/VolumeCreationProgressWizardPage.h
index 345ee59..fad4ac9 100644
--- a/src/Main/Forms/VolumeCreationProgressWizardPage.h
+++ b/src/Main/Forms/VolumeCreationProgressWizardPage.h
@@ -48,7 +48,7 @@ namespace VeraCrypt
int PreviousGaugeValue;
uint64 ProgressBarRange;
- auto_ptr <wxTimer> RandomPoolTimer;
+ unique_ptr <wxTimer> RandomPoolTimer;
int RealProgressBarRange;
wxLongLong StartTime;
bool VolumeCreatorRunning;
diff --git a/src/Main/Forms/VolumeCreationWizard.cpp b/src/Main/Forms/VolumeCreationWizard.cpp
index b28b1c3..4df2030 100644
--- a/src/Main/Forms/VolumeCreationWizard.cpp
+++ b/src/Main/Forms/VolumeCreationWizard.cpp
@@ -14,6 +14,7 @@
#include "Platform/SystemInfo.h"
#ifdef TC_UNIX
#include <unistd.h>
+#include <sys/statvfs.h> // header for statvfs
#include "Platform/Unix/Process.h"
#endif
#include "Core/RandomNumberGenerator.h"
@@ -58,6 +59,7 @@ namespace VeraCrypt
SelectedVolumeHostType (VolumeHostType::File),
SelectedVolumeType (VolumeType::Normal),
Pim (0),
+ OuterPim (0),
SectorSize (0),
VolumeSize (0)
{
@@ -92,6 +94,8 @@ namespace VeraCrypt
VolumeCreationWizard::~VolumeCreationWizard ()
{
+ burn (&Pim, sizeof (Pim));
+ burn (&OuterPim, sizeof (OuterPim));
}
WizardPage *VolumeCreationWizard::GetPage (WizardStep step)
@@ -175,7 +179,7 @@ namespace VeraCrypt
else if (SelectedVolumeType == VolumeType::Hidden)
{
pageTitle = LangString["SIZE_HIDVOL_TITLE"];
- pageText = LangString["SIZE_HELP_HIDDEN_VOL"] + L"\n\n" + _("Please note that if your operating system does not allocate files from the beginning of the free space, the maximum possible hidden volume size may be much smaller than the size of the free space on the outer volume. This not a bug in VeraCrypt but a limitation of the operating system.");
+ pageText = LangString["SIZE_HELP_HIDDEN_VOL"] + L"\n\n" + _("Please note that if your operating system does not allocate files from the beginning of the free space, the maximum possible hidden volume size may be much smaller than the size of the free space on the outer volume. This is not a bug in VeraCrypt but a limitation of the operating system.");
freeSpaceText = StringFormatter (_("Maximum possible hidden volume size for this volume is {0}."), Gui->SizeToString (MaxHiddenVolumeSize));
}
else
@@ -462,24 +466,7 @@ namespace VeraCrypt
#ifdef TC_UNIX
// Format non-FAT filesystem
- const char *fsFormatter = nullptr;
-
- switch (SelectedFilesystemType)
- {
-#if defined (TC_LINUX)
- case VolumeCreationOptions::FilesystemType::Ext2: fsFormatter = "mkfs.ext2"; break;
- case VolumeCreationOptions::FilesystemType::Ext3: fsFormatter = "mkfs.ext3"; break;
- case VolumeCreationOptions::FilesystemType::Ext4: fsFormatter = "mkfs.ext4"; break;
- case VolumeCreationOptions::FilesystemType::NTFS: fsFormatter = "mkfs.ntfs"; break;
- case VolumeCreationOptions::FilesystemType::exFAT: fsFormatter = "mkfs.exfat"; break;
-#elif defined (TC_MACOSX)
- case VolumeCreationOptions::FilesystemType::MacOsExt: fsFormatter = "newfs_hfs"; break;
- case VolumeCreationOptions::FilesystemType::exFAT: fsFormatter = "newfs_exfat"; break;
-#elif defined (TC_FREEBSD) || defined (TC_SOLARIS)
- case VolumeCreationOptions::FilesystemType::UFS: fsFormatter = "newfs" ; break;
-#endif
- default: break;
- }
+ const char *fsFormatter = VolumeCreationOptions::FilesystemType::GetFsFormatter (SelectedFilesystemType);
if (fsFormatter)
{
@@ -539,6 +526,9 @@ namespace VeraCrypt
if (SelectedFilesystemType == VolumeCreationOptions::FilesystemType::NTFS)
args.push_back ("-f");
+ if (SelectedFilesystemType == VolumeCreationOptions::FilesystemType::Btrfs)
+ args.push_back ("-f");
+
args.push_back (string (virtualDevice));
Process::Execute (fsFormatter, args);
@@ -791,13 +781,31 @@ namespace VeraCrypt
// Clear PIM
Pim = 0;
- // Skip PIM
- if (forward && OuterVolume)
+ if (forward && !OuterVolume && SelectedVolumeType == VolumeType::Hidden)
{
- // Use FAT to prevent problems with free space
- QuickFormatEnabled = false;
- SelectedFilesystemType = VolumeCreationOptions::FilesystemType::FAT;
- return Step::CreationProgress;
+ shared_ptr <VolumePassword> hiddenPassword;
+ try
+ {
+ hiddenPassword = Keyfile::ApplyListToPassword (Keyfiles, Password);
+ }
+ catch (...)
+ {
+ hiddenPassword = Password;
+ }
+
+ // check if Outer and Hidden passwords are the same
+ if ( (hiddenPassword && !hiddenPassword->IsEmpty() && OuterPassword && !OuterPassword->IsEmpty() && (*(OuterPassword.get()) == *(hiddenPassword.get())))
+ ||
+ ((!hiddenPassword || hiddenPassword->IsEmpty()) && (!OuterPassword || OuterPassword->IsEmpty()))
+ )
+ {
+ //check if they have also the same PIM
+ if (OuterPim == Pim)
+ {
+ Gui->ShowError (_("The Hidden volume can't have the same password, PIM and keyfiles as the Outer volume"));
+ return GetCurrentStep();
+ }
+ }
}
if (VolumeSize > 4 * BYTES_PER_GB)
@@ -817,15 +825,42 @@ namespace VeraCrypt
VolumePimWizardPage *page = dynamic_cast <VolumePimWizardPage *> (GetCurrentPage());
Pim = page->GetVolumePim();
- if (forward && Password && !Password->IsEmpty())
+ if (-1 == Pim)
{
- if (-1 == Pim)
+ // PIM invalid: don't go anywhere
+ Gui->ShowError ("PIM_TOO_BIG");
+ return GetCurrentStep();
+ }
+
+ if (forward && !OuterVolume && SelectedVolumeType == VolumeType::Hidden)
+ {
+ shared_ptr <VolumePassword> hiddenPassword;
+ try
{
- // PIM invalid: don't go anywhere
- Gui->ShowError ("PIM_TOO_BIG");
- return GetCurrentStep();
+ hiddenPassword = Keyfile::ApplyListToPassword (Keyfiles, Password);
+ }
+ catch (...)
+ {
+ hiddenPassword = Password;
}
+ // check if Outer and Hidden passwords are the same
+ if ( (hiddenPassword && !hiddenPassword->IsEmpty() && OuterPassword && !OuterPassword->IsEmpty() && (*(OuterPassword.get()) == *(hiddenPassword.get())))
+ ||
+ ((!hiddenPassword || hiddenPassword->IsEmpty()) && (!OuterPassword || OuterPassword->IsEmpty()))
+ )
+ {
+ //check if they have also the same PIM
+ if (OuterPim == Pim)
+ {
+ Gui->ShowError (_("The Hidden volume can't have the same password, PIM and keyfiles as the Outer volume"));
+ return GetCurrentStep();
+ }
+ }
+ }
+
+ if (forward && Password && !Password->IsEmpty())
+ {
if (Password->Size() < VolumePassword::WarningSizeThreshold)
{
if (Pim > 0 && Pim < 485)
@@ -843,15 +878,6 @@ namespace VeraCrypt
}
}
-
- if (forward && OuterVolume)
- {
- // Use FAT to prevent problems with free space
- QuickFormatEnabled = false;
- SelectedFilesystemType = VolumeCreationOptions::FilesystemType::FAT;
- return Step::CreationProgress;
- }
-
if (VolumeSize > 4 * BYTES_PER_GB)
{
if (VolumeSize <= TC_MAX_FAT_SECTOR_COUNT * SectorSize)
@@ -887,6 +913,22 @@ namespace VeraCrypt
case Step::FormatOptions:
{
VolumeFormatOptionsWizardPage *page = dynamic_cast <VolumeFormatOptionsWizardPage *> (GetCurrentPage());
+
+ if (forward && OuterVolume)
+ {
+ if (page->GetFilesystemType() != VolumeCreationOptions::FilesystemType::FAT)
+ {
+ if (!Gui->AskYesNo (_("WARNING: You have selected a filesystem other than FAT for the outer volume.\n"
+ "Please Note that in this case VeraCrypt can't calculate the exact maximum allowed size for the hidden volume and it will use only an estimation that can be wrong.\n"
+ "Thus, it is your responsibility to use an adequate value for the size of the hidden volume so that it doesn\'t overlap the outer volume.\n\n"
+ "Do you want to continue using the selected filesystem for the outer volume?")
+ , false, true))
+ {
+ return GetCurrentStep();
+ }
+ }
+ }
+
SelectedFilesystemType = page->GetFilesystemType();
QuickFormatEnabled = page->IsQuickFormatEnabled();
@@ -1025,6 +1067,12 @@ namespace VeraCrypt
Creator.reset();
SetCancelButtonText (L"");
+ // clear saved credentials
+ Password.reset();
+ OuterPassword.reset();
+ burn (&Pim, sizeof (Pim));
+ burn (&OuterPim, sizeof (OuterPim));
+
return Step::VolumeHostType;
case Step::OuterVolumeContents:
@@ -1034,12 +1082,23 @@ namespace VeraCrypt
// require using FUSE and loop device which cannot be used for devices with sectors larger than 512.
wxBusyCursor busy;
+ bool outerVolumeAvailableSpaceValid = false;
+ uint64 outerVolumeAvailableSpace = 0;
MaxHiddenVolumeSize = 0;
Gui->SetActiveFrame (this);
if (MountedOuterVolume)
{
+#ifdef TC_UNIX
+ const DirectoryPath &outerVolumeMountPoint = MountedOuterVolume->MountPoint;
+ struct statvfs stat;
+ if (statvfs(((string)outerVolumeMountPoint).c_str(), &stat) == 0)
+ {
+ outerVolumeAvailableSpace = (uint64) stat.f_bsize * (uint64) stat.f_bavail;
+ outerVolumeAvailableSpaceValid = true;
+ }
+#endif
Core->DismountVolume (MountedOuterVolume);
MountedOuterVolume.reset();
}
@@ -1062,7 +1121,21 @@ namespace VeraCrypt
#endif
shared_ptr <Volume> outerVolume = Core->OpenVolume (make_shared <VolumePath> (SelectedVolumePath), true, Password, Pim, Kdf, false, Keyfiles, VolumeProtection::ReadOnly);
- MaxHiddenVolumeSize = Core->GetMaxHiddenVolumeSize (outerVolume);
+ try
+ {
+ MaxHiddenVolumeSize = Core->GetMaxHiddenVolumeSize (outerVolume);
+ }
+ catch (ParameterIncorrect& )
+ {
+ // Outer volume not using FAT
+ // estimate maximum hidden volume size as 80% of available size of outer volume
+ if (outerVolumeAvailableSpaceValid)
+ {
+ MaxHiddenVolumeSize =(4ULL * outerVolumeAvailableSpace) / 5ULL;
+ }
+ else
+ throw;
+ }
// Add a reserve (in case the user mounts the outer volume and creates new files
// on it by accident or OS writes some new data behind his or her back, such as
@@ -1078,6 +1151,18 @@ namespace VeraCrypt
MaxHiddenVolumeSize -= reservedSize;
MaxHiddenVolumeSize -= MaxHiddenVolumeSize % outerVolume->GetSectorSize(); // Must be a multiple of the sector size
+
+ // remember Outer password and keyfiles in order to be able to compare it with those of Hidden volume
+ try
+ {
+ OuterPassword = Keyfile::ApplyListToPassword (Keyfiles, Password);
+ }
+ catch (...)
+ {
+ OuterPassword = Password;
+ }
+
+ OuterPim = Pim;
}
catch (exception &e)
{
diff --git a/src/Main/Forms/VolumeCreationWizard.h b/src/Main/Forms/VolumeCreationWizard.h
index c408742..fd4b3e0 100644
--- a/src/Main/Forms/VolumeCreationWizard.h
+++ b/src/Main/Forms/VolumeCreationWizard.h
@@ -67,8 +67,8 @@ namespace VeraCrypt
bool CrossPlatformSupport;
static bool DeviceWarningConfirmed;
bool DisplayKeyInfo;
- auto_ptr <wxTimer> ProgressTimer;
- auto_ptr <wxTimer> RandomPoolUpdateTimer;
+ unique_ptr <wxTimer> ProgressTimer;
+ unique_ptr <wxTimer> RandomPoolUpdateTimer;
shared_ptr <KeyfileList> Keyfiles;
bool LargeFilesSupport;
uint64 MaxHiddenVolumeSize;
@@ -82,7 +82,9 @@ namespace VeraCrypt
VolumeHostType::Enum SelectedVolumeHostType;
VolumeType::Enum SelectedVolumeType;
shared_ptr <VolumePassword> Password;
+ shared_ptr <VolumePassword> OuterPassword;
int Pim;
+ int OuterPim;
shared_ptr <Pkcs5Kdf> Kdf;
uint32 SectorSize;
shared_ptr <Hash> SelectedHash;
diff --git a/src/Main/Forms/VolumeFormatOptionsWizardPage.cpp b/src/Main/Forms/VolumeFormatOptionsWizardPage.cpp
index ec0d778..30f8c6b 100644
--- a/src/Main/Forms/VolumeFormatOptionsWizardPage.cpp
+++ b/src/Main/Forms/VolumeFormatOptionsWizardPage.cpp
@@ -13,6 +13,7 @@
#include "System.h"
#include "Main/GraphicUserInterface.h"
#include "VolumeFormatOptionsWizardPage.h"
+#include <wx/platinfo.h>
namespace VeraCrypt
{
@@ -34,12 +35,24 @@ namespace VeraCrypt
#elif defined (TC_LINUX)
FilesystemTypeChoice->Append (L"Linux Ext2", (void *) VolumeCreationOptions::FilesystemType::Ext2);
FilesystemTypeChoice->Append (L"Linux Ext3", (void *) VolumeCreationOptions::FilesystemType::Ext3);
- FilesystemTypeChoice->Append (L"Linux Ext4", (void *) VolumeCreationOptions::FilesystemType::Ext4);
- FilesystemTypeChoice->Append (L"NTFS", (void *) VolumeCreationOptions::FilesystemType::NTFS);
- FilesystemTypeChoice->Append (L"exFAT", (void *) VolumeCreationOptions::FilesystemType::exFAT);
+ if (VolumeCreationOptions::FilesystemType::IsFsFormatterPresent (VolumeCreationOptions::FilesystemType::Ext4))
+ FilesystemTypeChoice->Append (L"Linux Ext4", (void *) VolumeCreationOptions::FilesystemType::Ext4);
+ if (VolumeCreationOptions::FilesystemType::IsFsFormatterPresent (VolumeCreationOptions::FilesystemType::NTFS))
+ FilesystemTypeChoice->Append (L"NTFS", (void *) VolumeCreationOptions::FilesystemType::NTFS);
+ if (VolumeCreationOptions::FilesystemType::IsFsFormatterPresent (VolumeCreationOptions::FilesystemType::exFAT))
+ FilesystemTypeChoice->Append (L"exFAT", (void *) VolumeCreationOptions::FilesystemType::exFAT);
+ if (VolumeCreationOptions::FilesystemType::IsFsFormatterPresent (VolumeCreationOptions::FilesystemType::Btrfs))
+ {
+ uint64 minVolumeSizeForBtrfs = VC_MIN_BTRFS_VOLUME_SIZE + (uint64) (VC_MAX (TC_TOTAL_VOLUME_HEADERS_SIZE, TC_HIDDEN_VOLUME_HOST_FS_RESERVED_END_AREA_SIZE_HIGH));
+ // minimum size to be able to format as Btrfs is 114294784 bytes
+ if (volumeSize >= minVolumeSizeForBtrfs)
+ FilesystemTypeChoice->Append (L"Btrfs", (void *) VolumeCreationOptions::FilesystemType::Btrfs);
+ }
#elif defined (TC_MACOSX)
FilesystemTypeChoice->Append (L"Mac OS Extended", (void *) VolumeCreationOptions::FilesystemType::MacOsExt);
FilesystemTypeChoice->Append (L"exFAT", (void *) VolumeCreationOptions::FilesystemType::exFAT);
+ if (wxPlatformInfo::Get().CheckOSVersion (10, 13))
+ FilesystemTypeChoice->Append (L"APFS", (void *) VolumeCreationOptions::FilesystemType::APFS);
#elif defined (TC_FREEBSD) || defined (TC_SOLARIS)
FilesystemTypeChoice->Append (L"UFS", (void *) VolumeCreationOptions::FilesystemType::UFS);
#endif
@@ -80,7 +93,9 @@ namespace VeraCrypt
case VolumeCreationOptions::FilesystemType::Ext2: FilesystemTypeChoice->SetStringSelection (L"Linux Ext2"); break;
case VolumeCreationOptions::FilesystemType::Ext3: FilesystemTypeChoice->SetStringSelection (L"Linux Ext3"); break;
case VolumeCreationOptions::FilesystemType::Ext4: FilesystemTypeChoice->SetStringSelection (L"Linux Ext4"); break;
+ case VolumeCreationOptions::FilesystemType::Btrfs: FilesystemTypeChoice->SetStringSelection (L"Btrfs"); break;
case VolumeCreationOptions::FilesystemType::MacOsExt: FilesystemTypeChoice->SetStringSelection (L"Mac OS Extended"); break;
+ case VolumeCreationOptions::FilesystemType::APFS: FilesystemTypeChoice->SetStringSelection (L"APFS"); break;
case VolumeCreationOptions::FilesystemType::UFS: FilesystemTypeChoice->SetStringSelection (L"UFS"); break;
default:
diff --git a/src/Main/Forms/VolumePasswordPanel.cpp b/src/Main/Forms/VolumePasswordPanel.cpp
index 2859762..ac30075 100644
--- a/src/Main/Forms/VolumePasswordPanel.cpp
+++ b/src/Main/Forms/VolumePasswordPanel.cpp
@@ -21,6 +21,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), EnablePimEntry (true)
{
+ size_t maxPasswordLength = CmdLine->ArgUseLegacyPassword? VolumePassword::MaxLegacySize : VolumePassword::MaxSize;
if (keyfiles)
{
*Keyfiles = *keyfiles;
@@ -32,8 +33,8 @@ namespace VeraCrypt
UseKeyfilesCheckBox->SetValue (Gui->GetPreferences().UseKeyfiles && !Keyfiles->empty());
}
- PasswordTextCtrl->SetMaxLength (VolumePassword::MaxSize);
- ConfirmPasswordTextCtrl->SetMaxLength (VolumePassword::MaxSize);
+ PasswordTextCtrl->SetMaxLength (maxPasswordLength);
+ ConfirmPasswordTextCtrl->SetMaxLength (maxPasswordLength);
if (!passwordLabel.empty())
{
@@ -159,10 +160,8 @@ namespace VeraCrypt
if (enableKeyfiles)
{
SetDropTarget (new FileDropTarget (this));
-#ifdef TC_MACOSX
foreach (wxWindow *c, GetChildren())
c->SetDropTarget (new FileDropTarget (this));
-#endif
}
Layout();
@@ -197,9 +196,10 @@ namespace VeraCrypt
FreezeScope freeze (this);
bool isPim = (*textCtrl == VolumePimTextCtrl);
int colspan = isPim? 1 : 2;
+ size_t maxPasswordLength = CmdLine->ArgUseLegacyPassword? VolumePassword::MaxLegacySize : VolumePassword::MaxSize;
wxTextCtrl *newTextCtrl = new wxTextCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, display ? 0 : wxTE_PASSWORD);
- newTextCtrl->SetMaxLength (isPim? MAX_PIM_DIGITS : VolumePassword::MaxSize);
+ newTextCtrl->SetMaxLength (isPim? MAX_PIM_DIGITS : maxPasswordLength);
newTextCtrl->SetValue ((*textCtrl)->GetValue());
newTextCtrl->SetMinSize ((*textCtrl)->GetSize());
@@ -228,12 +228,12 @@ namespace VeraCrypt
{
shared_ptr <VolumePassword> password;
wchar_t passwordBuf[VolumePassword::MaxSize + 1];
- size_t maxPasswordLength = bLegacyPassword? VolumePassword::MaxLegacySize: VolumePassword::MaxSize;
+ size_t maxPasswordLength = (bLegacyPassword || CmdLine->ArgUseLegacyPassword)? VolumePassword::MaxLegacySize: VolumePassword::MaxSize;
finally_do_arg (BufferPtr, BufferPtr (reinterpret_cast <byte *> (passwordBuf), sizeof (passwordBuf)), { finally_arg.Erase(); });
#ifdef TC_WINDOWS
int len = GetWindowText (static_cast <HWND> (textCtrl->GetHandle()), passwordBuf, VolumePassword::MaxSize + 1);
- password = ToUTF8Password (passwordBuf, len);
+ password = ToUTF8Password (passwordBuf, len, maxPasswordLength);
#else
wxString passwordStr (textCtrl->GetValue()); // A copy of the password is created here by wxWidgets, which cannot be erased
for (size_t i = 0; i < passwordStr.size() && i < maxPasswordLength; ++i)
@@ -241,7 +241,7 @@ namespace VeraCrypt
passwordBuf[i] = (wchar_t) passwordStr[i];
passwordStr[i] = L'X';
}
- password = ToUTF8Password (passwordBuf, passwordStr.size() <= maxPasswordLength ? passwordStr.size() : maxPasswordLength);
+ password = ToUTF8Password (passwordBuf, passwordStr.size() <= maxPasswordLength ? passwordStr.size() : maxPasswordLength, maxPasswordLength);
#endif
return password;
}
diff --git a/src/Main/Forms/VolumeSizeWizardPage.cpp b/src/Main/Forms/VolumeSizeWizardPage.cpp
index f404441..fc045b5 100644
--- a/src/Main/Forms/VolumeSizeWizardPage.cpp
+++ b/src/Main/Forms/VolumeSizeWizardPage.cpp
@@ -21,7 +21,8 @@ namespace VeraCrypt
MaxVolumeSize (0),
MaxVolumeSizeValid (false),
MinVolumeSize (1),
- SectorSize (sectorSize)
+ SectorSize (sectorSize),
+ AvailableDiskSpace (0)
{
VolumeSizePrefixChoice->Append (LangString["KB"], reinterpret_cast <void *> (1024));
VolumeSizePrefixChoice->Append (LangString["MB"], reinterpret_cast <void *> (1024 * 1024));
@@ -34,6 +35,10 @@ namespace VeraCrypt
VolumeSizeTextCtrl->Disable();
VolumeSizeTextCtrl->SetValue (L"");
}
+ else
+ {
+ AvailableDiskSpace = (uint64) diskSpace.GetValue ();
+ }
FreeSpaceStaticText->SetFont (Gui->GetDefaultBoldFont (this));
@@ -97,7 +102,8 @@ namespace VeraCrypt
{
try
{
- if (GetVolumeSize() >= MinVolumeSize && (!MaxVolumeSizeValid || GetVolumeSize() <= MaxVolumeSize))
+ uint64 uiVolumeSize = GetVolumeSize();
+ if (uiVolumeSize >= MinVolumeSize && (!MaxVolumeSizeValid || uiVolumeSize <= MaxVolumeSize) && (MaxVolumeSizeValid || CmdLine->ArgDisableFileSizeCheck || !AvailableDiskSpace || uiVolumeSize <= AvailableDiskSpace))
return true;
}
catch (...) { }
diff --git a/src/Main/Forms/VolumeSizeWizardPage.h b/src/Main/Forms/VolumeSizeWizardPage.h
index e12a5a7..aac41f9 100644
--- a/src/Main/Forms/VolumeSizeWizardPage.h
+++ b/src/Main/Forms/VolumeSizeWizardPage.h
@@ -49,6 +49,7 @@ namespace VeraCrypt
bool MaxVolumeSizeValid;
uint64 MinVolumeSize;
uint32 SectorSize;
+ uint64 AvailableDiskSpace;
};
}
diff --git a/src/Main/Forms/WaitDialog.cpp b/src/Main/Forms/WaitDialog.cpp
index d3372db..2976a6e 100644
--- a/src/Main/Forms/WaitDialog.cpp
+++ b/src/Main/Forms/WaitDialog.cpp
@@ -38,12 +38,14 @@ namespace VeraCrypt
VC_CONVERT_EXCEPTION (PasswordEmpty);
VC_CONVERT_EXCEPTION (PasswordTooLong);
VC_CONVERT_EXCEPTION (PasswordUTF8TooLong);
+ VC_CONVERT_EXCEPTION (PasswordLegacyUTF8TooLong);
VC_CONVERT_EXCEPTION (PasswordUTF8Invalid);
VC_CONVERT_EXCEPTION (UnportablePassword);
VC_CONVERT_EXCEPTION (ElevationFailed);
VC_CONVERT_EXCEPTION (RootDeviceUnavailable);
VC_CONVERT_EXCEPTION (DriveLetterUnavailable);
VC_CONVERT_EXCEPTION (DriverError);
+ VC_CONVERT_EXCEPTION (DeviceSectorSizeMismatch);
VC_CONVERT_EXCEPTION (EncryptedSystemRequired);
VC_CONVERT_EXCEPTION (HigherFuseVersionRequired);
VC_CONVERT_EXCEPTION (KernelCryptoServiceTestFailed);