VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Main
diff options
context:
space:
mode:
Diffstat (limited to 'src/Main')
-rw-r--r--src/Main/Application.cpp2
-rw-r--r--src/Main/CommandLineInterface.cpp23
-rw-r--r--src/Main/CommandLineInterface.h1
-rw-r--r--src/Main/Forms/AboutDialog.cpp16
-rw-r--r--src/Main/Forms/BenchmarkDialog.cpp21
-rw-r--r--src/Main/Forms/ChangePasswordDialog.cpp5
-rw-r--r--src/Main/Forms/EncryptionTestDialog.cpp14
-rw-r--r--src/Main/Forms/Forms.cpp94
-rw-r--r--src/Main/Forms/Forms.h12
-rw-r--r--src/Main/Forms/KeyfileGeneratorDialog.cpp6
-rw-r--r--src/Main/Forms/MainFrame.cpp20
-rw-r--r--src/Main/Forms/MainFrame.h2
-rw-r--r--src/Main/Forms/PreferencesDialog.cpp113
-rw-r--r--src/Main/Forms/PreferencesDialog.h3
-rw-r--r--src/Main/Forms/RandomPoolEnrichmentDialog.cpp6
-rw-r--r--src/Main/Forms/SecurityTokenKeyfilesDialog.cpp5
-rw-r--r--src/Main/Forms/TrueCrypt.fbp566
-rw-r--r--src/Main/Forms/VolumeCreationWizard.cpp35
-rw-r--r--src/Main/Forms/VolumePasswordPanel.cpp7
-rw-r--r--src/Main/Forms/VolumePimWizardPage.cpp5
-rw-r--r--src/Main/Forms/VolumeSizeWizardPage.cpp4
-rw-r--r--src/Main/Forms/WaitDialog.cpp3
-rw-r--r--src/Main/Forms/WaitDialog.h4
-rw-r--r--src/Main/GraphicUserInterface.cpp86
-rw-r--r--src/Main/GraphicUserInterface.h1
-rw-r--r--src/Main/LanguageStrings.cpp9
-rwxr-xr-xsrc/Main/Main.make54
-rw-r--r--src/Main/Resources.cpp104
-rw-r--r--src/Main/StringFormatter.h3
-rw-r--r--src/Main/TextUserInterface.cpp120
-rw-r--r--src/Main/TextUserInterface.h2
-rw-r--r--src/Main/Unix/Main.cpp2
-rw-r--r--src/Main/UserInterface.cpp47
-rw-r--r--src/Main/UserPreferences.cpp36
-rw-r--r--src/Main/UserPreferences.h6
-rw-r--r--src/Main/Xml.cpp2
36 files changed, 1208 insertions, 231 deletions
diff --git a/src/Main/Application.cpp b/src/Main/Application.cpp
index c72e2cc6..27b8f55a 100644
--- a/src/Main/Application.cpp
+++ b/src/Main/Application.cpp
@@ -62,61 +62,61 @@ namespace VeraCrypt
configDir->swap(legacyConfigDir);
}
}
#endif
}
//wcerr << L"Config dir: " << *configDir << endl;
return configDir;
}
}
wxApp* Application::CreateConsoleApp ()
{
mUserInterface = new TextUserInterface;
mUserInterfaceType = UserInterfaceType::Text;
return mUserInterface;
}
#ifndef TC_NO_GUI
wxApp* Application::CreateGuiApp ()
{
mUserInterface = new GraphicUserInterface;
mUserInterfaceType = UserInterfaceType::Graphic;
wxSetEnv("WXSUPPRESS_SIZER_FLAGS_CHECK", "1");
return mUserInterface;
}
#endif
FilePath Application::GetConfigFilePath (const wxString &configFileName, bool createConfigDir)
{
- static wxScopedPtr<const wxString> configDirC;
+ static std::unique_ptr<const wxString> configDirC;
static bool configDirExists = false;
if (!configDirExists)
{
if (!configDirC)
{
wxString *configDir;
if (Core->IsInPortableMode())
{
configDir = new wxString (
wxPathOnly(wxStandardPaths::Get().GetExecutablePath()));
}
else
{
configDir = GetXdgConfigPath();
}
EnsureEndsWithPathSeparator(*configDir);
configDirC.reset(configDir);
}
if (createConfigDir)
{
if (!wxDirExists(*configDirC))
{
//wcerr << L"Creating config dir »" << *configDirC << L"« ..." << endl;
throw_sys_sub_if(
!wxMkdir(*configDirC, wxS_IRUSR | wxS_IWUSR | wxS_IXUSR),
configDirC->ToStdWstring());
diff --git a/src/Main/CommandLineInterface.cpp b/src/Main/CommandLineInterface.cpp
index 2bbc73ea..735cbeef 100644
--- a/src/Main/CommandLineInterface.cpp
+++ b/src/Main/CommandLineInterface.cpp
@@ -2,72 +2,76 @@
Derived from source code of TrueCrypt 7.1a, which is
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0.
Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2017 IDRIX
and are governed by the Apache License 2.0 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 <wx/cmdline.h>
#include <wx/tokenzr.h>
#include "Core/Core.h"
#include "Application.h"
#include "CommandLineInterface.h"
#include "LanguageStrings.h"
#include "UserInterfaceException.h"
namespace VeraCrypt
{
CommandLineInterface::CommandLineInterface (int argc, wchar_t** argv, UserInterfaceType::Enum interfaceType) :
ArgCommand (CommandId::None),
ArgFilesystem (VolumeCreationOptions::FilesystemType::Unknown),
ArgNewPim (-1),
ArgNoHiddenVolumeProtection (false),
ArgPim (-1),
ArgSize (0),
ArgVolumeType (VolumeType::Unknown),
+ ArgAllowScreencapture (false),
ArgDisableFileSizeCheck (false),
ArgUseLegacyPassword (false),
#if defined(TC_LINUX ) || defined (TC_FREEBSD)
ArgUseDummySudoPassword (false),
#endif
StartBackgroundTask (false)
{
wxCmdLineParser parser;
parser.SetCmdLine (argc, argv);
parser.SetSwitchChars (L"-");
+#if defined(TC_WINDOWS) || defined(TC_MACOSX)
+ parser.AddSwitch (L"", L"allow-screencapture", _("Allow window to be included in screenshots and screen captures (Windows/MacOS)"));
+#endif
parser.AddOption (L"", L"auto-mount", _("Auto mount device-hosted/favorite volumes"));
parser.AddSwitch (L"", L"backup-headers", _("Backup volume headers"));
parser.AddSwitch (L"", L"background-task", _("Start Background Task"));
#ifdef TC_WINDOWS
parser.AddSwitch (L"", L"cache", _("Cache passwords and keyfiles"));
#endif
parser.AddSwitch (L"C", L"change", _("Change password or keyfiles"));
parser.AddSwitch (L"c", L"create", _("Create new volume"));
parser.AddSwitch (L"", L"create-keyfile", _("Create new keyfile"));
parser.AddSwitch (L"", L"delete-token-keyfiles", _("Delete security token keyfiles"));
parser.AddSwitch (L"d", L"dismount", _("Dismount volume"));
parser.AddSwitch (L"", L"display-password", _("Display password while typing"));
parser.AddOption (L"", L"encryption", _("Encryption algorithm"));
parser.AddSwitch (L"", L"explore", _("Open explorer window for mounted volume"));
parser.AddSwitch (L"", L"export-token-keyfile",_("Export keyfile from token"));
parser.AddOption (L"", L"filesystem", _("Filesystem type"));
parser.AddSwitch (L"f", L"force", _("Force mount/dismount/overwrite"));
#if !defined(TC_WINDOWS) && !defined(TC_MACOSX)
parser.AddOption (L"", L"fs-options", _("Filesystem mount options"));
#endif
parser.AddOption (L"", L"hash", _("Hash algorithm"));
parser.AddSwitch (L"h", L"help", _("Display detailed command line help"), wxCMD_LINE_OPTION_HELP);
parser.AddSwitch (L"", L"import-token-keyfiles", _("Import keyfiles to security token"));
parser.AddOption (L"k", L"keyfiles", _("Keyfiles"));
parser.AddSwitch (L"l", L"list", _("List mounted volumes"));
parser.AddSwitch (L"", L"list-token-keyfiles", _("List token keyfiles"));
parser.AddSwitch (L"", L"list-securitytoken-keyfiles", _("List security token keyfiles"));
parser.AddSwitch (L"", L"list-emvtoken-keyfiles", _("List EMV token keyfiles"));
parser.AddSwitch (L"", L"load-preferences", _("Load user preferences"));
parser.AddSwitch (L"", L"mount", _("Mount volume interactively"));
@@ -115,60 +119,65 @@ namespace VeraCrypt
if (parser.Parse () > 0)
throw_err (_("Incorrect command line specified."));
if (parser.Found (L"help"))
{
ArgCommand = CommandId::Help;
return;
}
if (parser.Found (L"text") && interfaceType != UserInterfaceType::Text)
{
wstring msg = wstring (_("Option -t or --text must be specified as the first argument."));
wcerr << msg << endl;
throw_err (msg);
}
if (parser.Found (L"version"))
{
ArgCommand = CommandId::DisplayVersion;
return;
}
// Preferences
if (parser.Found (L"load-preferences"))
{
// Load preferences first to allow command line options to override them
Preferences.Load();
ArgMountOptions = Preferences.DefaultMountOptions;
}
+#if defined(TC_WINDOWS) || defined(TC_MACOSX)
+ ArgAllowScreencapture = parser.Found (L"allow-screencapture");
+#else
+ ArgAllowScreencapture = true; // Protection against screenshots is supported only on Windows and MacOS
+#endif
// Commands
if (parser.Found (L"auto-mount", &str))
{
CheckCommandSingle();
wxStringTokenizer tokenizer (str, L",");
while (tokenizer.HasMoreTokens())
{
wxString token = tokenizer.GetNextToken();
if (token == L"devices")
{
if (ArgCommand == CommandId::AutoMountFavorites)
ArgCommand = CommandId::AutoMountDevicesFavorites;
else
ArgCommand = CommandId::AutoMountDevices;
param1IsMountPoint = true;
}
else if (token == L"favorites")
{
if (ArgCommand == CommandId::AutoMountDevices)
ArgCommand = CommandId::AutoMountDevicesFavorites;
else
ArgCommand = CommandId::AutoMountFavorites;
}
else
{
throw_err (LangString["UNKNOWN_OPTION"] + L": " + token);
}
@@ -320,60 +329,70 @@ namespace VeraCrypt
#ifdef TC_LINUX
else if (str.IsSameAs (L"Ext2", false))
ArgFilesystem = VolumeCreationOptions::FilesystemType::Ext2;
else if (str.IsSameAs (L"Ext3", false))
ArgFilesystem = VolumeCreationOptions::FilesystemType::Ext3;
else if (str.IsSameAs (L"Ext4", false))
ArgFilesystem = VolumeCreationOptions::FilesystemType::Ext4;
else if (str.IsSameAs (L"NTFS", false))
ArgFilesystem = VolumeCreationOptions::FilesystemType::NTFS;
else if (str.IsSameAs (L"exFAT", false))
ArgFilesystem = VolumeCreationOptions::FilesystemType::exFAT;
else if (str.IsSameAs (L"Btrfs", false))
ArgFilesystem = VolumeCreationOptions::FilesystemType::Btrfs;
#elif defined (TC_MACOSX)
else if ( str.IsSameAs (L"HFS", false)
|| str.IsSameAs (L"HFS+", false)
|| str.IsSameAs (L"MacOsExt", false)
)
{
ArgFilesystem = VolumeCreationOptions::FilesystemType::MacOsExt;
}
else if (str.IsSameAs (L"exFAT", false))
ArgFilesystem = VolumeCreationOptions::FilesystemType::exFAT;
else if (str.IsSameAs (L"Btrfs", false))
ArgFilesystem = VolumeCreationOptions::FilesystemType::Btrfs;
else if (str.IsSameAs (L"APFS", false))
ArgFilesystem = VolumeCreationOptions::FilesystemType::APFS;
#elif defined (TC_FREEBSD) || defined (TC_SOLARIS)
else if (str.IsSameAs (L"UFS", false))
ArgFilesystem = VolumeCreationOptions::FilesystemType::UFS;
+ else if (str.IsSameAs (L"Ext2", false))
+ ArgFilesystem = VolumeCreationOptions::FilesystemType::Ext2;
+ else if (str.IsSameAs (L"Ext3", false))
+ ArgFilesystem = VolumeCreationOptions::FilesystemType::Ext3;
+ else if (str.IsSameAs (L"Ext4", false))
+ ArgFilesystem = VolumeCreationOptions::FilesystemType::Ext4;
+ else if (str.IsSameAs (L"NTFS", false))
+ ArgFilesystem = VolumeCreationOptions::FilesystemType::NTFS;
+ else if (str.IsSameAs (L"exFAT", false))
+ ArgFilesystem = VolumeCreationOptions::FilesystemType::exFAT;
#endif
else
throw_err (LangString["UNKNOWN_OPTION"] + L": " + str);
}
}
ArgForce = parser.Found (L"force");
ArgDisableFileSizeCheck = parser.Found (L"no-size-check");
ArgUseLegacyPassword = parser.Found (L"legacy-password-maxlength");
#if defined(TC_LINUX ) || defined (TC_FREEBSD)
ArgUseDummySudoPassword = parser.Found (L"use-dummy-sudo-password");
#endif
#if !defined(TC_WINDOWS) && !defined(TC_MACOSX)
if (parser.Found (L"fs-options", &str))
ArgMountOptions.FilesystemOptions = str;
#endif
if (parser.Found (L"hash", &str))
{
ArgHash.reset();
foreach (shared_ptr <Hash> hash, Hash::GetAvailableAlgorithms())
{
wxString hashName (hash->GetName());
wxString hashAltName (hash->GetAltName());
if (hashName.IsSameAs (str, false) || hashAltName.IsSameAs (str, false))
ArgHash = hash;
}
@@ -797,50 +816,50 @@ namespace VeraCrypt
if (!mountedVolumeSpec.IsEmpty() && filteredVolumes.size() < 1)
throw_err (_("No such volume is mounted."));
return filteredVolumes;
}
shared_ptr<VolumePassword> ToUTF8Password (const wchar_t* str, size_t charCount, size_t maxUtf8Len)
{
if (charCount > 0)
{
shared_ptr<SecureBuffer> utf8Buffer = ToUTF8Buffer (str, charCount, maxUtf8Len);
return shared_ptr<VolumePassword>(new VolumePassword (*utf8Buffer));
}
else
return shared_ptr<VolumePassword>(new VolumePassword ());
}
shared_ptr<SecureBuffer> ToUTF8Buffer (const wchar_t* str, size_t charCount, size_t maxUtf8Len)
{
if (charCount == (size_t) -1)
charCount = wcslen (str);
if (charCount > 0)
{
wxMBConvUTF8 utf8;
size_t ulen = utf8.FromWChar (NULL, 0, str, charCount);
if (wxCONV_FAILED == ulen)
throw PasswordUTF8Invalid (SRC_POS);
SecureBuffer passwordBuf(ulen);
- ulen = utf8.FromWChar ((char*) (byte*) passwordBuf, ulen, str, charCount);
+ ulen = utf8.FromWChar ((char*) (uint8*) passwordBuf, ulen, str, charCount);
if (wxCONV_FAILED == ulen)
throw PasswordUTF8Invalid (SRC_POS);
if (ulen > maxUtf8Len)
{
if (maxUtf8Len == VolumePassword::MaxLegacySize)
throw PasswordLegacyUTF8TooLong (SRC_POS);
else
throw PasswordUTF8TooLong (SRC_POS);
}
- ConstBufferPtr utf8Buffer ((byte*) passwordBuf, ulen);
+ ConstBufferPtr utf8Buffer ((uint8*) passwordBuf, ulen);
return shared_ptr<SecureBuffer>(new SecureBuffer (utf8Buffer));
}
else
return shared_ptr<SecureBuffer>(new SecureBuffer ());
}
unique_ptr <CommandLineInterface> CmdLine;
}
diff --git a/src/Main/CommandLineInterface.h b/src/Main/CommandLineInterface.h
index 4003dc05..f773ca6f 100644
--- a/src/Main/CommandLineInterface.h
+++ b/src/Main/CommandLineInterface.h
@@ -57,56 +57,57 @@ namespace VeraCrypt
{
public:
CommandLineInterface (int argc, wchar_t** argv, UserInterfaceType::Enum interfaceType);
virtual ~CommandLineInterface ();
CommandId::Enum ArgCommand;
bool ArgDisplayPassword;
shared_ptr <EncryptionAlgorithm> ArgEncryptionAlgorithm;
shared_ptr <FilePath> ArgFilePath;
VolumeCreationOptions::FilesystemType::Enum ArgFilesystem;
bool ArgForce;
shared_ptr <Hash> ArgHash;
shared_ptr <KeyfileList> ArgKeyfiles;
MountOptions ArgMountOptions;
shared_ptr <DirectoryPath> ArgMountPoint;
shared_ptr <Hash> ArgNewHash;
shared_ptr <KeyfileList> ArgNewKeyfiles;
shared_ptr <VolumePassword> ArgNewPassword;
int ArgNewPim;
bool ArgNoHiddenVolumeProtection;
shared_ptr <VolumePassword> ArgPassword;
int ArgPim;
bool ArgQuick;
FilesystemPath ArgRandomSourcePath;
uint64 ArgSize;
shared_ptr <VolumePath> ArgVolumePath;
VolumeInfoList ArgVolumes;
VolumeType::Enum ArgVolumeType;
shared_ptr<SecureBuffer> ArgTokenPin;
+ bool ArgAllowScreencapture;
bool ArgDisableFileSizeCheck;
bool ArgUseLegacyPassword;
#if defined(TC_LINUX ) || defined (TC_FREEBSD)
bool ArgUseDummySudoPassword;
#endif
bool StartBackgroundTask;
UserPreferences Preferences;
protected:
void CheckCommandSingle () const;
shared_ptr <KeyfileList> ToKeyfileList (const wxString &arg) const;
VolumeInfoList GetMountedVolumes (const wxString &filter) const;
private:
CommandLineInterface (const CommandLineInterface &);
CommandLineInterface &operator= (const CommandLineInterface &);
};
shared_ptr<VolumePassword> ToUTF8Password (const wchar_t* str, size_t charCount, size_t maxUtf8Len);
shared_ptr<SecureBuffer> ToUTF8Buffer (const wchar_t* str, size_t charCount, size_t maxUtf8Len);
extern unique_ptr <CommandLineInterface> CmdLine;
}
#endif // TC_HEADER_Main_CommandInterface
diff --git a/src/Main/Forms/AboutDialog.cpp b/src/Main/Forms/AboutDialog.cpp
index ba341dd2..01c579d5 100644
--- a/src/Main/Forms/AboutDialog.cpp
+++ b/src/Main/Forms/AboutDialog.cpp
@@ -1,79 +1,83 @@
/*
Derived from source code of TrueCrypt 7.1a, which is
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0.
Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2017 IDRIX
and are governed by the Apache License 2.0 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/Version.h"
#include "Main/Application.h"
#include "Main/GraphicUserInterface.h"
#include "Main/Resources.h"
#include "AboutDialog.h"
namespace VeraCrypt
{
AboutDialog::AboutDialog (wxWindow* parent) : AboutDialogBase (parent)
{
LogoBitmap->SetBitmap (Resources::GetTextualLogoBitmap());
wxFont versionStaticTextFont = VersionStaticText->GetFont();
versionStaticTextFont.SetWeight (wxFONTWEIGHT_BOLD);
VersionStaticText->SetFont (versionStaticTextFont);
- VersionStaticText->SetLabel (Application::GetName() + L" " + StringConverter::ToWide (Version::String()));
+ wstring versionStr = StringConverter::ToWide (Version::String());
+#ifdef VC_MACOSX_FUSET
+ versionStr += L" (FUSE-T build)";
+#endif
+ VersionStaticText->SetLabel (Application::GetName() + L" " + versionStr);
CopyrightStaticText->SetLabel (TC_STR_RELEASED_BY);
WebsiteHyperlink->SetLabel (L"www.idrix.fr");
CreditsTextCtrl->SetMinSize (wxSize (
Gui->GetCharWidth (CreditsTextCtrl) * 70,
Gui->GetCharHeight (CreditsTextCtrl) * 6
#ifdef TC_WINDOWS
- 5
#else
- 11
#endif
));
Layout();
Fit();
Center();
CreditsTextCtrl->ChangeValue (
L"Portions of this software are based in part on the works of the following people: "
L"Paul Le Roux, "
L"Bruce Schneier, John Kelsey, Doug Whiting, David Wagner, Chris Hall, Niels Ferguson, "
L"Lars Knudsen, Ross Anderson, Eli Biham, "
L"Joan Daemen, Vincent Rijmen, "
L"Jean-loup Gailly, Mark Adler, "
L"Phillip Rogaway, "
L"Hans Dobbertin, Antoon Bosselaers, Bart Preneel, Jack Lloyd"
L"Paulo Barreto, Brian Gladman, Wei Dai, Peter Gutmann, and many others.\n\n"
L"Portions of this software:\n"
- L"Copyright \xA9 2013-2022 IDRIX. All rights reserved.\n"
+ L"Copyright \xA9 2013-2024 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"
- L"Copyright \xA9 1995-2017 Jean-loup Gailly and Mark Adler.\n"
+ L"Copyright \xA9 1995-2023 Jean-loup Gailly and Mark Adler.\n"
L"Copyright \xA9 2016 Disk Cryptography Services for EFI (DCS), Alex Kolotnikov.\n"
- L"Copyright \xA9 1999-2017 Dieter Baron and Thomas Klausner.\n"
+ L"Copyright \xA9 1999-2023 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-2019 Stephan Mueller <smueller@chronox.de>\n"
- L"Copyright \xA9 1999-2021 Igor Pavlov\n\n"
+ L"Copyright \xA9 1999-2023 Igor Pavlov\n\n"
L"\nThis software as a whole:\n"
- L"Copyright \xA9 2013-2022 IDRIX. All rights reserved.\n\n"
+ L"Copyright \xA9 2013-2024 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"
L"An IDRIX Release");
}
}
diff --git a/src/Main/Forms/BenchmarkDialog.cpp b/src/Main/Forms/BenchmarkDialog.cpp
index 7b0209ff..6e2cff64 100644
--- a/src/Main/Forms/BenchmarkDialog.cpp
+++ b/src/Main/Forms/BenchmarkDialog.cpp
@@ -1,78 +1,81 @@
/*
Derived from source code of TrueCrypt 7.1a, which is
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0.
Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2017 IDRIX
and are governed by the Apache License 2.0 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"
+#ifdef WOLFCRYPT_BACKEND
+#include "Volume/EncryptionModeWolfCryptXTS.h"
+#endif
#include "Main/GraphicUserInterface.h"
#include "BenchmarkDialog.h"
namespace VeraCrypt
{
BenchmarkDialog::BenchmarkDialog (wxWindow *parent)
: BenchmarkDialogBase (parent)
{
BenchmarkNoteStaticText->SetLabel (LangString["IDT_BOX_BENCHMARK_INFO"]);
BenchmarkNoteStaticText->Wrap (RightSizer->GetSize().GetWidth());
list <size_t> bufferSizes;
bufferSizes.push_back (1 * BYTES_PER_MB);
bufferSizes.push_back (5 * BYTES_PER_MB);
bufferSizes.push_back (10 * BYTES_PER_MB);
bufferSizes.push_back (50 * BYTES_PER_MB);
bufferSizes.push_back (100 * BYTES_PER_MB);
bufferSizes.push_back (200 * BYTES_PER_MB);
bufferSizes.push_back (500 * BYTES_PER_MB);
bufferSizes.push_back (1 * BYTES_PER_GB);
foreach (size_t size, bufferSizes)
{
BufferSizeChoice->Append (Gui->SizeToString (size), (void *) size);
}
BenchmarkChoice->Select (0);
BufferSizeChoice->Select (1);
UpdateBenchmarkList ();
-
- wxTextValidator validator (wxFILTER_INCLUDE_CHAR_LIST); // wxFILTER_NUMERIC does not exclude - . , etc.
- const wxChar *valArr[] = { L"0", L"1", L"2", L"3", L"4", L"5", L"6", L"7", L"8", L"9" };
- validator.SetIncludes (wxArrayString (array_capacity (valArr), (const wxChar **) &valArr));
+
+ VolumePimText->SetMinSize (wxSize (Gui->GetCharWidth (VolumePimText) * 15, -1));
+
+ wxTextValidator validator (wxFILTER_DIGITS);
VolumePimText->SetValidator (validator);
Layout();
Fit();
Center();
}
void BenchmarkDialog::UpdateBenchmarkList ()
{
int index = BenchmarkChoice->GetSelection ();
if (index == 1)
{
// PRF case
m_volumePimLabel->Show ();
VolumePimText->Show ();
BufferSizeChoice->Hide ();
m_bufferSizeLabel->Hide ();
}
else
{
m_volumePimLabel->Hide ();
VolumePimText->Hide ();
BufferSizeChoice->Show ();
m_bufferSizeLabel->Show ();
}
BenchmarkListCtrl->DeleteAllItems();
BenchmarkListCtrl->DeleteAllColumns();
@@ -182,63 +185,67 @@ namespace VeraCrypt
fields[ColumnHashMean] = Gui->SpeedToString (result.MeanSpeed);
}
Gui->AppendToListCtrl (BenchmarkListCtrl, fields);
}
BenchmarkListCtrl->SetColumnWidth(0, wxLIST_AUTOSIZE);
wxSize minSize = BenchmarkListCtrl->GetBestSize ();
minSize.IncBy (10, 20);
BenchmarkListCtrl->SetMinSize(minSize);
Layout ();
Fit();
}
void BenchmarkDialog::DoBenchmark (list<BenchmarkResult>& results, Buffer& buffer, int opIndex)
{
try
{
if (opIndex == 0)
{
EncryptionAlgorithmList encryptionAlgorithms = EncryptionAlgorithm::GetAvailableAlgorithms();
foreach (shared_ptr <EncryptionAlgorithm> ea, encryptionAlgorithms)
{
if (!ea->IsDeprecated())
{
BenchmarkResult result;
result.AlgorithmName = ea->GetName(true);
Buffer key (ea->GetKeySize());
ea->SetKey (key);
-
+ #ifdef WOLFCRYPT_BACKEND
+ shared_ptr <EncryptionMode> xts (new EncryptionModeWolfCryptXTS);
+ ea->SetKeyXTS (key);
+ #else
shared_ptr <EncryptionMode> xts (new EncryptionModeXTS);
- xts->SetKey (key);
+ #endif
+ xts->SetKey (key);
ea->SetMode (xts);
wxLongLong startTime = wxGetLocalTimeMillis();
// CPU "warm up" (an attempt to prevent skewed results on systems where CPU frequency gradually changes depending on CPU load).
do
{
ea->EncryptSectors (buffer, 0, buffer.Size() / ENCRYPTION_DATA_UNIT_SIZE, ENCRYPTION_DATA_UNIT_SIZE);
}
while (wxGetLocalTimeMillis().GetValue() - startTime.GetValue() < 20);
uint64 size = 0;
uint64 time;
startTime = wxGetLocalTimeMillis();
do
{
ea->EncryptSectors (buffer, 0, buffer.Size() / ENCRYPTION_DATA_UNIT_SIZE, ENCRYPTION_DATA_UNIT_SIZE);
size += buffer.Size();
time = (uint64) (wxGetLocalTimeMillis().GetValue() - startTime.GetValue());
}
while (time < 100);
result.EncryptionSpeed = size * 1000 / time;
startTime = wxGetLocalTimeMillis();
size = 0;
do
{
@@ -247,61 +254,61 @@ namespace VeraCrypt
time = (uint64) (wxGetLocalTimeMillis().GetValue() - startTime.GetValue());
}
while (time < 100);
result.DecryptionSpeed = size * 1000 / time;
result.MeanSpeed = (result.EncryptionSpeed + result.DecryptionSpeed) / 2;
bool inserted = false;
for (list <BenchmarkResult>::iterator i = results.begin(); i != results.end(); ++i)
{
if (i->MeanSpeed < result.MeanSpeed)
{
results.insert (i, result);
inserted = true;
break;
}
}
if (!inserted)
results.push_back (result);
}
}
}
else if (opIndex == 1)
{
Buffer dk(MASTER_KEYDATA_SIZE);
Buffer salt(64);
const char *tmp_salt = {"\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xAA\xBB\xCC\xDD\xEE\xFF\x01\x23\x45\x67\x89\xAB\xCD\xEF\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xAA\xBB\xCC\xDD\xEE\xFF\x01\x23\x45\x67\x89\xAB\xCD\xEF\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xAA\xBB\xCC\xDD\xEE\xFF"};
unsigned long pim;
Pkcs5KdfList prfList = Pkcs5Kdf::GetAvailableAlgorithms ();
- VolumePassword password ((const byte*) "passphrase-1234567890", 21);
+ VolumePassword password ((const uint8*) "passphrase-1234567890", 21);
memcpy (&pim, buffer.Ptr (), sizeof (unsigned long));
memcpy (salt.Ptr(), tmp_salt, 64);
foreach (shared_ptr <Pkcs5Kdf> prf, prfList)
{
if (!prf->IsDeprecated())
{
BenchmarkResult result;
result.AlgorithmName = prf->GetName ();
result.Iterations = (uint64) prf->GetIterationCount (pim);
uint64 time;
wxLongLong startTime = wxGetLocalTimeMillis();
for (int i = 1; i <= 2; i++)
{
prf->DeriveKey (dk, password, pim, salt);
}
time = (uint64) (wxGetLocalTimeMillis().GetValue() - startTime.GetValue());
result.Time = time / 2;
bool inserted = false;
for (list <BenchmarkResult>::iterator i = results.begin(); i != results.end(); ++i)
{
if (i->Time > result.Time)
{
results.insert (i, result);
diff --git a/src/Main/Forms/ChangePasswordDialog.cpp b/src/Main/Forms/ChangePasswordDialog.cpp
index 397ee693..39da8e60 100644
--- a/src/Main/Forms/ChangePasswordDialog.cpp
+++ b/src/Main/Forms/ChangePasswordDialog.cpp
@@ -144,103 +144,108 @@ namespace VeraCrypt
NewPasswordPanel->SetFocusToPasswordTextCtrl();
return;
}
}
else if (newPim > 0 && newPim < 485)
{
if (!Gui->AskYesNo (LangString ["PIM_SMALL_WARNING"], false, true))
{
NewPasswordPanel->SetFocusToPimTextCtrl();
return;
}
}
}
}
else
{
newPassword = CurrentPasswordPanel->GetPassword();
newPim = CurrentPasswordPanel->GetVolumePim();
}
shared_ptr <KeyfileList> newKeyfiles;
if (DialogMode == Mode::ChangePasswordAndKeyfiles || DialogMode == Mode::ChangeKeyfiles)
newKeyfiles = NewPasswordPanel->GetKeyfiles();
else if (DialogMode != Mode::RemoveAllKeyfiles)
newKeyfiles = CurrentPasswordPanel->GetKeyfiles();
/* force the display of the random enriching interface */
RandomNumberGenerator::SetEnrichedByUserStatus (false);
Gui->UserEnrichRandomPool (this, NewPasswordPanel->GetPkcs5Kdf() ? NewPasswordPanel->GetPkcs5Kdf()->GetHash() : shared_ptr <Hash>());
+ bool masterKeyVulnerable = false;
{
#ifdef TC_UNIX
// Temporarily take ownership of a device if the user is not an administrator
UserId origDeviceOwner ((uid_t) -1);
if (!Core->HasAdminPrivileges() && Path->IsDevice())
{
origDeviceOwner = FilesystemPath (wstring (*Path)).GetOwner();
Core->SetFileOwner (*Path, UserId (getuid()));
}
finally_do_arg2 (FilesystemPath, *Path, UserId, origDeviceOwner,
{
if (finally_arg2.SystemId != (uid_t) -1)
Core->SetFileOwner (finally_arg, finally_arg2);
});
#endif
wxBusyCursor busy;
ChangePasswordThreadRoutine routine(Path, Gui->GetPreferences().DefaultMountOptions.PreserveTimestamps,
CurrentPasswordPanel->GetPassword(), CurrentPasswordPanel->GetVolumePim(), CurrentPasswordPanel->GetPkcs5Kdf(), CurrentPasswordPanel->GetKeyfiles(),
newPassword, newPim, newKeyfiles, NewPasswordPanel->GetPkcs5Kdf(), NewPasswordPanel->GetHeaderWipeCount(), Gui->GetPreferences().EMVSupportEnabled);
Gui->ExecuteWaitThreadRoutine (this, &routine);
+ masterKeyVulnerable = routine.m_masterKeyVulnerable;
}
switch (DialogMode)
{
case Mode::ChangePasswordAndKeyfiles:
Gui->ShowInfo ("PASSWORD_CHANGED");
break;
case Mode::ChangeKeyfiles:
case Mode::RemoveAllKeyfiles:
Gui->ShowInfo ("KEYFILE_CHANGED");
break;
case Mode::ChangePkcs5Prf:
Gui->ShowInfo ("PKCS5_PRF_CHANGED");
break;
default:
throw ParameterIncorrect (SRC_POS);
}
+ if (masterKeyVulnerable)
+ Gui->ShowWarning ("ERR_XTS_MASTERKEY_VULNERABLE");
+
EndModal (wxID_OK);
}
catch (UnportablePassword &e)
{
Gui->ShowError (e);
NewPasswordPanel->SetFocusToPasswordTextCtrl();
}
catch (PasswordException &e)
{
Gui->ShowWarning (e);
CurrentPasswordPanel->SetFocusToPasswordTextCtrl();
}
catch (exception &e)
{
Gui->ShowError (e);
}
}
void ChangePasswordDialog::OnPasswordPanelUpdate ()
{
bool ok = true;
try
{
bool passwordEmpty = CurrentPasswordPanel->GetPassword()->IsEmpty();
bool keyfilesEmpty = !CurrentPasswordPanel->GetKeyfiles() || CurrentPasswordPanel->GetKeyfiles()->empty();
if (passwordEmpty && keyfilesEmpty)
ok = false;
diff --git a/src/Main/Forms/EncryptionTestDialog.cpp b/src/Main/Forms/EncryptionTestDialog.cpp
index 17184a0e..af3f9833 100644
--- a/src/Main/Forms/EncryptionTestDialog.cpp
+++ b/src/Main/Forms/EncryptionTestDialog.cpp
@@ -1,44 +1,47 @@
/*
Derived from source code of TrueCrypt 7.1a, which is
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0.
Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2017 IDRIX
and are governed by the Apache License 2.0 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"
+#ifdef WOLFCRYPT_BACKEND
+#include "Volume/EncryptionModeWolfCryptXTS.h"
+#endif
#include "Volume/EncryptionTest.h"
#include "Main/GraphicUserInterface.h"
#include "EncryptionTestDialog.h"
namespace VeraCrypt
{
EncryptionTestDialog::EncryptionTestDialog (wxWindow* parent)
: EncryptionTestDialogBase (parent)
{
EncryptionAlgorithms = EncryptionAlgorithm::GetAvailableAlgorithms();
foreach (shared_ptr <EncryptionAlgorithm> ea, EncryptionAlgorithms)
{
if (!ea->IsDeprecated())
EncryptionAlgorithmChoice->Append (ea->GetName(true), ea.get());
}
EncryptionAlgorithmChoice->Select (0);
Reset();
Fit();
Layout();
Center();
}
void EncryptionTestDialog::EncryptOrDecrypt (bool encrypt)
{
try
{
bool xts = XtsModeCheckBox->IsChecked();
@@ -67,112 +70,117 @@ namespace VeraCrypt
throw_err (LangString["TEST_INCORRECT_SECONDARY_KEY_SIZE"]);
uint64 dataUnitNumber;
size_t blockNumber;
try
{
dataUnitNumber = StringConverter::ToUInt64 (wstring (DataUnitNumberTextCtrl->GetValue()));
}
catch (...)
{
DataUnitNumberTextCtrl->SetFocus();
throw StringConversionFailed (SRC_POS);
}
try
{
blockNumber = StringConverter::ToUInt32 (wstring (BlockNumberTextCtrl->GetValue()));
if (blockNumber > 31)
{
blockNumber = 31;
BlockNumberTextCtrl->SetValue (L"31");
}
}
catch (...)
{
BlockNumberTextCtrl->SetFocus();
throw StringConversionFailed (SRC_POS);
}
+ #ifdef WOLFCRYPT_BACKEND
+ shared_ptr <EncryptionMode> xts (new EncryptionModeWolfCryptXTS);
+ ea->SetKeyXTS (secondaryKey);
+ #else
shared_ptr <EncryptionMode> xts (new EncryptionModeXTS);
- xts->SetKey (secondaryKey);
+ #endif
+ xts->SetKey (secondaryKey);
ea->SetMode (xts);
Buffer sector (ENCRYPTION_DATA_UNIT_SIZE);
BufferPtr block = sector.GetRange (blockNumber * ea->GetMaxBlockSize(), ea->GetMaxBlockSize());
block.CopyFrom (data);
if (encrypt)
ea->EncryptSectors (sector, dataUnitNumber, 1, sector.Size());
else
ea->DecryptSectors (sector, dataUnitNumber, 1, sector.Size());
data.CopyFrom (block);
}
else
{
if (encrypt)
ea->GetCiphers().front()->EncryptBlock (data);
else
ea->GetCiphers().front()->DecryptBlock (data);
}
SetTextCtrlData (encrypt ? CipherTextTextCtrl : PlainTextTextCtrl, data);
}
catch (exception &e)
{
Gui->ShowError (e);
}
}
shared_ptr <EncryptionAlgorithm> EncryptionTestDialog::GetSelectedEncryptionAlgorithm () const
{
return Gui->GetSelectedData <EncryptionAlgorithm> (EncryptionAlgorithmChoice)->GetNew();
}
void EncryptionTestDialog::GetTextCtrlData (wxTextCtrl *textCtrl, Buffer &buffer) const
{
- vector <byte> data;
+ vector <uint8> data;
string dataStr = StringConverter::ToSingle (wstring (textCtrl->GetValue()));
for (size_t i = 0; i < dataStr.size() / 2; ++i)
{
unsigned int dataByte;
if (sscanf (dataStr.substr (i * 2, 2).c_str(), "%x", &dataByte) != 1)
{
textCtrl->SetFocus();
throw StringConversionFailed (SRC_POS);
}
- data.push_back ((byte) dataByte);
+ data.push_back ((uint8) dataByte);
}
if (data.empty())
return;
buffer.CopyFrom (ConstBufferPtr (&data.front(), data.size()));
}
void EncryptionTestDialog::OnAutoTestAllButtonClick (wxCommandEvent& event)
{
try
{
{
wxBusyCursor busy;
EncryptionTest::TestAll();
}
Gui->ShowInfo ("TESTS_PASSED");
}
catch (Exception &e)
{
Gui->ShowError (e);
Gui->ShowError ("TESTS_FAILED");
}
}
void EncryptionTestDialog::OnEncryptionAlgorithmSelected ()
{
shared_ptr <EncryptionAlgorithm> ea = GetSelectedEncryptionAlgorithm();
diff --git a/src/Main/Forms/Forms.cpp b/src/Main/Forms/Forms.cpp
index d2e7bf68..9ffad555 100644
--- a/src/Main/Forms/Forms.cpp
+++ b/src/Main/Forms/Forms.cpp
@@ -103,60 +103,64 @@ MainFrameBase::MainFrameBase( wxWindow* parent, wxWindowID id, const wxString& t
ToolsMenu->AppendSeparator();
BackupVolumeHeadersMenuItem = new wxMenuItem( ToolsMenu, wxID_ANY, wxString( _("IDM_BACKUP_VOL_HEADER") ) , wxEmptyString, wxITEM_NORMAL );
ToolsMenu->Append( BackupVolumeHeadersMenuItem );
RestoreVolumeHeaderMenuItem = new wxMenuItem( ToolsMenu, wxID_ANY, wxString( _("IDM_RESTORE_VOL_HEADER") ) , wxEmptyString, wxITEM_NORMAL );
ToolsMenu->Append( RestoreVolumeHeaderMenuItem );
ToolsMenu->AppendSeparator();
wxMenuItem* CreateKeyfileMenuItem;
CreateKeyfileMenuItem = new wxMenuItem( ToolsMenu, wxID_ANY, wxString( _("IDM_KEYFILE_GENERATOR") ) , wxEmptyString, wxITEM_NORMAL );
ToolsMenu->Append( CreateKeyfileMenuItem );
wxMenuItem* ManageSecurityTokenKeyfilesMenuItem;
ManageSecurityTokenKeyfilesMenuItem = new wxMenuItem( ToolsMenu, wxID_ANY, wxString( _("IDM_MANAGE_TOKEN_KEYFILES") ) , wxEmptyString, wxITEM_NORMAL );
ToolsMenu->Append( ManageSecurityTokenKeyfilesMenuItem );
wxMenuItem* CloseAllSecurityTokenSessionsMenuItem;
CloseAllSecurityTokenSessionsMenuItem = new wxMenuItem( ToolsMenu, wxID_ANY, wxString( _("IDM_CLOSE_ALL_TOKEN_SESSIONS") ) , wxEmptyString, wxITEM_NORMAL );
ToolsMenu->Append( CloseAllSecurityTokenSessionsMenuItem );
ToolsMenu->AppendSeparator();
WipeCachedPasswordsMenuItem = new wxMenuItem( ToolsMenu, wxID_ANY, wxString( _("IDM_WIPE_CACHE") ) , wxEmptyString, wxITEM_NORMAL );
ToolsMenu->Append( WipeCachedPasswordsMenuItem );
MainMenuBar->Append( ToolsMenu, _("MENU_TOOLS") );
SettingsMenu = new wxMenu();
+ wxMenuItem* LanguageMenuItem;
+ LanguageMenuItem = new wxMenuItem( SettingsMenu, wxID_ANY, wxString( _("IDM_LANGUAGE") ) , wxEmptyString, wxITEM_NORMAL );
+ SettingsMenu->Append( LanguageMenuItem );
+
HotkeysMenuItem = new wxMenuItem( SettingsMenu, wxID_ANY, wxString( _("IDM_HOTKEY_SETTINGS") ) , wxEmptyString, wxITEM_NORMAL );
SettingsMenu->Append( HotkeysMenuItem );
wxMenuItem* DefaultKeyfilesMenuItem;
DefaultKeyfilesMenuItem = new wxMenuItem( SettingsMenu, wxID_ANY, wxString( _("IDM_DEFAULT_KEYFILES") ) , wxEmptyString, wxITEM_NORMAL );
SettingsMenu->Append( DefaultKeyfilesMenuItem );
wxMenuItem* DefaultMountParametersMenuItem;
DefaultMountParametersMenuItem = new wxMenuItem( SettingsMenu, wxID_ANY, wxString( _("IDM_DEFAULT_MOUNT_PARAMETERS") ) , wxEmptyString, wxITEM_NORMAL );
SettingsMenu->Append( DefaultMountParametersMenuItem );
wxMenuItem* SecurityTokenPreferencesMenuItem;
SecurityTokenPreferencesMenuItem = new wxMenuItem( SettingsMenu, wxID_ANY, wxString( _("IDM_TOKEN_PREFERENCES") ) , wxEmptyString, wxITEM_NORMAL );
SettingsMenu->Append( SecurityTokenPreferencesMenuItem );
SettingsMenu->AppendSeparator();
PreferencesMenuItem = new wxMenuItem( SettingsMenu, wxID_PREFERENCES, wxString( _("IDM_PREFERENCES") ) , wxEmptyString, wxITEM_NORMAL );
SettingsMenu->Append( PreferencesMenuItem );
MainMenuBar->Append( SettingsMenu, _("MENU_SETTINGS") );
HelpMenu = new wxMenu();
wxMenuItem* UserGuideMenuItem;
UserGuideMenuItem = new wxMenuItem( HelpMenu, wxID_HELP, wxString( _("IDM_HELP") ) , wxEmptyString, wxITEM_NORMAL );
HelpMenu->Append( UserGuideMenuItem );
wxMenuItem* OnlineHelpMenuItem;
OnlineHelpMenuItem = new wxMenuItem( HelpMenu, wxID_ANY, wxString( _("IDM_ONLINE_HELP") ) , wxEmptyString, wxITEM_NORMAL );
HelpMenu->Append( OnlineHelpMenuItem );
@@ -407,98 +411,113 @@ MainFrameBase::MainFrameBase( wxWindow* parent, wxWindowID id, const wxString& t
bSizer1->Fit( this );
this->Centre( wxBOTH );
// Connect Events
this->Connect( wxEVT_ACTIVATE, wxActivateEventHandler( MainFrameBase::OnActivate ) );
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( MainFrameBase::OnClose ) );
VolumesMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnCreateVolumeButtonClick ), this, CreateNewVolumeMenuItem->GetId());
VolumesMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnMountVolumeMenuItemSelected ), this, MountVolumeMenuItem->GetId());
VolumesMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnMountAllDevicesButtonClick ), this, AutoMountDevicesMenuItem->GetId());
VolumesMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnDismountVolumeMenuItemSelected ), this, DismountVolumeMenuItem->GetId());
VolumesMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnDismountAllButtonClick ), this, DismountAllMenuItem->GetId());
VolumesMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnChangePasswordMenuItemSelected ), this, ChangePasswordMenuItem->GetId());
VolumesMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnChangePkcs5PrfMenuItemSelected ), this, ChangePkcs5PrfMenuItem->GetId());
VolumesMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnChangeKeyfilesMenuItemSelected ), this, ChangeKeyfilesMenuItem->GetId());
VolumesMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnRemoveKeyfilesMenuItemSelected ), this, RemoveKeyfilesMenuItem->GetId());
VolumesMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnVolumePropertiesButtonClick ), this, VolumePropertiesMenuItem->GetId());
FavoritesMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnAddToFavoritesMenuItemSelected ), this, AddToFavoritesMenuItem->GetId());
FavoritesMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnAddAllMountedToFavoritesMenuItemSelected ), this, AddAllMountedToFavoritesMenuItem->GetId());
FavoritesMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnOrganizeFavoritesMenuItemSelected ), this, OrganizeFavoritesMenuItem->GetId());
FavoritesMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnMountAllFavoritesMenuItemSelected ), this, MountAllFavoritesMenuItem->GetId());
ToolsMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnBenchmarkMenuItemSelected ), this, BenchmarkMenuItem->GetId());
ToolsMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnEncryptionTestMenuItemSelected ), this, EncryptionTestMenuItem->GetId());
ToolsMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnCreateVolumeButtonClick ), this, VolumeCreationWizardMenuItem->GetId());
ToolsMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnBackupVolumeHeadersMenuItemSelected ), this, BackupVolumeHeadersMenuItem->GetId());
ToolsMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnRestoreVolumeHeaderMenuItemSelected ), this, RestoreVolumeHeaderMenuItem->GetId());
ToolsMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnCreateKeyfileMenuItemSelected ), this, CreateKeyfileMenuItem->GetId());
ToolsMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnManageSecurityTokenKeyfilesMenuItemSelected ), this, ManageSecurityTokenKeyfilesMenuItem->GetId());
ToolsMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnCloseAllSecurityTokenSessionsMenuItemSelected ), this, CloseAllSecurityTokenSessionsMenuItem->GetId());
ToolsMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnWipeCacheButtonClick ), this, WipeCachedPasswordsMenuItem->GetId());
+ SettingsMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnLanguageMenuItemSelected ), this, LanguageMenuItem->GetId());
SettingsMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnHotkeysMenuItemSelected ), this, HotkeysMenuItem->GetId());
SettingsMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnDefaultKeyfilesMenuItemSelected ), this, DefaultKeyfilesMenuItem->GetId());
SettingsMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnDefaultMountParametersMenuItemSelected ), this, DefaultMountParametersMenuItem->GetId());
SettingsMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnSecurityTokenPreferencesMenuItemSelected ), this, SecurityTokenPreferencesMenuItem->GetId());
+#ifdef TC_MACOSX
+ this->Connect( PreferencesMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnPreferencesMenuItemSelected ) );
+ this->Connect( UserGuideMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnUserGuideMenuItemSelected ) );
+#else
SettingsMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnPreferencesMenuItemSelected ), this, PreferencesMenuItem->GetId());
HelpMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnUserGuideMenuItemSelected ), this, UserGuideMenuItem->GetId());
+#endif
HelpMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnOnlineHelpMenuItemSelected ), this, OnlineHelpMenuItem->GetId());
HelpMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnBeginnersTutorialMenuItemSelected ), this, BeginnersTutorialMenuItem->GetId());
HelpMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnFaqMenuItemSelected ), this, FaqMenuItem->GetId());
HelpMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnWebsiteMenuItemSelected ), this, WebsiteMenuItem->GetId());
HelpMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnDownloadsMenuItemSelected ), this, DownloadsMenuItem->GetId());
HelpMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnNewsMenuItemSelected ), this, NewsMenuItem->GetId());
HelpMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnVersionHistoryMenuItemSelected ), this, VersionHistoryMenuItem->GetId());
HelpMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnDonateMenuItemSelected ), this, DonateMenuItem->GetId());
HelpMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnContactMenuItemSelected ), this, ContactMenuItem->GetId());
HelpMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnLegalNoticesMenuItemSelected ), this, LegalNoticesMenuItem->GetId());
+#ifdef TC_MACOSX
+ this->Connect( AboutMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnAboutMenuItemSelected ) );
+#else
HelpMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnAboutMenuItemSelected ), this, AboutMenuItem->GetId());
+#endif
SlotListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEventHandler( MainFrameBase::OnListItemActivated ), NULL, this );
SlotListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( MainFrameBase::OnListItemDeselected ), NULL, this );
SlotListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK, wxListEventHandler( MainFrameBase::OnListItemRightClick ), NULL, this );
SlotListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( MainFrameBase::OnListItemSelected ), NULL, this );
CreateVolumeButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::OnCreateVolumeButtonClick ), NULL, this );
VolumePropertiesButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::OnVolumePropertiesButtonClick ), NULL, this );
WipeCacheButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::OnWipeCacheButtonClick ), NULL, this );
LogoBitmap->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( MainFrameBase::OnLogoBitmapClick ), NULL, this );
SelectFileButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::OnSelectFileButtonClick ), NULL, this );
NoHistoryCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( MainFrameBase::OnNoHistoryCheckBoxClick ), NULL, this );
VolumeToolsButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::OnVolumeToolsButtonClick ), NULL, this );
SelectDeviceButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::OnSelectDeviceButtonClick ), NULL, this );
VolumeButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::OnVolumeButtonClick ), NULL, this );
MountAllDevicesButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::OnMountAllDevicesButtonClick ), NULL, this );
DismountAllButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::OnDismountAllButtonClick ), NULL, this );
ExitButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::OnExitButtonClick ), NULL, this );
}
MainFrameBase::~MainFrameBase()
{
// Disconnect Events
+#ifdef TC_MACOSX
+ this->Disconnect( wxID_PREFERENCES, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnPreferencesMenuItemSelected ) );
+ this->Disconnect( wxID_HELP, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnUserGuideMenuItemSelected ) );
+ this->Disconnect( wxID_ABOUT, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnAboutMenuItemSelected ) );
+#endif
this->Disconnect( wxEVT_ACTIVATE, wxActivateEventHandler( MainFrameBase::OnActivate ) );
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( MainFrameBase::OnClose ) );
SlotListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEventHandler( MainFrameBase::OnListItemActivated ), NULL, this );
SlotListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( MainFrameBase::OnListItemDeselected ), NULL, this );
SlotListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK, wxListEventHandler( MainFrameBase::OnListItemRightClick ), NULL, this );
SlotListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( MainFrameBase::OnListItemSelected ), NULL, this );
CreateVolumeButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::OnCreateVolumeButtonClick ), NULL, this );
VolumePropertiesButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::OnVolumePropertiesButtonClick ), NULL, this );
WipeCacheButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::OnWipeCacheButtonClick ), NULL, this );
LogoBitmap->Disconnect( wxEVT_LEFT_DOWN, wxMouseEventHandler( MainFrameBase::OnLogoBitmapClick ), NULL, this );
SelectFileButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::OnSelectFileButtonClick ), NULL, this );
NoHistoryCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( MainFrameBase::OnNoHistoryCheckBoxClick ), NULL, this );
VolumeToolsButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::OnVolumeToolsButtonClick ), NULL, this );
SelectDeviceButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::OnSelectDeviceButtonClick ), NULL, this );
VolumeButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::OnVolumeButtonClick ), NULL, this );
MountAllDevicesButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::OnMountAllDevicesButtonClick ), NULL, this );
DismountAllButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::OnDismountAllButtonClick ), NULL, this );
ExitButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::OnExitButtonClick ), NULL, this );
}
WizardFrameBase::WizardFrameBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxFrame( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxSize( 800,500 ), wxDefaultSize );
MainSizer = new wxBoxSizer( wxVERTICAL );
MainPanel = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizer63;
bSizer63 = new wxBoxSizer( wxVERTICAL );
@@ -2209,121 +2228,186 @@ PreferencesDialogBase::PreferencesDialogBase( wxWindow* parent, wxWindowID id, c
sbSizer23->Add( fgSizer4, 1, wxALIGN_RIGHT, 5 );
sbSizer21->Add( sbSizer23, 0, wxEXPAND|wxALL, 5 );
wxStaticBoxSizer* sbSizer24;
sbSizer24 = new wxStaticBoxSizer( new wxStaticBox( sbSizer21->GetStaticBox(), wxID_ANY, _("IDT_FORMAT_OPTIONS") ), wxVERTICAL );
BeepAfterHotkeyMountDismountCheckBox = new wxCheckBox( sbSizer24->GetStaticBox(), wxID_ANY, _("LINUX_SOUND_NOTIFICATION"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizer24->Add( BeepAfterHotkeyMountDismountCheckBox, 0, wxALL, 5 );
DisplayMessageAfterHotkeyDismountCheckBox = new wxCheckBox( sbSizer24->GetStaticBox(), wxID_ANY, _("LINUX_CONFIRM_AFTER_DISMOUNT"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizer24->Add( DisplayMessageAfterHotkeyDismountCheckBox, 0, wxALL, 5 );
sbSizer21->Add( sbSizer24, 0, wxEXPAND|wxALL, 5 );
bSizer38->Add( sbSizer21, 1, wxEXPAND|wxALL, 5 );
bSizer51->Add( bSizer38, 1, wxEXPAND|wxALL, 5 );
HotkeysPage->SetSizer( bSizer51 );
HotkeysPage->Layout();
bSizer51->Fit( HotkeysPage );
PreferencesNotebook->AddPage( HotkeysPage, _("LINUX_HOTKEYS"), false );
+ LanguagesPage = new wxPanel( PreferencesNotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
+ wxBoxSizer* bSizer170;
+ bSizer170 = new wxBoxSizer( wxVERTICAL );
+
+ wxBoxSizer* bSizer171;
+ bSizer171 = new wxBoxSizer( wxVERTICAL );
+
+ wxBoxSizer* bSizer173;
+ bSizer173 = new wxBoxSizer( wxVERTICAL );
+
+ wxStaticBoxSizer* sbSizer49;
+ sbSizer49 = new wxStaticBoxSizer( new wxStaticBox( LanguagesPage, wxID_ANY, _("LINUX_LANGUAGE") ), wxVERTICAL );
+
+ wxBoxSizer* bSizer174;
+ bSizer174 = new wxBoxSizer( wxHORIZONTAL );
+
+ m_staticText73 = new wxStaticText( sbSizer49->GetStaticBox(), wxID_ANY, _("IDT_ACTIVE_LANG_PACK"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_staticText73->Wrap( -1 );
+ bSizer174->Add( m_staticText73, 0, wxLEFT|wxTOP, 5 );
+
+ m_staticText74 = new wxStaticText( sbSizer49->GetStaticBox(), wxID_ANY, _("CURRENT_LANGUAGE_PACK"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_staticText74->Wrap( -1 );
+ bSizer174->Add( m_staticText74, 0, wxLEFT|wxRIGHT|wxTOP, 5 );
+
+
+ sbSizer49->Add( bSizer174, 0, wxBOTTOM, 5 );
+
+ wxWrapSizer* wSizer1;
+ wSizer1 = new wxWrapSizer( wxHORIZONTAL, wxWRAPSIZER_DEFAULT_FLAGS );
+
+ m_staticText72 = new wxStaticText( sbSizer49->GetStaticBox(), wxID_ANY, _("IDT_LANGPACK_AUTHORS"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_staticText72->Wrap( -1 );
+ wSizer1->Add( m_staticText72, 0, wxBOTTOM|wxLEFT, 5 );
+
+ m_staticText71 = new wxStaticText( sbSizer49->GetStaticBox(), wxID_ANY, _("LANGUAGE_TRANSLATORS"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_staticText71->Wrap( -1 );
+ wSizer1->Add( m_staticText71, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 5 );
+
+
+ sbSizer49->Add( wSizer1, 0, 0, 5 );
+
+ LanguageListBox = new wxListBox( sbSizer49->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_SINGLE|wxLB_SORT );
+ sbSizer49->Add( LanguageListBox, 1, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 );
+
+ SysDefaultLangButton = new wxButton( sbSizer49->GetStaticBox(), wxID_ANY, _("LINUX_SELECT_SYS_DEFAULT_LANG"), wxDefaultPosition, wxDefaultSize, 0 );
+ sbSizer49->Add( SysDefaultLangButton, 0, wxALIGN_BOTTOM|wxALL|wxEXPAND, 5 );
+
+
+ bSizer173->Add( sbSizer49, 1, wxALL|wxEXPAND, 5 );
+
+
+ bSizer171->Add( bSizer173, 1, wxEXPAND, 5 );
+
+
+ bSizer170->Add( bSizer171, 1, wxALL|wxEXPAND, 5 );
+
+
+ LanguagesPage->SetSizer( bSizer170 );
+ LanguagesPage->Layout();
+ bSizer170->Fit( LanguagesPage );
+ PreferencesNotebook->AddPage( LanguagesPage, _("LINUX_LANGUAGE"), false );
bSizer178->Add( PreferencesNotebook, 1, wxEXPAND | wxALL, 5 );
wxBoxSizer* bSizer182;
bSizer182 = new wxBoxSizer( wxHORIZONTAL );
bSizer182->Add( 0, 0, 1, wxEXPAND, 5 );
OKButton = new wxButton( this, wxID_OK, _("IDOK"), wxDefaultPosition, wxDefaultSize, 0 );
OKButton->SetDefault();
bSizer182->Add( OKButton, 0, wxALL, 5 );
CancelButton = new wxButton( this, wxID_CANCEL, _("IDCANCEL"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer182->Add( CancelButton, 0, wxALL, 5 );
bSizer178->Add( bSizer182, 0, wxALL|wxEXPAND, 5 );
bSizer32->Add( bSizer178, 1, wxEXPAND, 5 );
this->SetSizer( bSizer32 );
this->Layout();
bSizer32->Fit( this );
// Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( PreferencesDialogBase::OnClose ) );
+ PreferencesNotebook->Connect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler( PreferencesDialogBase::OnPageChanged ), NULL, this );
DismountOnScreenSaverCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PreferencesDialogBase::OnDismountOnScreenSaverCheckBoxClick ), NULL, this );
DismountOnPowerSavingCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PreferencesDialogBase::OnDismountOnPowerSavingCheckBoxClick ), NULL, this );
ForceAutoDismountCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PreferencesDialogBase::OnForceAutoDismountCheckBoxClick ), NULL, this );
PreserveTimestampsCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PreferencesDialogBase::OnPreserveTimestampsCheckBoxClick ), NULL, this );
BackgroundTaskEnabledCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PreferencesDialogBase::OnBackgroundTaskEnabledCheckBoxClick ), NULL, this );
NoKernelCryptoCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PreferencesDialogBase::OnNoKernelCryptoCheckBoxClick ), NULL, this );
NoHardwareCryptoCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PreferencesDialogBase::OnNoHardwareCryptoCheckBoxClick ), NULL, this );
SelectPkcs11ModuleButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PreferencesDialogBase::OnSelectPkcs11ModuleButtonClick ), NULL, this );
HotkeyListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( PreferencesDialogBase::OnHotkeyListItemDeselected ), NULL, this );
HotkeyListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( PreferencesDialogBase::OnHotkeyListItemSelected ), NULL, this );
AssignHotkeyButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PreferencesDialogBase::OnAssignHotkeyButtonClick ), NULL, this );
RemoveHotkeyButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PreferencesDialogBase::OnRemoveHotkeyButtonClick ), NULL, this );
+ SysDefaultLangButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PreferencesDialogBase::OnSysDefaultLangButtonClick ), NULL, this );
OKButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PreferencesDialogBase::OnOKButtonClick ), NULL, this );
}
PreferencesDialogBase::~PreferencesDialogBase()
{
// Disconnect Events
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( PreferencesDialogBase::OnClose ) );
+ PreferencesNotebook->Disconnect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler( PreferencesDialogBase::OnPageChanged ), NULL, this );
DismountOnScreenSaverCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PreferencesDialogBase::OnDismountOnScreenSaverCheckBoxClick ), NULL, this );
DismountOnPowerSavingCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PreferencesDialogBase::OnDismountOnPowerSavingCheckBoxClick ), NULL, this );
ForceAutoDismountCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PreferencesDialogBase::OnForceAutoDismountCheckBoxClick ), NULL, this );
PreserveTimestampsCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PreferencesDialogBase::OnPreserveTimestampsCheckBoxClick ), NULL, this );
BackgroundTaskEnabledCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PreferencesDialogBase::OnBackgroundTaskEnabledCheckBoxClick ), NULL, this );
NoKernelCryptoCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PreferencesDialogBase::OnNoKernelCryptoCheckBoxClick ), NULL, this );
NoHardwareCryptoCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PreferencesDialogBase::OnNoHardwareCryptoCheckBoxClick ), NULL, this );
SelectPkcs11ModuleButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PreferencesDialogBase::OnSelectPkcs11ModuleButtonClick ), NULL, this );
HotkeyListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( PreferencesDialogBase::OnHotkeyListItemDeselected ), NULL, this );
HotkeyListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( PreferencesDialogBase::OnHotkeyListItemSelected ), NULL, this );
AssignHotkeyButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PreferencesDialogBase::OnAssignHotkeyButtonClick ), NULL, this );
RemoveHotkeyButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PreferencesDialogBase::OnRemoveHotkeyButtonClick ), NULL, this );
+ SysDefaultLangButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PreferencesDialogBase::OnSysDefaultLangButtonClick ), NULL, this );
OKButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PreferencesDialogBase::OnOKButtonClick ), NULL, this );
}
RandomPoolEnrichmentDialogBase::RandomPoolEnrichmentDialogBase( 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 );
MainSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bSizer144;
bSizer144 = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bSizer145;
bSizer145 = new wxBoxSizer( wxHORIZONTAL );
bSizer145->Add( 0, 0, 1, wxEXPAND, 5 );
wxStaticText* m_staticText49;
m_staticText49 = new wxStaticText( this, wxID_ANY, _("IDT_PRF"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText49->Wrap( -1 );
bSizer145->Add( m_staticText49, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
wxArrayString HashChoiceChoices;
HashChoice = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, HashChoiceChoices, 0 );
HashChoice->SetSelection( 0 );
bSizer145->Add( HashChoice, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
@@ -2674,73 +2758,73 @@ InfoWizardPageBase::InfoWizardPageBase( wxWindow* parent, wxWindowID id, const w
this->SetSizer( bSizer71 );
this->Layout();
bSizer71->Fit( this );
}
InfoWizardPageBase::~InfoWizardPageBase()
{
}
KeyfilesPanelBase::KeyfilesPanelBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxPanel( parent, id, pos, size, style, name )
{
this->SetMinSize( wxSize( 500,300 ) );
wxBoxSizer* bSizer19;
bSizer19 = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bSizer20;
bSizer20 = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bSizer21;
bSizer21 = new wxBoxSizer( wxVERTICAL );
KeyfilesListCtrl = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_NO_SORT_HEADER|wxLC_REPORT|wxBORDER_SUNKEN );
bSizer21->Add( KeyfilesListCtrl, 1, wxEXPAND|wxALL, 5 );
wxBoxSizer* bSizer137;
bSizer137 = new wxBoxSizer( wxHORIZONTAL );
AddFilesButton = new wxButton( this, wxID_ANY, _("IDC_KEYADD"), wxDefaultPosition, wxDefaultSize, 0 );
- bSizer137->Add( AddFilesButton, 0, wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 5 );
+ bSizer137->Add( AddFilesButton, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxTOP, 5 );
AddDirectoryButton = new wxButton( this, wxID_ANY, _("IDC_ADD_KEYFILE_PATH"), wxDefaultPosition, wxDefaultSize, 0 );
- bSizer137->Add( AddDirectoryButton, 0, wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 5 );
+ bSizer137->Add( AddDirectoryButton, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxTOP, 5 );
AddSecurityTokenSignatureButton = new wxButton( this, wxID_ANY, _("IDC_TOKEN_FILES_ADD"), wxDefaultPosition, wxDefaultSize, 0 );
- bSizer137->Add( AddSecurityTokenSignatureButton, 0, wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 5 );
+ bSizer137->Add( AddSecurityTokenSignatureButton, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxTOP, 5 );
RemoveButton = new wxButton( this, wxID_ANY, _("IDC_KEYREMOVE"), wxDefaultPosition, wxDefaultSize, 0 );
- bSizer137->Add( RemoveButton, 0, wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 5 );
+ bSizer137->Add( RemoveButton, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxTOP, 5 );
RemoveAllButton = new wxButton( this, wxID_ANY, _("IDC_KEYREMOVEALL"), wxDefaultPosition, wxDefaultSize, 0 );
- bSizer137->Add( RemoveAllButton, 0, wxEXPAND|wxALL, 5 );
+ bSizer137->Add( RemoveAllButton, 0, wxALL|wxEXPAND, 5 );
bSizer21->Add( bSizer137, 0, wxEXPAND, 5 );
bSizer20->Add( bSizer21, 1, wxEXPAND, 5 );
bSizer19->Add( bSizer20, 1, wxEXPAND, 5 );
this->SetSizer( bSizer19 );
this->Layout();
bSizer19->Fit( this );
// Connect Events
KeyfilesListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( KeyfilesPanelBase::OnListItemDeselected ), NULL, this );
KeyfilesListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( KeyfilesPanelBase::OnListItemSelected ), NULL, this );
KeyfilesListCtrl->Connect( wxEVT_SIZE, wxSizeEventHandler( KeyfilesPanelBase::OnListSizeChanged ), NULL, this );
AddFilesButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( KeyfilesPanelBase::OnAddFilesButtonClick ), NULL, this );
AddDirectoryButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( KeyfilesPanelBase::OnAddDirectoryButtonClick ), NULL, this );
AddSecurityTokenSignatureButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( KeyfilesPanelBase::OnAddSecurityTokenSignatureButtonClick ), NULL, this );
RemoveButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( KeyfilesPanelBase::OnRemoveButtonClick ), NULL, this );
RemoveAllButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( KeyfilesPanelBase::OnRemoveAllButtonClick ), NULL, this );
}
KeyfilesPanelBase::~KeyfilesPanelBase()
{
// Disconnect Events
KeyfilesListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( KeyfilesPanelBase::OnListItemDeselected ), NULL, this );
diff --git a/src/Main/Forms/Forms.h b/src/Main/Forms/Forms.h
index 96a03c79..70a8c230 100644
--- a/src/Main/Forms/Forms.h
+++ b/src/Main/Forms/Forms.h
@@ -11,60 +11,62 @@
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include "WizardPage.h"
#include <wx/string.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/menu.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/listctrl.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/button.h>
#include <wx/statbmp.h>
#include <wx/combobox.h>
#include <wx/checkbox.h>
#include <wx/gbsizer.h>
#include <wx/panel.h>
#include <wx/frame.h>
#include <wx/stattext.h>
#include <wx/hyperlink.h>
#include <wx/statline.h>
#include <wx/textctrl.h>
#include <wx/dialog.h>
#include <wx/choice.h>
#include <wx/gauge.h>
#include <wx/spinctrl.h>
+#include <wx/wrapsizer.h>
+#include <wx/listbox.h>
#include <wx/notebook.h>
#include "international.h"
///////////////////////////////////////////////////////////////////////////
namespace VeraCrypt
{
///////////////////////////////////////////////////////////////////////////////
/// Class MainFrameBase
///////////////////////////////////////////////////////////////////////////////
class MainFrameBase : public wxFrame
{
private:
protected:
wxMenuBar* MainMenuBar;
wxMenu* VolumesMenu;
wxMenuItem* MountVolumeMenuItem;
wxMenuItem* DismountVolumeMenuItem;
wxMenuItem* DismountAllMenuItem;
wxMenuItem* VolumePropertiesMenuItem;
wxMenu* FavoritesMenu;
wxMenuItem* AddToFavoritesMenuItem;
wxMenuItem* AddAllMountedToFavoritesMenuItem;
wxMenu* ToolsMenu;
wxMenuItem* BackupVolumeHeadersMenuItem;
wxMenuItem* RestoreVolumeHeaderMenuItem;
wxMenuItem* WipeCachedPasswordsMenuItem;
wxMenu* SettingsMenu;
@@ -89,60 +91,61 @@ namespace VeraCrypt
wxButton* VolumeButton;
wxButton* MountAllDevicesButton;
wxButton* DismountAllButton;
wxButton* ExitButton;
// Virtual event handlers, override them in your derived class
virtual void OnActivate( wxActivateEvent& event ) { event.Skip(); }
virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
virtual void OnCreateVolumeButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnMountVolumeMenuItemSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnMountAllDevicesButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnDismountVolumeMenuItemSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnDismountAllButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnChangePasswordMenuItemSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnChangePkcs5PrfMenuItemSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnChangeKeyfilesMenuItemSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnRemoveKeyfilesMenuItemSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnVolumePropertiesButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnAddToFavoritesMenuItemSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnAddAllMountedToFavoritesMenuItemSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOrganizeFavoritesMenuItemSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnMountAllFavoritesMenuItemSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnBenchmarkMenuItemSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnEncryptionTestMenuItemSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnBackupVolumeHeadersMenuItemSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnRestoreVolumeHeaderMenuItemSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCreateKeyfileMenuItemSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnManageSecurityTokenKeyfilesMenuItemSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCloseAllSecurityTokenSessionsMenuItemSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnWipeCacheButtonClick( wxCommandEvent& event ) { event.Skip(); }
+ virtual void OnLanguageMenuItemSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnHotkeysMenuItemSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnDefaultKeyfilesMenuItemSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnDefaultMountParametersMenuItemSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnSecurityTokenPreferencesMenuItemSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnPreferencesMenuItemSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnUserGuideMenuItemSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOnlineHelpMenuItemSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnBeginnersTutorialMenuItemSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnFaqMenuItemSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnWebsiteMenuItemSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnDownloadsMenuItemSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnNewsMenuItemSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnVersionHistoryMenuItemSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnDonateMenuItemSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnContactMenuItemSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnLegalNoticesMenuItemSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnAboutMenuItemSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnListItemActivated( wxListEvent& event ) { event.Skip(); }
virtual void OnListItemDeselected( wxListEvent& event ) { event.Skip(); }
virtual void OnListItemRightClick( wxListEvent& event ) { event.Skip(); }
virtual void OnListItemSelected( wxListEvent& event ) { event.Skip(); }
virtual void OnLogoBitmapClick( wxMouseEvent& event ) { event.Skip(); }
virtual void OnSelectFileButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnNoHistoryCheckBoxClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnVolumeToolsButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnSelectDeviceButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnVolumeButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnExitButtonClick( wxCommandEvent& event ) { event.Skip(); }
@@ -586,85 +589,94 @@ namespace VeraCrypt
wxCheckBox* BackgroundTaskMenuDismountItemsEnabledCheckBox;
wxPanel* SystemIntegrationPage;
wxStaticBoxSizer* LogOnSizer;
wxCheckBox* StartOnLogonCheckBox;
wxCheckBox* MountFavoritesOnLogonCheckBox;
wxCheckBox* MountDevicesOnLogonCheckBox;
wxStaticBoxSizer* ExplorerSizer;
wxCheckBox* OpenExplorerWindowAfterMountCheckBox;
wxCheckBox* CloseExplorerWindowsOnDismountCheckBox;
wxStaticBoxSizer* KernelServicesSizer;
wxCheckBox* NoKernelCryptoCheckBox;
wxPanel* PerformanceOptionsPage;
wxStaticText* AesHwCpuSupportedStaticText;
wxCheckBox* NoHardwareCryptoCheckBox;
wxBoxSizer* DefaultKeyfilesSizer;
wxCheckBox* UseKeyfilesCheckBox;
wxTextCtrl* Pkcs11ModulePathTextCtrl;
wxButton* SelectPkcs11ModuleButton;
wxCheckBox* CloseSecurityTokenSessionsAfterMountCheckBox;
wxCheckBox* EMVSupportEnabledCheckBox;
wxListCtrl* HotkeyListCtrl;
wxTextCtrl* HotkeyTextCtrl;
wxButton* AssignHotkeyButton;
wxCheckBox* HotkeyControlCheckBox;
wxCheckBox* HotkeyShiftCheckBox;
wxCheckBox* HotkeyAltCheckBox;
wxCheckBox* HotkeyWinCheckBox;
wxButton* RemoveHotkeyButton;
wxCheckBox* BeepAfterHotkeyMountDismountCheckBox;
wxCheckBox* DisplayMessageAfterHotkeyDismountCheckBox;
+ wxStaticText* m_staticText73;
+ wxStaticText* m_staticText74;
+ wxStaticText* m_staticText72;
+ wxStaticText* m_staticText71;
+ wxButton* SysDefaultLangButton;
wxButton* OKButton;
wxButton* CancelButton;
// Virtual event handlers, override them in your derived class
virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
+ virtual void OnPageChanged( wxNotebookEvent& event ) { event.Skip(); }
virtual void OnDismountOnScreenSaverCheckBoxClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnDismountOnPowerSavingCheckBoxClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnForceAutoDismountCheckBoxClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnPreserveTimestampsCheckBoxClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnBackgroundTaskEnabledCheckBoxClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnNoKernelCryptoCheckBoxClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnNoHardwareCryptoCheckBoxClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnSelectPkcs11ModuleButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnHotkeyListItemDeselected( wxListEvent& event ) { event.Skip(); }
virtual void OnHotkeyListItemSelected( wxListEvent& event ) { event.Skip(); }
virtual void OnAssignHotkeyButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnRemoveHotkeyButtonClick( wxCommandEvent& event ) { event.Skip(); }
+ virtual void OnSysDefaultLangButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOKButtonClick( wxCommandEvent& event ) { event.Skip(); }
public:
wxPanel* DefaultMountOptionsPage;
wxPanel* DefaultKeyfilesPage;
wxPanel* SecurityTokensPage;
wxPanel* HotkeysPage;
+ wxPanel* LanguagesPage;
+ wxListBox* LanguageListBox;
PreferencesDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("IDD_PREFERENCES_DLG"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE );
~PreferencesDialogBase();
};
///////////////////////////////////////////////////////////////////////////////
/// Class RandomPoolEnrichmentDialogBase
///////////////////////////////////////////////////////////////////////////////
class RandomPoolEnrichmentDialogBase : public wxDialog
{
private:
protected:
wxBoxSizer* MainSizer;
wxChoice* HashChoice;
wxStaticText* RandomPoolStaticText;
wxCheckBox* ShowRandomPoolCheckBox;
wxGauge* CollectedEntropy;
wxStaticText* MouseStaticText;
wxButton* ContinueButton;
// Virtual event handlers, override them in your derived class
virtual void OnMouseMotion( wxMouseEvent& event ) { event.Skip(); }
virtual void OnHashSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnShowRandomPoolCheckBoxClicked( wxCommandEvent& event ) { event.Skip(); }
public:
diff --git a/src/Main/Forms/KeyfileGeneratorDialog.cpp b/src/Main/Forms/KeyfileGeneratorDialog.cpp
index 2d729ccf..85443f45 100644
--- a/src/Main/Forms/KeyfileGeneratorDialog.cpp
+++ b/src/Main/Forms/KeyfileGeneratorDialog.cpp
@@ -137,66 +137,66 @@ namespace VeraCrypt
wxString msg = wxString::Format(LangString["KEYFILE_ALREADY_EXISTS"], keyfileName.GetFullPath());
if (!Gui->AskYesNo (msg, false, true))
return;
}
{
FilePath keyfilePath((const wchar_t*) keyfileName.GetFullPath().c_str());
File keyfile;
keyfile.Open (keyfilePath, File::CreateWrite);
keyfile.Write (keyfileBuffer);
}
}
Gui->ShowInfo ("KEYFILE_CREATED");
}
catch (exception &e)
{
Gui->ShowError (e);
}
}
void KeyfileGeneratorDialog::OnHashSelected (wxCommandEvent& event)
{
RandomNumberGenerator::SetHash (Gui->GetSelectedData <Hash> (HashChoice)->GetNew());
}
void KeyfileGeneratorDialog::OnMouseMotion (wxMouseEvent& event)
{
event.Skip();
- RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <byte *> (&event), sizeof (event)));
+ RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <uint8 *> (&event), sizeof (event)));
long coord = event.GetX();
- RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <byte *> (&coord), sizeof (coord)));
+ RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <uint8 *> (&coord), sizeof (coord)));
coord = event.GetY();
- RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <byte *> (&coord), sizeof (coord)));
+ RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <uint8 *> (&coord), sizeof (coord)));
if (ShowRandomPoolCheckBox->IsChecked())
ShowBytes (RandomPoolStaticText, RandomNumberGenerator::PeekPool().GetRange (0, 24));
else
HideBytes (RandomPoolStaticText, 24);
/* conservative estimate: 1 mouse move event brings 1 bit of entropy
* https://security.stackexchange.com/questions/32844/for-how-much-time-should-i-randomly-move-the-mouse-for-generating-encryption-key/32848#32848
*/
ScopeLock lock (AccessMutex);
if (MouseEventsCounter < (RNG_POOL_SIZE * 8))
CollectedEntropy->SetValue (++MouseEventsCounter);
}
void KeyfileGeneratorDialog::OnShowRandomPoolCheckBoxClicked (wxCommandEvent& event)
{
if (!event.IsChecked())
HideBytes (RandomPoolStaticText, 24);
}
void KeyfileGeneratorDialog::OnRandomSizeCheckBoxClicked (wxCommandEvent& event)
{
if (!event.IsChecked())
KeyfilesSize->Enable();
else
KeyfilesSize->Disable();
}
void KeyfileGeneratorDialog::ShowBytes (wxStaticText *textCtrl, const ConstBufferPtr &buffer, bool appendDots)
{
diff --git a/src/Main/Forms/MainFrame.cpp b/src/Main/Forms/MainFrame.cpp
index de1c99a4..77f371d8 100644
--- a/src/Main/Forms/MainFrame.cpp
+++ b/src/Main/Forms/MainFrame.cpp
@@ -57,60 +57,61 @@ namespace VeraCrypt
wxBusyCursor busy;
SetName (Application::GetName());
SetTitle (Application::GetName());
SetIcon (Resources::GetVeraCryptIcon());
#if defined(TC_UNIX) && !defined(TC_MACOSX)
try
{
string fifoPath = GetShowRequestFifoPath();
remove (fifoPath.c_str());
throw_sys_if (mkfifo (fifoPath.c_str(), S_IRUSR | S_IWUSR) == -1);
ShowRequestFifo = open (fifoPath.c_str(), O_RDONLY | O_NONBLOCK);
throw_sys_if (ShowRequestFifo == -1);
}
catch (...)
{
#ifdef DEBUG
throw;
#endif
}
#endif
InitControls();
InitPreferences();
InitTaskBarIcon();
InitEvents();
InitMessageFilter();
+ InitWindowPrivacy();
if (!GetPreferences().SecurityTokenModule.IsEmpty() && !SecurityToken::IsInitialized())
{
try
{
Gui->InitSecurityTokenLibrary();
}
catch (exception &e)
{
Gui->ShowError (e);
}
}
Connect( wxID_EXIT, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame::OnQuit ) );
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 ) );
#ifdef TC_MACOSX
Connect( wxID_ANY, wxEVT_MOVE, wxMoveEventHandler( MainFrame::OnMoveHandler ) );
#endif
}
MainFrame::~MainFrame ()
{
#if defined(TC_UNIX) && !defined(TC_MACOSX)
if (ShowRequestFifo != -1)
{
try
{
@@ -443,60 +444,66 @@ namespace VeraCrypt
PDEV_BROADCAST_HDR hdr = (PDEV_BROADCAST_HDR) lParam;
if (wParam == DBT_DEVICEREMOVECOMPLETE && hdr->dbch_devicetype == DBT_DEVTYP_VOLUME)
{
PDEV_BROADCAST_VOLUME vol = (PDEV_BROADCAST_VOLUME) lParam;
for (wchar_t driveNo = 0; driveNo < 26; ++driveNo)
{
if (vol->dbcv_unitmask & (1 << driveNo))
frame->OnDeviceChange (wstring (StringFormatter (L"{0}:\\", wchar_t (L'A' + driveNo))));
}
}
else
{
frame->OnDeviceChange ();
}
}
return CallWindowProc (MainFrameWndProc, hwnd, message, wParam, lParam);
}
#endif
void MainFrame::InitMessageFilter ()
{
#ifdef TC_WINDOWS
HWND mainFrameHwnd = static_cast <HWND> (GetHandle());
MainFrameWndProc = (WNDPROC) GetWindowLongPtr (mainFrameHwnd, GWL_WNDPROC);
SetWindowLongPtr (mainFrameHwnd, GWL_WNDPROC, (LONG_PTR) MainFrameWndProcFilter);
#endif
}
+
+ void MainFrame::InitWindowPrivacy ()
+ {
+ Gui->SetContentProtection(!CmdLine->ArgAllowScreencapture);
+ }
+
void MainFrame::InitPreferences ()
{
try
{
LoadPreferences();
VolumeSlotNumber lastSelectedSlotNumber = GetPreferences().LastSelectedSlotNumber;
if (Core->IsSlotNumberValid (lastSelectedSlotNumber))
{
long slotIndex = SlotNumberToItemIndex (lastSelectedSlotNumber);
if (slotIndex >= 0)
{
SlotListCtrl->SetItemState (slotIndex, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
SlotListCtrl->EnsureVisible (slotIndex);
}
}
LoadFavoriteVolumes();
VolumeHistory::Load();
if (VolumePathComboBox->GetValue().empty() && !VolumeHistory::Get().empty())
SetVolumePath (VolumeHistory::Get().front());
}
catch (exception &e)
{
Gui->ShowError (e);
Gui->ShowError (LangString["LINUX_ERROR_LOADING_CONFIG"] + wstring (Application::GetConfigFilePath (L"")));
}
}
@@ -1041,60 +1048,71 @@ namespace VeraCrypt
}
break;
case Hotkey::Id::ShowHideApplication:
Gui->SetBackgroundMode (!Gui->IsInBackgroundMode());
break;
case Hotkey::Id::WipeCache:
WipeCache();
Gui->ShowInfo ("PASSWORD_CACHE_WIPED");
break;
default:
assert (false);
break;
}
#endif // TC_WINDOWS
}
void MainFrame::OnHotkeysMenuItemSelected (wxCommandEvent& event)
{
#ifdef TC_MACOSX
if (Gui->IsInBackgroundMode())
Gui->SetBackgroundMode (false);
#endif
PreferencesDialog dialog (this);
dialog.SelectPage (dialog.HotkeysPage);
dialog.ShowModal();
}
+ void MainFrame::OnLanguageMenuItemSelected (wxCommandEvent& event)
+ {
+#ifdef TC_MACOSX
+ if (Gui->IsInBackgroundMode())
+ Gui->SetBackgroundMode (false);
+#endif
+ PreferencesDialog dialog (this);
+ dialog.SelectPage (dialog.LanguagesPage);
+ dialog.ShowModal();
+ }
+
void MainFrame::OnLegalNoticesMenuItemSelected (wxCommandEvent& event)
{
#ifdef TC_MACOSX
if (Gui->IsInBackgroundMode())
Gui->SetBackgroundMode (false);
#endif
LegalNoticesDialog dialog (this);
dialog.ShowModal();
}
void MainFrame::OnListChanged ()
{
OnListItemSelectionChanged();
UpdateControls();
}
void MainFrame::OnListItemActivated (wxListEvent& event)
{
if (IsMountedSlotSelected())
OpenSelectedVolume();
else
MountVolume();
}
void MainFrame::OnListItemDeleted (long itemIndex)
{
if (SelectedItemIndex > itemIndex)
--SelectedItemIndex;
}
@@ -1399,61 +1417,61 @@ namespace VeraCrypt
static bool previousState = false;
if (running && !previousState)
{
previousState = true;
Gui->OnAutoDismountAllEvent();
}
else
{
previousState = running;
}
}
#endif
}
}
if (Gui->IsInBackgroundMode())
{
if (!GetPreferences().BackgroundTaskEnabled)
{
Close (true);
}
else if (MountedVolumes.empty() && (GetPreferences().CloseBackgroundTaskOnNoVolumes || Core->IsInPortableMode()))
{
Close (true);
}
}
#if defined(TC_UNIX) && !defined(TC_MACOSX)
try
{
- byte buf[128];
+ uint8 buf[128];
if (read (ShowRequestFifo, buf, sizeof (buf)) > 0 && Gui->IsInBackgroundMode())
Gui->SetBackgroundMode (false);
}
catch (...)
{
#ifdef DEBUG
throw;
#endif
}
#endif
}
catch (exception &e)
{
Gui->ShowError (e);
}
}
void MainFrame::OnVolumeButtonClick (wxCommandEvent& event)
{
if (IsMountedSlotSelected())
DismountVolume();
else
MountVolume();
}
void MainFrame::OnVolumePropertiesButtonClick (wxCommandEvent& event)
{
shared_ptr <VolumeInfo> selectedVolume = GetSelectedVolume();
if (selectedVolume)
{
diff --git a/src/Main/Forms/MainFrame.h b/src/Main/Forms/MainFrame.h
index 5372adbb..ed1c44f7 100644
--- a/src/Main/Forms/MainFrame.h
+++ b/src/Main/Forms/MainFrame.h
@@ -57,104 +57,106 @@ namespace VeraCrypt
#endif
protected:
enum
{
ColumnSlot = 0,
ColumnPath,
ColumnSize,
#ifdef TC_WINDOWS
ColumnEA,
#else
ColumnMountPoint,
#endif
ColumnType
};
void AddToFavorites (const VolumeInfoList &volumes);
bool CanExit () const;
void ChangePassword (ChangePasswordDialog::Mode::Enum mode = ChangePasswordDialog::Mode::ChangePasswordAndKeyfiles);
void CheckFilesystem (bool repair = false);
bool CheckVolumePathNotEmpty () const;
void DismountVolume (shared_ptr <VolumeInfo> volume = shared_ptr <VolumeInfo> ());
const UserPreferences &GetPreferences () const { return Gui->GetPreferences(); }
shared_ptr <VolumeInfo> GetSelectedVolume () const;
shared_ptr <VolumePath> GetSelectedVolumePath () const { return make_shared <VolumePath> (wstring (VolumePathComboBox->GetValue())); }
void InitControls ();
void InitEvents ();
void InitMessageFilter ();
void InitPreferences ();
void InitTaskBarIcon ();
+ void InitWindowPrivacy();
bool IsFreeSlotSelected () const { return SlotListCtrl->GetSelectedItemCount() == 1 && Gui->GetListCtrlSubItemText (SlotListCtrl, SelectedItemIndex, ColumnPath).empty(); }
bool IsMountedSlotSelected () const { return SlotListCtrl->GetSelectedItemCount() == 1 && !Gui->GetListCtrlSubItemText (SlotListCtrl, SelectedItemIndex, ColumnPath).empty(); }
void LoadFavoriteVolumes ();
void LoadPreferences ();
void MountAllDevices ();
void MountVolume ();
void OnAboutMenuItemSelected (wxCommandEvent& event);
void OnQuit(wxCommandEvent& event) { Close(true); }
void OnActivate (wxActivateEvent& event);
void OnAddAllMountedToFavoritesMenuItemSelected (wxCommandEvent& event);
void OnAddToFavoritesMenuItemSelected (wxCommandEvent& event);
void OnBackupVolumeHeadersMenuItemSelected (wxCommandEvent& event);
void OnBeginnersTutorialMenuItemSelected (wxCommandEvent& event) { Gui->OpenHomepageLink (this, L"tutorial"); }
void OnBenchmarkMenuItemSelected (wxCommandEvent& event);
void OnChangeKeyfilesMenuItemSelected (wxCommandEvent& event) { ChangePassword (ChangePasswordDialog::Mode::ChangeKeyfiles); }
void OnChangePasswordMenuItemSelected (wxCommandEvent& event) { ChangePassword (); }
void OnChangePkcs5PrfMenuItemSelected (wxCommandEvent& event) { ChangePassword (ChangePasswordDialog::Mode::ChangePkcs5Prf); }
void OnCheckFilesystemMenuItemSelected( wxCommandEvent& event ) { CheckFilesystem (); }
void OnClearSlotSelectionMenuItemSelected (wxCommandEvent& event);
void OnClose (wxCloseEvent& event);
void OnCloseAllSecurityTokenSessionsMenuItemSelected (wxCommandEvent& event);
void OnDonateMenuItemSelected (wxCommandEvent& event) { Gui->OpenHomepageLink (this, L"donate"); }
void OnContactMenuItemSelected (wxCommandEvent& event) { Gui->OpenHomepageLink (this, L"contact"); }
void OnCreateKeyfileMenuItemSelected (wxCommandEvent& event)
{
#ifdef TC_MACOSX
if (Gui->IsInBackgroundMode())
Gui->SetBackgroundMode (false);
#endif
Gui->CreateKeyfile();
}
void OnCreateVolumeButtonClick (wxCommandEvent& event);
void OnDefaultKeyfilesMenuItemSelected (wxCommandEvent& event);
void OnDefaultMountParametersMenuItemSelected( wxCommandEvent& event );
void OnDismountAllButtonClick (wxCommandEvent& event);
void OnDismountVolumeMenuItemSelected (wxCommandEvent& event) { DismountVolume(); }
void OnDownloadsMenuItemSelected (wxCommandEvent& event) { Gui->OpenHomepageLink (this, L"downloads"); }
void OnEncryptionTestMenuItemSelected (wxCommandEvent& event);
void OnExitButtonClick (wxCommandEvent& event);
void OnFavoriteVolumeMenuItemSelected (wxCommandEvent& event);
void OnFaqMenuItemSelected (wxCommandEvent& event) { Gui->OpenHomepageLink (this, L"faq"); }
void OnHiddenVolumeProtectionTriggered (shared_ptr <VolumeInfo> protectedVolume);
void OnHotkey (wxKeyEvent& event);
void OnHotkeysMenuItemSelected (wxCommandEvent& event);
+ void OnLanguageMenuItemSelected (wxCommandEvent& event);
void OnLegalNoticesMenuItemSelected (wxCommandEvent& event);
void OnListChanged ();
void OnListItemActivated (wxListEvent& event);
void OnListItemDeleted (long itemIndex);
void OnListItemDeselected (wxListEvent& event);
void OnListItemInserted (long itemIndex);
void OnListItemRightClick (wxListEvent& event);
void OnListItemSelected (wxListEvent& event);
void OnListItemSelectionChanged ();
void OnLogoBitmapClick (wxMouseEvent &event) { wxCommandEvent ev; OnAboutMenuItemSelected (ev); }
void OnManageSecurityTokenKeyfilesMenuItemSelected (wxCommandEvent& event);
void OnMountAllDevicesButtonClick (wxCommandEvent& event);
void OnMountAllFavoritesMenuItemSelected (wxCommandEvent& event);
void OnMountVolumeMenuItemSelected (wxCommandEvent& event) { MountVolume(); }
void OnNewsMenuItemSelected (wxCommandEvent& event) { Gui->OpenHomepageLink (this, L"news"); }
void OnNoHistoryCheckBoxClick (wxCommandEvent& event);
void OnOnlineHelpMenuItemSelected (wxCommandEvent& event) { Gui->OpenOnlineHelp (this); }
void OnOpenVolumeMenuItemSelected (wxCommandEvent& event) { OpenSelectedVolume(); }
void OnOpenVolumeSystemRequest (wxCommandEvent& event);
void OnOpenVolumeSystemRequestEvent (EventArgs &args);
void OnOrganizeFavoritesMenuItemSelected (wxCommandEvent& event);
void OnPreferencesMenuItemSelected (wxCommandEvent& event);
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);
void OnSecurityTokenPreferencesMenuItemSelected (wxCommandEvent& event);
void OnSelectDeviceAndMountMenuItemSelected (wxCommandEvent& event);
void OnSelectDeviceButtonClick (wxCommandEvent& event);
diff --git a/src/Main/Forms/PreferencesDialog.cpp b/src/Main/Forms/PreferencesDialog.cpp
index 91204389..4e7644b6 100644
--- a/src/Main/Forms/PreferencesDialog.cpp
+++ b/src/Main/Forms/PreferencesDialog.cpp
@@ -1,100 +1,184 @@
/*
Derived from source code of TrueCrypt 7.1a, which is
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0.
Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2017 IDRIX
and are governed by the Apache License 2.0 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 <wx/dynlib.h>
#ifdef TC_WINDOWS
#include <wx/msw/registry.h>
+#else
+#include <wx/dir.h>
+#include <wx/arrstr.h>
#endif
#include "Common/SecurityToken.h"
#include "Main/Main.h"
#include "Main/Application.h"
#include "Main/GraphicUserInterface.h"
#include "Volume/Cipher.h"
#include "PreferencesDialog.h"
namespace VeraCrypt
{
PreferencesDialog::PreferencesDialog (wxWindow* parent)
: PreferencesDialogBase (parent),
LastVirtualKeyPressed (0),
Preferences (Gui->GetPreferences()),
RestoreValidatorBell (false)
{
#define TC_CHECK_BOX_VALIDATOR(NAME) (TC_JOIN(NAME,CheckBox))->SetValidator (wxGenericValidator (&Preferences.NAME));
#ifdef TC_MACOSX
PreferencesNotebook->SetMinSize (wxSize (Gui->GetCharWidth (PreferencesNotebook) * 108, -1));
#endif
// Security
TC_CHECK_BOX_VALIDATOR (DismountOnLogOff);
TC_CHECK_BOX_VALIDATOR (DismountOnPowerSaving);
TC_CHECK_BOX_VALIDATOR (DismountOnScreenSaver);
TC_CHECK_BOX_VALIDATOR (DismountOnInactivity);
DismountOnInactivitySpinCtrl->SetValidator (wxGenericValidator (&Preferences.MaxVolumeIdleTime));
TC_CHECK_BOX_VALIDATOR (ForceAutoDismount);
PreserveTimestampsCheckBox->SetValidator (wxGenericValidator (&Preferences.DefaultMountOptions.PreserveTimestamps));
TC_CHECK_BOX_VALIDATOR (WipeCacheOnAutoDismount);
TC_CHECK_BOX_VALIDATOR (WipeCacheOnClose);
// Mount options
CachePasswordsCheckBox->SetValidator (wxGenericValidator (&Preferences.DefaultMountOptions.CachePassword));
MountReadOnlyCheckBox->SetValue (Preferences.DefaultMountOptions.Protection == VolumeProtection::ReadOnly);
MountRemovableCheckBox->SetValidator (wxGenericValidator (&Preferences.DefaultMountOptions.Removable));
FilesystemOptionsTextCtrl->SetValue (Preferences.DefaultMountOptions.FilesystemOptions);
int index, prfInitialIndex = 0;
Pkcs5PrfChoice->Append (LangString["AUTODETECTION"]);
foreach_ref (const Pkcs5Kdf &kdf, Pkcs5Kdf::GetAvailableAlgorithms())
{
index = Pkcs5PrfChoice->Append (kdf.GetName());
if (Preferences.DefaultMountOptions.Kdf
&& (Preferences.DefaultMountOptions.Kdf->GetName() == kdf.GetName())
)
{
prfInitialIndex = index;
}
}
Pkcs5PrfChoice->Select (prfInitialIndex);
+ // Language for non-Windows
+#ifndef TC_WINDOWS
+#if defined (TC_MACOSX)
+ wxDir languagesFolder(StringConverter::ToSingle (Application::GetExecutableDirectory()) + "/../Resources/languages/");
+#else
+ wxDir languagesFolder("/usr/share/veracrypt/languages/");
+#endif
+ wxArrayString langArray;
+ LanguageListBox->Append("System default");
+ LanguageListBox->Append("English");
+
+ langEntries = {
+ {"system", L"System default"},
+ {"ar", L"العربية"},
+ {"be", L"Беларуская"},
+ {"bg", L"Български"},
+ {"ca", L"Català"},
+ {"co", L"Corsu"},
+ {"cs", L"Čeština"},
+ {"da", L"Dansk"},
+ {"de", L"Deutsch"},
+ {"el", L"Ελληνικά"},
+ {"en", L"English"},
+ {"es", L"Español"},
+ {"et", L"Eesti"},
+ {"eu", L"Euskara"},
+ {"fa", L"فارسي"},
+ {"fi", L"Suomi"},
+ {"fr", L"Français"},
+ {"he", L"עברית"},
+ {"hu", L"Magyar"},
+ {"id", L"Bahasa Indonesia"},
+ {"it", L"Italiano"},
+ {"ja", L"日本語"},
+ {"ka", L"ქართული"},
+ {"ko", L"한국어"},
+ {"lv", L"Latviešu"},
+ {"nb", L"Norsk Bokmål"},
+ {"nl", L"Nederlands"},
+ {"nn", L"Norsk Nynorsk"},
+ {"pl", L"Polski"},
+ {"ro", L"Română"},
+ {"ru", L"Русский"},
+ {"pt-br", L"Português-Brasil"},
+ {"sk", L"Slovenčina"},
+ {"sl", L"Slovenščina"},
+ {"sv", L"Svenska"},
+ {"th", L"ภาษาไทย"},
+ {"tr", L"Türkçe"},
+ {"uk", L"Українська"},
+ {"uz", L"Ўзбекча"},
+ {"vi", L"Tiếng Việt"},
+ {"zh-cn", L"简体中文"},
+ {"zh-hk", L"繁體中文(香港)"},
+ {"zh-tw", L"繁體中文"}
+ };
+
+ if (wxDir::Exists(languagesFolder.GetName())) {
+ size_t langCount;
+ langCount = wxDir::GetAllFiles(languagesFolder.GetName(), &langArray, "*.xml", wxDIR_FILES);
+ for (size_t i = 0; i < langCount; ++i) {
+ wxFileName filename(langArray[i]);
+
+ // Get the name part of the file (without extension)
+ wxString basename = filename.GetName();
+
+ // Check if the basename matches the pattern "Language.langId"
+ if (basename.StartsWith("Language.")) {
+ wxString langId = basename.AfterFirst('.');
+
+ // Verify if the language ID exists in langEntries map
+ wxString langNative = langEntries[langId];
+ if (!langNative.empty()) {
+ LanguageListBox->Append(langNative);
+ }
+ }
+ }
+ }
+#endif
+
+
// Keyfiles
TC_CHECK_BOX_VALIDATOR (UseKeyfiles);
DefaultKeyfilesPanel = new KeyfilesPanel (DefaultKeyfilesPage, make_shared <KeyfileList> (Preferences.DefaultKeyfiles));
DefaultKeyfilesSizer->Add (DefaultKeyfilesPanel, 1, wxALL | wxEXPAND);
DefaultKeyfilesSizer->Layout();
TC_CHECK_BOX_VALIDATOR (BackgroundTaskEnabled);
TC_CHECK_BOX_VALIDATOR (CloseBackgroundTaskOnNoVolumes);
CloseBackgroundTaskOnNoVolumesCheckBox->Show (!Core->IsInPortableMode());
TC_CHECK_BOX_VALIDATOR (BackgroundTaskMenuDismountItemsEnabled);
TC_CHECK_BOX_VALIDATOR (BackgroundTaskMenuMountItemsEnabled);
TC_CHECK_BOX_VALIDATOR (BackgroundTaskMenuOpenItemsEnabled);
// Encryption
AesHwCpuSupportedStaticText->SetLabel (
#ifdef TC_AES_HW_CPU
(HasAESNI() ? LangString["UISTR_YES"] : LangString["UISTR_NO"]));
#else
LangString["NOT_APPLICABLE_OR_NOT_AVAILABLE"]);
#endif
NoHardwareCryptoCheckBox->SetValidator (wxGenericValidator (&Preferences.DefaultMountOptions.NoHardwareCrypto));
// Security tokens
Pkcs11ModulePathTextCtrl->SetValue (wstring (Preferences.SecurityTokenModule));
TC_CHECK_BOX_VALIDATOR (CloseSecurityTokenSessionsAfterMount);
TC_CHECK_BOX_VALIDATOR (EMVSupportEnabled);
// System integration
TC_CHECK_BOX_VALIDATOR (StartOnLogon);
@@ -211,60 +295,69 @@ namespace VeraCrypt
void Notify()
{
Dialog->OnTimer();
}
PreferencesDialog *Dialog;
};
mTimer.reset (dynamic_cast <wxTimer *> (new Timer (this)));
mTimer->Start (25);
#endif
}
PreferencesDialog::~PreferencesDialog ()
{
#ifdef TC_WINDOWS
if (RestoreValidatorBell)
wxTextValidator::SuppressBellOnError (false);
#endif
}
void PreferencesDialog::SelectPage (wxPanel *page)
{
for (size_t pageIndex = 0; pageIndex < PreferencesNotebook->GetPageCount(); pageIndex++)
{
if (PreferencesNotebook->GetPage (pageIndex) == page)
PreferencesNotebook->ChangeSelection (pageIndex);
}
}
+ void PreferencesDialog::OnSysDefaultLangButtonClick (wxCommandEvent& event)
+ {
+ // SetStringSelection()'s Assert currently broken in sorted ListBoxes on macOS, workaround:
+ int itemIndex = LanguageListBox->FindString("System default", true);
+ if (itemIndex != wxNOT_FOUND) {
+ LanguageListBox->SetSelection(itemIndex);
+ }
+ }
+
void PreferencesDialog::OnAssignHotkeyButtonClick (wxCommandEvent& event)
{
#ifdef TC_WINDOWS
foreach (long item, Gui->GetListCtrlSelectedItems (HotkeyListCtrl))
{
Hotkey *hotkey = reinterpret_cast <Hotkey *> (HotkeyListCtrl->GetItemData (item));
int mods = 0;
mods |= HotkeyShiftCheckBox->IsChecked() ? wxMOD_SHIFT : 0;
mods |= HotkeyControlCheckBox->IsChecked() ? wxMOD_CONTROL : 0;
mods |= HotkeyAltCheckBox->IsChecked() ? wxMOD_ALT : 0;
mods |= HotkeyWinCheckBox->IsChecked() ? wxMOD_WIN : 0;
// F1 is help and F12 is reserved for use by the debugger at all times
if (mods == 0 && (LastVirtualKeyPressed == VK_F1 || LastVirtualKeyPressed == VK_F12))
{
Gui->ShowError ("CANNOT_USE_RESERVED_KEY");
return;
}
// Test if the hotkey can be registered
if (!this->RegisterHotKey (hotkey->Id, mods, LastVirtualKeyPressed))
{
Gui->ShowError (SystemException (SRC_POS));
return;
}
UnregisterHotKey (hotkey->Id);
foreach_ref (const Hotkey &h, Preferences.Hotkeys)
{
@@ -328,93 +421,113 @@ namespace VeraCrypt
void PreferencesDialog::OnDismountOnPowerSavingCheckBoxClick (wxCommandEvent& event)
{
if (event.IsChecked() && !ForceAutoDismountCheckBox->IsChecked())
Gui->ShowWarning ("WARN_PREF_AUTO_DISMOUNT");
}
void PreferencesDialog::OnDismountOnScreenSaverCheckBoxClick (wxCommandEvent& event)
{
if (event.IsChecked() && !ForceAutoDismountCheckBox->IsChecked())
Gui->ShowWarning ("WARN_PREF_AUTO_DISMOUNT");
}
void PreferencesDialog::OnForceAutoDismountCheckBoxClick (wxCommandEvent& event)
{
if (!event.IsChecked())
ForceAutoDismountCheckBox->SetValue (!Gui->AskYesNo (LangString["CONFIRM_NO_FORCED_AUTODISMOUNT"], false, true));
}
void PreferencesDialog::OnHotkeyListItemDeselected (wxListEvent& event)
{
UpdateHotkeyButtons();
}
void PreferencesDialog::OnHotkeyListItemSelected (wxListEvent& event)
{
UpdateHotkeyButtons();
HotkeyTextCtrl->ChangeValue (LangString ["PRESS_A_KEY_TO_ASSIGN"]);
AssignHotkeyButton->Enable (false);
}
+ // Fixes an issue where going through PreferencesNotebook tabs would unintentionally select the first entry
+ // in the LanguageListBox and thus cause a language change on OKButton press.
+ void PreferencesDialog::OnPageChanged(wxBookCtrlEvent &event)
+ {
+ LanguageListBox->DeselectAll();
+ }
+
void PreferencesDialog::OnOKButtonClick (wxCommandEvent& event)
{
#ifdef TC_WINDOWS
HotkeyTextCtrl->SetValidator (wxTextValidator (wxFILTER_NONE));
#endif
if (!Validate())
return;
shared_ptr <Pkcs5Kdf> selectedKdf;
if (Pkcs5PrfChoice->GetSelection () != 0)
{
try
{
selectedKdf = Pkcs5Kdf::GetAlgorithm (wstring (Pkcs5PrfChoice->GetStringSelection ()));
}
catch (ParameterIncorrect&)
{
return;
}
}
TransferDataFromWindow();
Preferences.DefaultMountOptions.Protection = MountReadOnlyCheckBox->IsChecked() ? VolumeProtection::ReadOnly : VolumeProtection::None;
Preferences.DefaultMountOptions.FilesystemOptions = FilesystemOptionsTextCtrl->GetValue();
Preferences.DefaultKeyfiles = *DefaultKeyfilesPanel->GetKeyfiles();
Preferences.DefaultMountOptions.Kdf = selectedKdf;
Preferences.DefaultMountOptions.ProtectionKdf = selectedKdf;
bool securityTokenModuleChanged = (Preferences.SecurityTokenModule != wstring (Pkcs11ModulePathTextCtrl->GetValue()));
Preferences.SecurityTokenModule = wstring (Pkcs11ModulePathTextCtrl->GetValue());
+ if (LanguageListBox->GetSelection() != wxNOT_FOUND) {
+ wxString langToFind = LanguageListBox->GetString(LanguageListBox->GetSelection());
+ for (map<wxString, std::wstring>::const_iterator each = langEntries.begin(); each != langEntries.end(); ++each) {
+ if (each->second == langToFind) {
+ Preferences.Language = each->first;
+#ifdef DEBUG
+ cout << "Lang set to: " << each->first << endl;
+#endif
+ }
+ }
+ Gui->ShowInfo (LangString["LINUX_RESTART_FOR_LANGUAGE_CHANGE"]);
+ }
+
Gui->SetPreferences (Preferences);
try
{
if (securityTokenModuleChanged)
{
if (Preferences.SecurityTokenModule.IsEmpty())
{
if (SecurityToken::IsInitialized())
SecurityToken::CloseLibrary ();
}
else
{
Gui->InitSecurityTokenLibrary();
}
}
}
catch (exception &e)
{
Gui->ShowError (e);
}
#ifdef TC_WINDOWS
// Hotkeys
Hotkey::RegisterList (Gui->GetMainFrame(), Preferences.Hotkeys);
#endif
EndModal (wxID_OK);
}
diff --git a/src/Main/Forms/PreferencesDialog.h b/src/Main/Forms/PreferencesDialog.h
index 0cd1482a..5e7f7e71 100644
--- a/src/Main/Forms/PreferencesDialog.h
+++ b/src/Main/Forms/PreferencesDialog.h
@@ -13,52 +13,55 @@
#ifndef TC_HEADER_Main_Forms_PreferencesDialog
#define TC_HEADER_Main_Forms_PreferencesDialog
#include "Forms.h"
#include "Main/Main.h"
#include "KeyfilesPanel.h"
namespace VeraCrypt
{
class PreferencesDialog : public PreferencesDialogBase
{
public:
PreferencesDialog (wxWindow* parent);
~PreferencesDialog ();
void SelectPage (wxPanel *page);
protected:
void OnAssignHotkeyButtonClick (wxCommandEvent& event);
void OnBackgroundTaskEnabledCheckBoxClick (wxCommandEvent& event);
void OnCancelButtonClick (wxCommandEvent& event) { EndModal (wxID_CANCEL); }
void OnClose (wxCloseEvent& event);
void OnDismountOnPowerSavingCheckBoxClick (wxCommandEvent& event);
void OnDismountOnScreenSaverCheckBoxClick (wxCommandEvent& event);
void OnForceAutoDismountCheckBoxClick (wxCommandEvent& event);
void OnHotkeyListItemDeselected (wxListEvent& event);
void OnHotkeyListItemSelected (wxListEvent& event);
void OnNoHardwareCryptoCheckBoxClick (wxCommandEvent& event);
void OnNoKernelCryptoCheckBoxClick (wxCommandEvent& event);
void OnOKButtonClick (wxCommandEvent& event);
+ void OnPageChanged (wxBookCtrlEvent& event);
void OnPreserveTimestampsCheckBoxClick (wxCommandEvent& event);
void OnRemoveHotkeyButtonClick (wxCommandEvent& event);
void OnSelectPkcs11ModuleButtonClick (wxCommandEvent& event);
+ void OnSysDefaultLangButtonClick (wxCommandEvent& event);
void OnTimer ();
void UpdateHotkeyButtons();
enum
{
ColumnHotkeyDescription = 0,
ColumnHotkey
};
KeyfilesPanel *DefaultKeyfilesPanel;
int LastVirtualKeyPressed;
unique_ptr <wxTimer> mTimer;
UserPreferences Preferences;
bool RestoreValidatorBell;
HotkeyList UnregisteredHotkeys;
+ map<wxString, wstring> langEntries;
};
}
#endif // TC_HEADER_Main_Forms_PreferencesDialog
diff --git a/src/Main/Forms/RandomPoolEnrichmentDialog.cpp b/src/Main/Forms/RandomPoolEnrichmentDialog.cpp
index e5ef160b..b48d5af6 100644
--- a/src/Main/Forms/RandomPoolEnrichmentDialog.cpp
+++ b/src/Main/Forms/RandomPoolEnrichmentDialog.cpp
@@ -36,66 +36,66 @@ namespace VeraCrypt
HideBytes (RandomPoolStaticText, 24);
MouseStaticText->Wrap (Gui->GetCharWidth (MouseStaticText) * 70);
CollectedEntropy->SetRange (RNG_POOL_SIZE * 8);
MainSizer->SetMinSize (wxSize (-1, Gui->GetCharHeight (this) * 24));
Layout();
Fit();
Center();
MouseEventsCounter = 0;
foreach (wxWindow *c, this->GetChildren())
c->Connect (wxEVT_MOTION, wxMouseEventHandler (RandomPoolEnrichmentDialog::OnMouseMotion), nullptr, this);
}
RandomPoolEnrichmentDialog::~RandomPoolEnrichmentDialog ()
{
}
void RandomPoolEnrichmentDialog::OnHashSelected (wxCommandEvent& event)
{
RandomNumberGenerator::SetHash (Gui->GetSelectedData <Hash> (HashChoice)->GetNew());
}
void RandomPoolEnrichmentDialog::OnMouseMotion (wxMouseEvent& event)
{
event.Skip();
- RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <byte *> (&event), sizeof (event)));
+ RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <uint8 *> (&event), sizeof (event)));
long coord = event.GetX();
- RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <byte *> (&coord), sizeof (coord)));
+ RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <uint8 *> (&coord), sizeof (coord)));
coord = event.GetY();
- RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <byte *> (&coord), sizeof (coord)));
+ RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <uint8 *> (&coord), sizeof (coord)));
if (ShowRandomPoolCheckBox->IsChecked())
ShowBytes (RandomPoolStaticText, RandomNumberGenerator::PeekPool().GetRange (0, 24));
else
HideBytes (RandomPoolStaticText, 24);
/* conservative estimate: 1 mouse move event brings 1 bit of entropy
* https://security.stackexchange.com/questions/32844/for-how-much-time-should-i-randomly-move-the-mouse-for-generating-encryption-key/32848#32848
*/
ScopeLock lock (AccessMutex);
if (MouseEventsCounter < (RNG_POOL_SIZE * 8))
CollectedEntropy->SetValue (++MouseEventsCounter);
}
void RandomPoolEnrichmentDialog::OnShowRandomPoolCheckBoxClicked (wxCommandEvent& event)
{
if (!event.IsChecked())
HideBytes (RandomPoolStaticText, 24);
}
void RandomPoolEnrichmentDialog::ShowBytes (wxStaticText *textCtrl, const ConstBufferPtr &buffer)
{
wxString str;
for (size_t i = 0; i < buffer.Size(); ++i)
{
str += wxString::Format (L"%02X", buffer[i]);
}
str += L"..";
diff --git a/src/Main/Forms/SecurityTokenKeyfilesDialog.cpp b/src/Main/Forms/SecurityTokenKeyfilesDialog.cpp
index d78e22fd..bbbeff74 100644
--- a/src/Main/Forms/SecurityTokenKeyfilesDialog.cpp
+++ b/src/Main/Forms/SecurityTokenKeyfilesDialog.cpp
@@ -28,148 +28,147 @@ namespace VeraCrypt
SecurityTokenKeyfileListCtrl->InsertColumn (ColumnSecurityTokenSlotId, LangString["TOKEN_SLOT_ID"], wxLIST_FORMAT_CENTER, 1);
colPermilles.push_back (102);
SecurityTokenKeyfileListCtrl->InsertColumn (ColumnSecurityTokenLabel, LangString["TOKEN_NAME"], wxLIST_FORMAT_LEFT, 1);
colPermilles.push_back (368);
SecurityTokenKeyfileListCtrl->InsertColumn (ColumnSecurityTokenKeyfileLabel, LangString["TOKEN_DATA_OBJECT_LABEL"], wxLIST_FORMAT_LEFT, 1);
colPermilles.push_back (529);
FillSecurityTokenKeyfileListCtrl();
Gui->SetListCtrlWidth (SecurityTokenKeyfileListCtrl, 65);
Gui->SetListCtrlHeight (SecurityTokenKeyfileListCtrl, 16);
Gui->SetListCtrlColumnWidths (SecurityTokenKeyfileListCtrl, colPermilles);
Fit();
Layout();
Center();
DeleteButton->Disable();
ExportButton->Disable();
OKButton->Disable();
OKButton->SetDefault();
}
void SecurityTokenKeyfilesDialog::FillSecurityTokenKeyfileListCtrl ()
{
wxBusyCursor busy;
SecurityTokenKeyfileListCtrl->DeleteAllItems();
SecurityTokenKeyfileList = Token::GetAvailableKeyfiles(Gui->GetPreferences().EMVSupportEnabled);
- size_t i = 0;
foreach (const shared_ptr<TokenKeyfile> key, SecurityTokenKeyfileList)
{
vector <wstring> fields (SecurityTokenKeyfileListCtrl->GetColumnCount());
fields[ColumnSecurityTokenSlotId] = StringConverter::ToWide ((uint64) key->Token->SlotId);
fields[ColumnSecurityTokenLabel] = key->Token->Label;
fields[ColumnSecurityTokenKeyfileLabel] = key->Id;
Gui->AppendToListCtrl (SecurityTokenKeyfileListCtrl, fields, 0, key.get());
}
}
void SecurityTokenKeyfilesDialog::OnDeleteButtonClick (wxCommandEvent& event)
{
try
{
if (!Gui->AskYesNo (LangString["CONFIRM_SEL_FILES_DELETE"]))
return;
wxBusyCursor busy;
foreach (long item, Gui->GetListCtrlSelectedItems (SecurityTokenKeyfileListCtrl))
{
SecurityToken::DeleteKeyfile (*reinterpret_cast <SecurityTokenKeyfile *> (SecurityTokenKeyfileListCtrl->GetItemData (item)));
}
FillSecurityTokenKeyfileListCtrl();
}
catch (exception &e)
{
Gui->ShowError (e);
}
}
void SecurityTokenKeyfilesDialog::OnExportButtonClick (wxCommandEvent& event)
{
try
{
foreach (long item, Gui->GetListCtrlSelectedItems (SecurityTokenKeyfileListCtrl))
{
TokenKeyfile *keyfile = reinterpret_cast <TokenKeyfile *> (SecurityTokenKeyfileListCtrl->GetItemData (item));
FilePathList files = Gui->SelectFiles (this, wxEmptyString, true);
if (!files.empty())
{
wxBusyCursor busy;
- vector <byte> keyfileData;
+ vector <uint8> keyfileData;
keyfile->GetKeyfileData (keyfileData);
BufferPtr keyfileDataBuf (&keyfileData.front(), keyfileData.size());
finally_do_arg (BufferPtr, keyfileDataBuf, { finally_arg.Erase(); });
File keyfile;
keyfile.Open (*files.front(), File::CreateWrite);
keyfile.Write (keyfileDataBuf);
}
else
break;
Gui->ShowInfo ("KEYFILE_EXPORTED");
}
}
catch (exception &e)
{
Gui->ShowError (e);
}
}
void SecurityTokenKeyfilesDialog::OnImportButtonClick (wxCommandEvent& event)
{
try
{
FilePathList keyfilePaths = Gui->SelectFiles (this, LangString["SELECT_KEYFILES"], false);
if (keyfilePaths.empty())
return;
FilePath keyfilePath = *keyfilePaths.front();
File keyfile;
keyfile.Open (keyfilePath, File::OpenRead, File::ShareReadWrite, File::PreserveTimestamps);
if (keyfile.Length() > 0)
{
- vector <byte> keyfileData (keyfile.Length());
+ vector <uint8> keyfileData (keyfile.Length());
BufferPtr keyfileDataBuf (&keyfileData.front(), keyfileData.size());
keyfile.ReadCompleteBuffer (keyfileDataBuf);
finally_do_arg (BufferPtr, keyfileDataBuf, { finally_arg.Erase(); });
NewSecurityTokenKeyfileDialog newKeyfileDialog (this, keyfilePath.ToBaseName());
if (newKeyfileDialog.ShowModal() == wxID_OK)
{
wxBusyCursor busy;
SecurityToken::CreateKeyfile (newKeyfileDialog.GetSelectedSlotId(), keyfileData, StringConverter::ToSingle (newKeyfileDialog.GetKeyfileName()));
FillSecurityTokenKeyfileListCtrl();
}
}
else
throw InsufficientData (SRC_POS, keyfilePath);
}
catch (exception &e)
{
Gui->ShowError (e);
}
}
void SecurityTokenKeyfilesDialog::OnListItemDeselected (wxListEvent& event)
{
if (SecurityTokenKeyfileListCtrl->GetSelectedItemCount() == 0)
{
DeleteButton->Disable();
ExportButton->Disable();
diff --git a/src/Main/Forms/TrueCrypt.fbp b/src/Main/Forms/TrueCrypt.fbp
index 498b6f83..0b40a99e 100644
--- a/src/Main/Forms/TrueCrypt.fbp
+++ b/src/Main/Forms/TrueCrypt.fbp
@@ -441,60 +441,74 @@
<object class="separator" expanded="0">
<property name="name">m_separator10</property>
<property name="permission">none</property>
</object>
<object class="wxMenuItem" expanded="0">
<property name="bitmap"></property>
<property name="checked">0</property>
<property name="enabled">1</property>
<property name="help"></property>
<property name="id">wxID_ANY</property>
<property name="kind">wxITEM_NORMAL</property>
<property name="label">IDM_WIPE_CACHE</property>
<property name="name">WipeCachedPasswordsMenuItem</property>
<property name="permission">protected</property>
<property name="shortcut"></property>
<property name="unchecked_bitmap"></property>
<event name="OnMenuSelection">OnWipeCacheButtonClick</event>
</object>
</object>
<object class="wxMenu" expanded="0">
<property name="label">MENU_SETTINGS</property>
<property name="name">SettingsMenu</property>
<property name="permission">protected</property>
<object class="wxMenuItem" expanded="0">
<property name="bitmap"></property>
<property name="checked">0</property>
<property name="enabled">1</property>
<property name="help"></property>
<property name="id">wxID_ANY</property>
<property name="kind">wxITEM_NORMAL</property>
+ <property name="label">IDM_LANGUAGE</property>
+ <property name="name">LanguageMenuItem</property>
+ <property name="permission">none</property>
+ <property name="shortcut"></property>
+ <property name="unchecked_bitmap"></property>
+ <event name="OnMenuSelection">OnLanguageMenuItemSelected</event>
+ </object>
+ <object class="wxMenuItem" expanded="0">
+ <property name="bitmap"></property>
+ <property name="checked">0</property>
+ <property name="enabled">1</property>
+ <property name="help"></property>
+ <property name="id">wxID_ANY</property>
+ <property name="kind">wxITEM_NORMAL</property>
<property name="label">IDM_HOTKEY_SETTINGS</property>
<property name="name">HotkeysMenuItem</property>
<property name="permission">protected</property>
<property name="shortcut"></property>
<property name="unchecked_bitmap"></property>
<event name="OnMenuSelection">OnHotkeysMenuItemSelected</event>
</object>
<object class="wxMenuItem" expanded="0">
<property name="bitmap"></property>
<property name="checked">0</property>
<property name="enabled">1</property>
<property name="help"></property>
<property name="id">wxID_ANY</property>
<property name="kind">wxITEM_NORMAL</property>
<property name="label">IDM_DEFAULT_KEYFILES</property>
<property name="name">DefaultKeyfilesMenuItem</property>
<property name="permission">none</property>
<property name="shortcut"></property>
<property name="unchecked_bitmap"></property>
<event name="OnMenuSelection">OnDefaultKeyfilesMenuItemSelected</event>
</object>
<object class="wxMenuItem" expanded="0">
<property name="bitmap"></property>
<property name="checked">0</property>
<property name="enabled">1</property>
<property name="help"></property>
<property name="id">wxID_ANY</property>
<property name="kind">wxITEM_NORMAL</property>
<property name="label">IDM_DEFAULT_MOUNT_PARAMETERS</property>
<property name="name">DefaultMountParametersMenuItem</property>
@@ -10837,60 +10851,61 @@
<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">PreferencesNotebook</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="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
+ <event name="OnNotebookPageChanged">OnPageChanged</event>
<object class="notebookpage" expanded="0">
<property name="bitmap"></property>
<property name="label">LINUX_PREF_TAB_SECURITY</property>
<property name="select">1</property>
<object class="wxPanel" 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>
@@ -14845,60 +14860,563 @@
<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>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
+ <object class="notebookpage" expanded="0">
+ <property name="bitmap"></property>
+ <property name="label">LINUX_LANGUAGE</property>
+ <property name="select">0</property>
+ <object class="wxPanel" 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">LanguagesPage</property>
+ <property name="pane_border">1</property>
+ <property name="pane_position"></property>
+ <property name="pane_size"></property>
+ <property name="permission">public</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="subclass">; ; forward_declare</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">wxTAB_TRAVERSAL</property>
+ <object class="wxBoxSizer" expanded="0">
+ <property name="minimum_size"></property>
+ <property name="name">bSizer170</property>
+ <property name="orient">wxVERTICAL</property>
+ <property name="permission">none</property>
+ <object class="sizeritem" expanded="0">
+ <property name="border">5</property>
+ <property name="flag">wxALL|wxEXPAND</property>
+ <property name="proportion">1</property>
+ <object class="wxBoxSizer" expanded="0">
+ <property name="minimum_size"></property>
+ <property name="name">bSizer171</property>
+ <property name="orient">wxVERTICAL</property>
+ <property name="permission">none</property>
+ <object class="sizeritem" expanded="0">
+ <property name="border">5</property>
+ <property name="flag">wxEXPAND</property>
+ <property name="proportion">1</property>
+ <object class="wxBoxSizer" expanded="0">
+ <property name="minimum_size"></property>
+ <property name="name">bSizer173</property>
+ <property name="orient">wxVERTICAL</property>
+ <property name="permission">none</property>
+ <object class="sizeritem" expanded="0">
+ <property name="border">5</property>
+ <property name="flag">wxALL|wxEXPAND</property>
+ <property name="proportion">1</property>
+ <object class="wxStaticBoxSizer" expanded="0">
+ <property name="id">wxID_ANY</property>
+ <property name="label">LINUX_LANGUAGE</property>
+ <property name="minimum_size"></property>
+ <property name="name">sbSizer49</property>
+ <property name="orient">wxVERTICAL</property>
+ <property name="parent">1</property>
+ <property name="permission">none</property>
+ <object class="sizeritem" expanded="0">
+ <property name="border">5</property>
+ <property name="flag">wxBOTTOM</property>
+ <property name="proportion">0</property>
+ <object class="wxBoxSizer" expanded="0">
+ <property name="minimum_size"></property>
+ <property name="name">bSizer174</property>
+ <property name="orient">wxHORIZONTAL</property>
+ <property name="permission">none</property>
+ <object class="sizeritem" expanded="0">
+ <property name="border">5</property>
+ <property name="flag">wxLEFT|wxTOP</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">IDT_ACTIVE_LANG_PACK</property>
+ <property name="markup">0</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">m_staticText73</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">; ; forward_declare</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>
+ </object>
+ </object>
+ <object class="sizeritem" expanded="0">
+ <property name="border">5</property>
+ <property name="flag">wxLEFT|wxRIGHT|wxTOP</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">CURRENT_LANGUAGE_PACK</property>
+ <property name="markup">0</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">m_staticText74</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">; ; forward_declare</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>
+ </object>
+ </object>
+ </object>
+ </object>
+ <object class="sizeritem" expanded="0">
+ <property name="border">5</property>
+ <property name="flag"></property>
+ <property name="proportion">0</property>
+ <object class="wxWrapSizer" expanded="0">
+ <property name="flags">wxWRAPSIZER_DEFAULT_FLAGS</property>
+ <property name="minimum_size"></property>
+ <property name="name">wSizer1</property>
+ <property name="orient">wxHORIZONTAL</property>
+ <property name="permission">none</property>
+ <object class="sizeritem" expanded="0">
+ <property name="border">5</property>
+ <property name="flag">wxBOTTOM|wxLEFT</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">IDT_LANGPACK_AUTHORS</property>
+ <property name="markup">0</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">m_staticText72</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">; ; forward_declare</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>
+ </object>
+ </object>
+ <object class="sizeritem" expanded="0">
+ <property name="border">5</property>
+ <property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT</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">LANGUAGE_TRANSLATORS</property>
+ <property name="markup">0</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">m_staticText71</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">; ; forward_declare</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>
+ </object>
+ </object>
+ </object>
+ </object>
+ <object class="sizeritem" expanded="0">
+ <property name="border">5</property>
+ <property name="flag">wxEXPAND|wxLEFT|wxRIGHT|wxTOP</property>
+ <property name="proportion">1</property>
+ <object class="wxListBox" 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="choices"></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">-1,-1</property>
+ <property name="moveable">1</property>
+ <property name="name">LanguageListBox</property>
+ <property name="pane_border">1</property>
+ <property name="pane_position"></property>
+ <property name="pane_size"></property>
+ <property name="permission">public</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">wxLB_SINGLE|wxLB_SORT</property>
+ <property name="subclass">; ; forward_declare</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>
+ </object>
+ </object>
+ <object class="sizeritem" expanded="0">
+ <property name="border">5</property>
+ <property name="flag">wxALIGN_BOTTOM|wxALL|wxEXPAND</property>
+ <property name="proportion">0</property>
+ <object class="wxButton" 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="auth_needed">0</property>
+ <property name="best_size"></property>
+ <property name="bg"></property>
+ <property name="bitmap"></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="current"></property>
+ <property name="default">0</property>
+ <property name="default_pane">0</property>
+ <property name="disabled"></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="focus"></property>
+ <property name="font"></property>
+ <property name="gripper">0</property>
+ <property name="hidden">0</property>
+ <property name="id">wxID_ANY</property>
+ <property name="label">LINUX_SELECT_SYS_DEFAULT_LANG</property>
+ <property name="margins"></property>
+ <property name="markup">0</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">SysDefaultLangButton</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="position"></property>
+ <property name="pressed"></property>
+ <property name="resize">Resizable</property>
+ <property name="show">1</property>
+ <property name="size"></property>
+ <property name="style"></property>
+ <property name="subclass">; ; forward_declare</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="OnButtonClick">OnSysDefaultLangButtonClick</event>
+ </object>
+ </object>
+ </object>
+ </object>
+ </object>
+ </object>
+ </object>
+ </object>
+ </object>
+ </object>
+ </object>
</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="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">bSizer182</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="spacer" expanded="0">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
@@ -17243,61 +17761,61 @@
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxLC_NO_SORT_HEADER|wxLC_REPORT</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">wxBORDER_SUNKEN</property>
<event name="OnListItemDeselected">OnListItemDeselected</event>
<event name="OnListItemSelected">OnListItemSelected</event>
<event name="OnSize">OnListSizeChanged</event>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">bSizer137</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
- <property name="flag">wxEXPAND|wxTOP|wxBOTTOM|wxLEFT</property>
+ <property name="flag">wxBOTTOM|wxEXPAND|wxLEFT|wxTOP</property>
<property name="proportion">0</property>
<object class="wxButton" 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="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></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="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="disabled"></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>
@@ -17317,61 +17835,61 @@
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">AddFilesButton</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="position"></property>
<property name="pressed"></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="OnButtonClick">OnAddFilesButtonClick</event>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
- <property name="flag">wxEXPAND|wxTOP|wxBOTTOM|wxLEFT</property>
+ <property name="flag">wxBOTTOM|wxEXPAND|wxLEFT|wxTOP</property>
<property name="proportion">0</property>
<object class="wxButton" 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="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></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="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="disabled"></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>
@@ -17391,61 +17909,61 @@
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">AddDirectoryButton</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="position"></property>
<property name="pressed"></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="OnButtonClick">OnAddDirectoryButtonClick</event>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
- <property name="flag">wxEXPAND|wxTOP|wxBOTTOM|wxLEFT</property>
+ <property name="flag">wxBOTTOM|wxEXPAND|wxLEFT|wxTOP</property>
<property name="proportion">0</property>
<object class="wxButton" 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="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></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="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="disabled"></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>
@@ -17465,61 +17983,61 @@
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">AddSecurityTokenSignatureButton</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="position"></property>
<property name="pressed"></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="OnButtonClick">OnAddSecurityTokenSignatureButtonClick</event>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
- <property name="flag">wxEXPAND|wxTOP|wxBOTTOM|wxLEFT</property>
+ <property name="flag">wxBOTTOM|wxEXPAND|wxLEFT|wxTOP</property>
<property name="proportion">0</property>
<object class="wxButton" 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="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></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="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="disabled"></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>
@@ -17539,61 +18057,61 @@
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">RemoveButton</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="position"></property>
<property name="pressed"></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="OnButtonClick">OnRemoveButtonClick</event>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
- <property name="flag">wxEXPAND|wxALL</property>
+ <property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxButton" 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="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></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="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="disabled"></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>
@@ -22182,163 +22700,163 @@
<property name="wrap">-1</property>
</object>
</object>
</object>
</object>
</object>
</object>
<object class="Panel" expanded="0">
<property name="aui_managed">0</property>
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
<property name="bg"></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="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">VolumeSizeWizardPageBase</property>
<property name="pos"></property>
<property name="size">-1,-1</property>
<property name="subclass">WizardPage; WizardPage.h</property>
<property name="tooltip"></property>
<property name="two_step_creation">0</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
- <object class="wxBoxSizer" expanded="1">
+ <object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">bSizer98</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
- <object class="sizeritem" expanded="1">
+ <object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
- <object class="wxBoxSizer" expanded="1">
+ <object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">bSizer99</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
- <object class="sizeritem" expanded="1">
+ <object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM</property>
<property name="proportion">0</property>
- <object class="spacer" expanded="1">
+ <object class="spacer" expanded="0">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
- <object class="sizeritem" expanded="1">
+ <object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
- <object class="wxBoxSizer" expanded="1">
+ <object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">bSizer100</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
- <object class="sizeritem" expanded="1">
+ <object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
- <object class="wxTextCtrl" expanded="1">
+ <object class="wxTextCtrl" 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="maxlength">0</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">VolumeSizeTextCtrl</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="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnText">OnVolumeSizeTextChanged</event>
</object>
</object>
- <object class="sizeritem" expanded="1">
+ <object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
- <object class="wxChoice" expanded="1">
+ <object class="wxChoice" 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="choices"></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>
@@ -22347,71 +22865,71 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">VolumeSizePrefixChoice</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="selection">0</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="OnChoice">OnVolumeSizePrefixSelected</event>
</object>
</object>
</object>
</object>
- <object class="sizeritem" expanded="1">
+ <object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM</property>
<property name="proportion">0</property>
- <object class="spacer" expanded="1">
+ <object class="spacer" expanded="0">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
- <object class="sizeritem" expanded="1">
+ <object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</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>
@@ -22436,132 +22954,132 @@
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; forward_declare</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="OnCheckBox">OnUseAllFreeSpaceCheckBoxClick</event>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxEXPAND|wxTOP</property>
<property name="proportion">0</property>
<object class="spacer" expanded="0">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</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="wxStaticText" expanded="1">
+ <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"></property>
<property name="markup">0</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">FreeSpaceStaticText</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="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
</object>
</object>
- <object class="sizeritem" expanded="1">
+ <object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM</property>
<property name="proportion">0</property>
- <object class="spacer" expanded="1">
+ <object class="spacer" expanded="0">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
- <object class="sizeritem" expanded="1">
+ <object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
- <object class="wxStaticText" expanded="1">
+ <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"></property>
<property name="markup">0</property>
<property name="max_size"></property>
diff --git a/src/Main/Forms/VolumeCreationWizard.cpp b/src/Main/Forms/VolumeCreationWizard.cpp
index 2653ff66..311738ca 100644
--- a/src/Main/Forms/VolumeCreationWizard.cpp
+++ b/src/Main/Forms/VolumeCreationWizard.cpp
@@ -10,60 +10,73 @@
code distribution packages.
*/
#include "System.h"
#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"
#include "Core/VolumeCreator.h"
#include "Main/Application.h"
#include "Main/GraphicUserInterface.h"
#include "Main/Resources.h"
#include "VolumeCreationWizard.h"
#include "EncryptionOptionsWizardPage.h"
#include "InfoWizardPage.h"
#include "ProgressWizardPage.h"
#include "SingleChoiceWizardPage.h"
#include "VolumeCreationProgressWizardPage.h"
#include "VolumeFormatOptionsWizardPage.h"
#include "VolumeLocationWizardPage.h"
#include "VolumePasswordWizardPage.h"
#include "VolumePimWizardPage.h"
#include "VolumeSizeWizardPage.h"
#include "WaitDialog.h"
namespace VeraCrypt
{
+ class OpenOuterVolumeFunctor : public Functor
+ {
+ public:
+ OpenOuterVolumeFunctor (const DirectoryPath &outerVolumeMountPoint) : OuterVolumeMountPoint (outerVolumeMountPoint) { }
+
+ virtual void operator() ()
+ {
+ Gui->OpenExplorerWindow (OuterVolumeMountPoint);
+ }
+
+ DirectoryPath OuterVolumeMountPoint;
+ };
+
#ifdef TC_MACOSX
bool VolumeCreationWizard::ProcessEvent(wxEvent& event)
{
if(GraphicUserInterface::HandlePasswordEntryCustomEvent (event))
return true;
else
return WizardFrame::ProcessEvent(event);
}
#endif
VolumeCreationWizard::VolumeCreationWizard (wxWindow* parent)
: WizardFrame (parent),
CrossPlatformSupport (true),
DisplayKeyInfo (false),
LargeFilesSupport (false),
QuickFormatEnabled (false),
SelectedFilesystemClusterSize (0),
SelectedFilesystemType (VolumeCreationOptions::FilesystemType::FAT),
SelectedVolumeHostType (VolumeHostType::File),
SelectedVolumeType (VolumeType::Normal),
Pim (0),
OuterPim (0),
SectorSize (0),
VolumeSize (0)
{
RandomNumberGenerator::Start();
SetTitle (LangString["INTRO_TITLE"]);
SetImage (Resources::GetVolumeCreationWizardBitmap (Gui->GetCharHeight (this) * 21));
@@ -311,165 +324,153 @@ namespace VeraCrypt
SetCancelButtonText (LangString["IDC_EXIT"]);
return page;
}
case Step::OuterVolumeContents:
{
ClearHistory();
MountOptions mountOptions;
mountOptions.Keyfiles = Keyfiles;
mountOptions.Password = Password;
mountOptions.Pim = Pim;
mountOptions.Path = make_shared <VolumePath> (SelectedVolumePath);
try
{
wxBusyCursor busy;
Gui->SetActiveFrame (this);
MountedOuterVolume = Core->MountVolume (mountOptions);
}
catch (exception &e)
{
Gui->SetActiveFrame (this);
Gui->ShowError (e);
Close();
return new InfoWizardPage (GetPageParent());
}
- struct OpenOuterVolumeFunctor : public Functor
- {
- OpenOuterVolumeFunctor (const DirectoryPath &outerVolumeMountPoint) : OuterVolumeMountPoint (outerVolumeMountPoint) { }
-
- virtual void operator() ()
- {
- Gui->OpenExplorerWindow (OuterVolumeMountPoint);
- }
-
- DirectoryPath OuterVolumeMountPoint;
- };
-
InfoWizardPage *page = new InfoWizardPage (GetPageParent(), LangString["LINUX_OPEN_OUTER_VOL"],
shared_ptr <Functor> (new OpenOuterVolumeFunctor (MountedOuterVolume->MountPoint)));
page->SetPageTitle (LangString["HIDVOL_HOST_FILLING_TITLE"]);
page->SetPageText (StringFormatter (LangString["LINUX_OUTER_VOL_IS_MOUNTED"],
wstring (MountedOuterVolume->MountPoint)));
return page;
}
case Step::HiddenVolume:
{
ClearHistory();
OuterVolume = false;
LargeFilesSupport = false;
Pim = 0;
InfoWizardPage *page = new InfoWizardPage (GetPageParent());
page->SetPageTitle (LangString["HIDVOL_PRE_CIPHER_TITLE"]);
page->SetPageText (LangString["HIDVOL_PRE_CIPHER_HELP"]);
return page;
}
default:
throw ParameterIncorrect (SRC_POS);
}
}
void VolumeCreationWizard::OnAbortButtonClick (EventArgs &args)
{
AbortRequested = true;
}
void VolumeCreationWizard::OnMouseMotion (wxMouseEvent& event)
{
event.Skip();
if (!IsWorkInProgress() && RandomNumberGenerator::IsRunning())
{
- RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <byte *> (&event), sizeof (event)));
+ RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <uint8 *> (&event), sizeof (event)));
long coord = event.GetX();
- RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <byte *> (&coord), sizeof (coord)));
+ RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <uint8 *> (&coord), sizeof (coord)));
coord = event.GetY();
- RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <byte *> (&coord), sizeof (coord)));
+ RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <uint8 *> (&coord), sizeof (coord)));
VolumeCreationProgressWizardPage *page = dynamic_cast <VolumeCreationProgressWizardPage *> (GetCurrentPage());
if (page)
{
page->IncrementEntropyProgress ();
}
}
}
void VolumeCreationWizard::OnProgressTimer ()
{
if (!IsWorkInProgress())
return;
if (AbortRequested && !AbortConfirmationPending)
{
AbortConfirmationPending = true;
if (Gui->AskYesNo (LangString ["FORMAT_ABORT"], true))
{
if (IsWorkInProgress() && Creator.get() != nullptr)
{
CreationAborted = true;
Creator->Abort();
}
}
AbortRequested = false;
AbortConfirmationPending = false;
}
VolumeCreator::ProgressInfo progress = Creator->GetProgressInfo();
VolumeCreationProgressWizardPage *page = dynamic_cast <VolumeCreationProgressWizardPage *> (GetCurrentPage());
page->SetProgressValue (progress.SizeDone);
if (!progress.CreationInProgress && !AbortConfirmationPending)
{
SetWorkInProgress (false);
OnVolumeCreatorFinished ();
}
}
void VolumeCreationWizard::OnRandomPoolUpdateTimer ()
{
if (!IsWorkInProgress())
{
wxLongLong time = wxGetLocalTimeMillis();
- RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <byte *> (&time), sizeof (time)));
+ RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <uint8 *> (&time), sizeof (time)));
}
}
void VolumeCreationWizard::OnVolumeCreatorFinished ()
{
VolumeCreationProgressWizardPage *page = dynamic_cast <VolumeCreationProgressWizardPage *> (GetCurrentPage());
ProgressTimer.reset();
page->SetProgressState (false);
Gui->EndInteractiveBusyState (this);
SetWorkInProgress (false);
UpdateControls();
try
{
if (!CreationAborted)
{
Creator->CheckResult();
#ifdef TC_UNIX
// Format non-FAT filesystem
const char *fsFormatter = VolumeCreationOptions::FilesystemType::GetFsFormatter (SelectedFilesystemType);
if (fsFormatter)
{
wxBusyCursor busy;
MountOptions mountOptions (Gui->GetPreferences().DefaultMountOptions);
mountOptions.Path = make_shared <VolumePath> (SelectedVolumePath);
@@ -948,61 +949,61 @@ namespace VeraCrypt
SingleChoiceWizardPage <bool> *page = dynamic_cast <SingleChoiceWizardPage <bool> *> (GetCurrentPage());
try
{
CrossPlatformSupport = page->GetSelection();
}
catch (NoItemSelected &)
{
return GetCurrentStep();
}
if (forward && CrossPlatformSupport)
Gui->ShowWarning (StringFormatter (LangString["LINUX_NOT_FAT_HINT"], SystemInfo::GetPlatformName()));
return Step::CreationProgress;
}
case Step::CreationProgress:
{
VolumeCreationProgressWizardPage *page = dynamic_cast <VolumeCreationProgressWizardPage *> (GetCurrentPage());
DisplayKeyInfo = page->IsKeyInfoDisplayed();
if (forward)
{
if (SelectedVolumeType != VolumeType::Hidden || OuterVolume)
{
if (OuterVolume && VolumeSize > TC_MAX_FAT_SECTOR_COUNT * SectorSize)
{
uint64 limit = TC_MAX_FAT_SECTOR_COUNT * SectorSize / BYTES_PER_TB;
- wstring err = StringFormatter (LangString["LINUX_ERROR_SIZE_HIDDEN_VOL"], limit, limit * 1024);
+ wstring err = static_cast<wstring>(StringFormatter (LangString["LINUX_ERROR_SIZE_HIDDEN_VOL"], limit, limit * 1024));
if (SectorSize < 4096)
{
err += LangString["LINUX_MAX_SIZE_HINT"];
#if defined (TC_LINUX)
err += LangString["LINUX_DOT_LF"];
#else
err += LangString["LINUX_NOT_SUPPORTED"];
#endif
}
Gui->ShowError (err);
return GetCurrentStep();
}
if (SelectedVolumePath.IsDevice())
{
wxString confirmMsg = LangString["OVERWRITEPROMPT_DEVICE"];
if (!Gui->AskYesNo (wxString::Format (confirmMsg, wxString (LangString["DEVICE"]).c_str(), wstring (SelectedVolumePath).c_str(), L""), false, true))
return GetCurrentStep();
}
else if (FilesystemPath (wstring (SelectedVolumePath)).IsFile())
{
wxString confirmMsg = LangString["OVERWRITEPROMPT"];
if (!Gui->AskYesNo (wxString::Format (confirmMsg, wstring (SelectedVolumePath).c_str()), false, true))
return GetCurrentStep();
}
}
diff --git a/src/Main/Forms/VolumePasswordPanel.cpp b/src/Main/Forms/VolumePasswordPanel.cpp
index 32b92edc..0555f339 100644
--- a/src/Main/Forms/VolumePasswordPanel.cpp
+++ b/src/Main/Forms/VolumePasswordPanel.cpp
@@ -145,105 +145,103 @@ namespace VeraCrypt
};
if (enableKeyfiles)
{
SetDropTarget (new FileDropTarget (this));
foreach (wxWindow *c, GetChildren())
c->SetDropTarget (new FileDropTarget (this));
}
Layout();
Fit();
}
VolumePasswordPanel::~VolumePasswordPanel ()
{
WipeTextCtrl (PasswordTextCtrl);
WipeTextCtrl (ConfirmPasswordTextCtrl);
}
void VolumePasswordPanel::AddKeyfile (shared_ptr <Keyfile> keyfile)
{
if (!Keyfiles)
Keyfiles.reset (new KeyfileList);
Keyfiles->push_back (keyfile);
UseKeyfilesCheckBox->SetValue (true);
}
void VolumePasswordPanel::SetPimValidator ()
{
- wxTextValidator validator (wxFILTER_INCLUDE_CHAR_LIST); // wxFILTER_NUMERIC does not exclude - . , etc.
- const wxChar *valArr[] = { L"0", L"1", L"2", L"3", L"4", L"5", L"6", L"7", L"8", L"9" };
- validator.SetIncludes (wxArrayString (array_capacity (valArr), (const wxChar **) &valArr));
+ wxTextValidator validator (wxFILTER_DIGITS);
VolumePimTextCtrl->SetValidator (validator);
}
void VolumePasswordPanel::DisplayPassword (bool display, wxTextCtrl **textCtrl, int row)
{
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 : maxPasswordLength);
newTextCtrl->SetValue ((*textCtrl)->GetValue());
newTextCtrl->SetMinSize ((*textCtrl)->GetSize());
GridBagSizer->Detach ((*textCtrl));
GridBagSizer->Add (newTextCtrl, wxGBPosition (row, 1), wxGBSpan (1, colspan), wxEXPAND|wxBOTTOM, 5);
(*textCtrl)->Show (false);
WipeTextCtrl (*textCtrl);
Fit();
Layout();
newTextCtrl->SetMinSize ((*textCtrl)->GetMinSize());
newTextCtrl->Connect (wxEVT_COMMAND_TEXT_UPDATED, isPim? wxCommandEventHandler (VolumePasswordPanel::OnPimChanged): wxCommandEventHandler (VolumePasswordPanel::OnTextChanged), nullptr, this);
delete *textCtrl;
*textCtrl = newTextCtrl;
if (isPim)
SetPimValidator ();
}
shared_ptr <VolumePassword> VolumePasswordPanel::GetPassword (bool bForceLegacyPassword) const
{
return GetPassword (PasswordTextCtrl, bForceLegacyPassword);
}
shared_ptr <VolumePassword> VolumePasswordPanel::GetPassword (wxTextCtrl *textCtrl, bool bLegacyPassword) const
{
shared_ptr <VolumePassword> password;
wchar_t passwordBuf[VolumePassword::MaxSize + 1];
size_t maxPasswordLength = (bLegacyPassword || CmdLine->ArgUseLegacyPassword)? VolumePassword::MaxLegacySize: VolumePassword::MaxSize;
- finally_do_arg (BufferPtr, BufferPtr (reinterpret_cast <byte *> (passwordBuf), sizeof (passwordBuf)), { finally_arg.Erase(); });
+ finally_do_arg (BufferPtr, BufferPtr (reinterpret_cast <uint8 *> (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, 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)
{
passwordBuf[i] = (wchar_t) passwordStr[i];
passwordStr[i] = L'X';
}
password = ToUTF8Password (passwordBuf, passwordStr.size() <= maxPasswordLength ? passwordStr.size() : maxPasswordLength, maxPasswordLength);
#endif
return password;
}
shared_ptr <Pkcs5Kdf> VolumePasswordPanel::GetPkcs5Kdf () const
{
try
{
int index = Pkcs5PrfChoice->GetSelection ();
if ((wxNOT_FOUND == index) || (0 == index))
{
// auto-detection
return shared_ptr <Pkcs5Kdf> ();
}
else
return Pkcs5Kdf::GetAlgorithm (wstring (Pkcs5PrfChoice->GetStringSelection()));
}
catch (ParameterIncorrect&)
@@ -440,44 +438,45 @@ namespace VeraCrypt
VolumePimHelpStaticText->SetForegroundColour(*wxRED);
VolumePimHelpStaticText->SetLabel(LangString["PIM_CHANGE_WARNING"]);
guiUpdated = true;
}
if (!pimChanged && VolumePimHelpStaticText->GetForegroundColour() != wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT))
{
VolumePimHelpStaticText->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
VolumePimHelpStaticText->SetLabel(LangString["IDC_PIM_HELP"]);
guiUpdated = true;
}
if (guiUpdated)
{
Layout();
Fit();
GetParent()->Layout();
GetParent()->Fit();
}
return guiUpdated;
}
void VolumePasswordPanel::OnUsePimCheckBoxClick( wxCommandEvent& event )
{
if (EnablePimEntry)
{
wxWindow* layoutParent = TopOwnerParent? TopOwnerParent : GetParent();
PimCheckBox->Show (false);
VolumePimStaticText->Show (true);
VolumePimTextCtrl->Show (true);
VolumePimHelpStaticText->Show (true);
+ VolumePimTextCtrl->SetFocus();
if (DisplayPasswordCheckBox->IsChecked ())
DisplayPassword (true, &VolumePimTextCtrl, 3);
else
{
Layout();
Fit();
}
layoutParent->Layout();
layoutParent->Fit();
}
}
}
diff --git a/src/Main/Forms/VolumePimWizardPage.cpp b/src/Main/Forms/VolumePimWizardPage.cpp
index c4f7014b..6500affb 100644
--- a/src/Main/Forms/VolumePimWizardPage.cpp
+++ b/src/Main/Forms/VolumePimWizardPage.cpp
@@ -1,55 +1,56 @@
/*
Copyright (c) 2015-2016 Mounir IDRASSI for the VeraCrypt project.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#include "System.h"
#include "Main/GraphicUserInterface.h"
#include "VolumePimWizardPage.h"
namespace VeraCrypt
{
VolumePimWizardPage::VolumePimWizardPage (wxPanel* parent)
: VolumePimWizardPageBase (parent)
{
+ VolumePimTextCtrl->SetMinSize (wxSize (Gui->GetCharWidth (VolumePimTextCtrl) * 15, -1));
SetPimValidator ();
}
VolumePimWizardPage::~VolumePimWizardPage ()
{
}
int VolumePimWizardPage::GetVolumePim () const
{
if (VolumePimTextCtrl->IsEnabled ())
{
wxString pimStr (VolumePimTextCtrl->GetValue());
long pim = 0;
if (pimStr.IsEmpty())
return 0;
if (((size_t) wxNOT_FOUND == pimStr.find_first_not_of (wxT("0123456789")))
&& pimStr.ToLong (&pim)
&& pim <= MAX_PIM_VALUE)
return (int) pim;
else
return -1;
}
else
return 0;
}
void VolumePimWizardPage::SetVolumePim (int pim)
{
if (pim > 0)
{
@@ -64,63 +65,61 @@ namespace VeraCrypt
}
bool VolumePimWizardPage::IsValid ()
{
return true;
}
void VolumePimWizardPage::OnPimChanged (wxCommandEvent& event)
{
OnPimValueChanged (GetVolumePim ());
}
void VolumePimWizardPage::OnPimValueChanged (int pim)
{
if (pim > 0)
{
VolumePimHelpStaticText->SetForegroundColour(*wxRED);
VolumePimHelpStaticText->SetLabel(LangString["PIM_CHANGE_WARNING"]);
}
else
{
VolumePimHelpStaticText->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
VolumePimHelpStaticText->SetLabel(LangString["IDC_PIM_HELP"]);
}
Fit();
Layout();
}
void VolumePimWizardPage::SetPimValidator ()
{
- wxTextValidator validator (wxFILTER_INCLUDE_CHAR_LIST); // wxFILTER_NUMERIC does not exclude - . , etc.
- const wxChar *valArr[] = { L"0", L"1", L"2", L"3", L"4", L"5", L"6", L"7", L"8", L"9" };
- validator.SetIncludes (wxArrayString (array_capacity (valArr), (const wxChar **) &valArr));
+ wxTextValidator validator (wxFILTER_DIGITS);
VolumePimTextCtrl->SetValidator (validator);
}
void VolumePimWizardPage::OnDisplayPimCheckBoxClick( wxCommandEvent& event )
{
FreezeScope freeze (this);
bool display = event.IsChecked ();
wxTextCtrl *newTextCtrl = new wxTextCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, display ? 0 : wxTE_PASSWORD);
newTextCtrl->SetMaxLength (MAX_PIM_DIGITS);
newTextCtrl->SetValue (VolumePimTextCtrl->GetValue());
newTextCtrl->SetMinSize (VolumePimTextCtrl->GetSize());
PimSizer->Replace (VolumePimTextCtrl, newTextCtrl);
VolumePimTextCtrl->Show (false);
int txtLen = VolumePimTextCtrl->GetLineLength(0);
if (txtLen > 0)
{
VolumePimTextCtrl->SetValue (wxString (L'X', txtLen));
}
GetVolumePim ();
Fit();
Layout();
newTextCtrl->SetMinSize (VolumePimTextCtrl->GetMinSize());
newTextCtrl->Connect (wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler (VolumePimWizardPage::OnPimChanged), nullptr, this);
delete VolumePimTextCtrl;
VolumePimTextCtrl = newTextCtrl;
diff --git a/src/Main/Forms/VolumeSizeWizardPage.cpp b/src/Main/Forms/VolumeSizeWizardPage.cpp
index 83fdd40f..08aa7052 100644
--- a/src/Main/Forms/VolumeSizeWizardPage.cpp
+++ b/src/Main/Forms/VolumeSizeWizardPage.cpp
@@ -46,63 +46,61 @@ namespace VeraCrypt
diskSpace += static_cast<wxLongLong_t>(containerSizeUnsigned.GetValue());
}
AvailableDiskSpace = (uint64) diskSpace.GetValue ();
}
FreeSpaceStaticText->SetFont (Gui->GetDefaultBoldFont (this));
if (!freeSpaceText.empty())
{
FreeSpaceStaticText->SetLabel (freeSpaceText);
}
else
{
#ifdef TC_WINDOWS
wxString drive = wxFileName (wstring (volumePath)).GetVolume();
if (!drive.empty())
{
FreeSpaceStaticText->SetLabel (StringFormatter (LangString["LINUX_FREE_SPACE_ON_DRIVE"],
drive, Gui->SizeToString (diskSpace.GetValue())));
}
else
#endif
{
FreeSpaceStaticText->SetLabel (StringFormatter (LangString["DISK_FREE"],
Gui->SizeToString (diskSpace.GetValue())));
}
}
VolumeSizeTextCtrl->SetMinSize (wxSize (Gui->GetCharWidth (VolumeSizeTextCtrl) * 20, -1));
- wxTextValidator validator (wxFILTER_INCLUDE_CHAR_LIST); // wxFILTER_NUMERIC does not exclude - . , etc.
- const wxChar *valArr[] = { L"0", L"1", L"2", L"3", L"4", L"5", L"6", L"7", L"8", L"9" };
- validator.SetIncludes (wxArrayString (array_capacity (valArr), (const wxChar **) &valArr));
+ wxTextValidator validator (wxFILTER_DIGITS);
VolumeSizeTextCtrl->SetValidator (validator);
}
uint64 VolumeSizeWizardPage::GetVolumeSize () const
{
uint64 prefixMult = 1;
uint64 val;
if (UseAllFreeSpaceCheckBox->IsChecked ())
{
val = MaxVolumeSizeValid ? MaxVolumeSize : AvailableDiskSpace;
}
else
{
int selection = VolumeSizePrefixChoice->GetSelection();
if (selection == wxNOT_FOUND)
return 0;
uint64 counter = reinterpret_cast <uint64> (VolumeSizePrefixChoice->GetClientData (selection));
while (counter)
{
prefixMult *= 1024;
counter--;
}
val = StringConverter::ToUInt64 (wstring(VolumeSizeTextCtrl->GetValue()));
}
if (val <= 0x7fffFFFFffffFFFFull / prefixMult)
{
val *= prefixMult;
uint32 sectorSizeRem = val % SectorSize;
diff --git a/src/Main/Forms/WaitDialog.cpp b/src/Main/Forms/WaitDialog.cpp
index d53656f9..102d479a 100644
--- a/src/Main/Forms/WaitDialog.cpp
+++ b/src/Main/Forms/WaitDialog.cpp
@@ -1,40 +1,43 @@
/*
Copyright (c) 2013-2017 IDRIX. All rights reserved.
Governed by the Apache License 2.0 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"
+#ifdef WOLFCRYPT_BACKEND
+#include "Volume/EncryptionModeWolfCryptXTS.h"
+#endif
#include "Main/GraphicUserInterface.h"
#include "Common/PCSCException.h"
#include "Common/SecurityToken.h"
#include "WaitDialog.h"
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()
{
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);
diff --git a/src/Main/Forms/WaitDialog.h b/src/Main/Forms/WaitDialog.h
index 89de8718..53f5048b 100644
--- a/src/Main/Forms/WaitDialog.h
+++ b/src/Main/Forms/WaitDialog.h
@@ -53,61 +53,61 @@ namespace VeraCrypt
WaitStaticText->SetLabel (label);
WaitProgessBar->Pulse();
Layout();
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);
}
~WaitDialog()
{
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 )
{
m_thread->Run();
m_timer.Start(100);
m_bThreadRunning = true;
}
- int GetCharWidth (wxWindow *window) const
+ static int ComputeCharWidth (wxWindow *window)
{
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);
@@ -152,61 +152,61 @@ namespace VeraCrypt
{
event.Veto ();
}
else
event.Skip ();
}
void OnThreadCompletion(wxCommandEvent &)
{
m_bThreadRunning = false;
m_queue.Clear();
EndModal(0);
}
void OnAdminPasswordRequest(wxCommandEvent &)
{
wxPasswordEntryDialog dialog (this, LangString["LINUX_ADMIN_PW_QUERY"], LangString["LINUX_ADMIN_PW_QUERY_TITLE"]);
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));
+ dialog.SetSize (wxSize (ComputeCharWidth (&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;
}
wxMessageDialog cur(this, pParam->m_message, pParam->m_caption, pParam->m_style);
cur.SetYesNoLabels(LangString["UISTR_YES"], LangString["UISTR_NO"]);
int iResult = (cur.ShowModal() == wxID_YES ? wxYES : wxNO);
delete pParam;
m_queue.Post(wxString::Format(wxT("%d"), iResult));
}
void OnProgressTimer(wxTimerEvent& event)
{
WaitProgessBar->Pulse();
}
virtual void Run(void) { ShowModal(); if (m_pRoutine->HasException()) ThrowException(m_pRoutine->m_pException); }
diff --git a/src/Main/GraphicUserInterface.cpp b/src/Main/GraphicUserInterface.cpp
index 16db8f83..1cb62671 100644
--- a/src/Main/GraphicUserInterface.cpp
+++ b/src/Main/GraphicUserInterface.cpp
@@ -10,60 +10,86 @@
code distribution packages.
*/
#include "System.h"
#ifdef TC_UNIX
#include <wx/mimetype.h>
#include <wx/sckipc.h>
#include <fcntl.h>
#include <signal.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/utsname.h>
#include "Platform/Unix/Process.h"
#endif
#include "Common/SecurityToken.h"
#include "Application.h"
#include "GraphicUserInterface.h"
#include "FatalErrorHandler.h"
#include "Forms/DeviceSelectionDialog.h"
#include "Forms/KeyfileGeneratorDialog.h"
#include "Forms/MainFrame.h"
#include "Forms/MountOptionsDialog.h"
#include "Forms/RandomPoolEnrichmentDialog.h"
#include "Forms/SecurityTokenKeyfilesDialog.h"
namespace VeraCrypt
{
+ class AdminPasswordGUIRequestHandler : public GetStringFunctor
+ {
+ public:
+ virtual void operator() (string &passwordStr)
+ {
+
+ wxString sValue;
+ if (Gui->GetWaitDialog())
+ {
+ Gui->GetWaitDialog()->RequestAdminPassword(sValue);
+ if (sValue.IsEmpty())
+ throw UserAbort (SRC_POS);
+ }
+ else
+ {
+ wxPasswordEntryDialog dialog (Gui->GetActiveWindow(), LangString["LINUX_ADMIN_PW_QUERY"], LangString["LINUX_ADMIN_PW_QUERY_TITLE"]);
+ if (dialog.ShowModal() != wxID_OK)
+ throw UserAbort (SRC_POS);
+ sValue = dialog.GetValue();
+ }
+ wstring wPassword (sValue); // A copy of the password is created here by wxWidgets, which cannot be erased
+ finally_do_arg (wstring *, &wPassword, { StringConverter::Erase (*finally_arg); });
+
+ StringConverter::ToSingle (wPassword, passwordStr);
+ }
+ };
#ifdef TC_MACOSX
int GraphicUserInterface::g_customIdCmdV = 0;
int GraphicUserInterface::g_customIdCmdA = 0;
#endif
GraphicUserInterface::GraphicUserInterface () :
ActiveFrame (nullptr),
BackgroundMode (false),
mMainFrame (nullptr),
mWaitDialog (nullptr)
{
#ifdef TC_UNIX
signal (SIGHUP, OnSignal);
signal (SIGINT, OnSignal);
signal (SIGQUIT, OnSignal);
signal (SIGTERM, OnSignal);
#endif
#ifdef TC_MACOSX
g_customIdCmdV = wxNewId();
g_customIdCmdA = wxNewId();
wxApp::s_macHelpMenuTitleName = LangString["MENU_HELP"];
#endif
}
GraphicUserInterface::~GraphicUserInterface ()
{
try
{
if (RandomNumberGenerator::IsRunning())
@@ -138,60 +164,61 @@ namespace VeraCrypt
#ifdef TC_UNIX
// Temporarily take ownership of a device if the user is not an administrator
UserId origDeviceOwner ((uid_t) -1);
if (!Core->HasAdminPrivileges() && volumePath->IsDevice())
{
origDeviceOwner = FilesystemPath (wstring (*volumePath)).GetOwner();
Core->SetFileOwner (*volumePath, UserId (getuid()));
}
finally_do_arg2 (FilesystemPath, *volumePath, UserId, origDeviceOwner,
{
if (finally_arg2.SystemId != (uid_t) -1)
Core->SetFileOwner (finally_arg, finally_arg2);
});
#endif
ShowInfo ("EXTERNAL_VOL_HEADER_BAK_FIRST_INFO");
shared_ptr <Volume> normalVolume;
shared_ptr <Volume> hiddenVolume;
MountOptions normalVolumeMountOptions;
MountOptions hiddenVolumeMountOptions;
normalVolumeMountOptions.Path = volumePath;
hiddenVolumeMountOptions.Path = volumePath;
VolumeType::Enum volumeType = VolumeType::Normal;
+ bool masterKeyVulnerable = false;
// Open both types of volumes
while (true)
{
shared_ptr <Volume> volume;
MountOptions *options = (volumeType == VolumeType::Hidden ? &hiddenVolumeMountOptions : &normalVolumeMountOptions);
MountOptionsDialog dialog (parent, *options,
LangString[volumeType == VolumeType::Hidden ? "ENTER_HIDDEN_VOL_PASSWORD" : "ENTER_NORMAL_VOL_PASSWORD"],
true);
while (!volume)
{
dialog.Hide();
if (dialog.ShowModal() != wxID_OK)
return;
try
{
wxBusyCursor busy;
OpenVolumeThreadRoutine routine(
options->Path,
options->PreserveTimestamps,
options->Password,
options->Pim,
options->Kdf,
options->Keyfiles,
options->EMVSupportEnabled,
options->Protection,
options->ProtectionPassword,
@@ -220,60 +247,67 @@ namespace VeraCrypt
options->Pim,
options->Kdf,
options->Keyfiles,
options->EMVSupportEnabled,
options->Protection,
options->ProtectionPassword,
options->ProtectionPim,
options->ProtectionKdf,
options->ProtectionKeyfiles,
true,
volumeType,
true
);
ExecuteWaitThreadRoutine (parent, &routine2);
volume = routine2.m_pVolume;
bFailed = false;
}
catch (...)
{
}
}
if (bFailed)
ShowWarning (e);
else
ShowWarning ("HEADER_DAMAGED_AUTO_USED_HEADER_BAK");
}
}
+ // check if volume master key is vulnerable
+ if (volume->IsMasterKeyVulnerable())
+ {
+ masterKeyVulnerable = true;
+ ShowWarning ("ERR_XTS_MASTERKEY_VULNERABLE");
+ }
+
if (volumeType == VolumeType::Hidden)
hiddenVolume = volume;
else
normalVolume = volume;
// Ask whether a hidden volume is present
if (volumeType == VolumeType::Normal)
{
wxArrayString choices;
choices.Add (LangString["VOLUME_CONTAINS_HIDDEN"]);
choices.Add (LangString["VOLUME_DOES_NOT_CONTAIN_HIDDEN"]);
wxSingleChoiceDialog choiceDialog (parent, LangString["DOES_VOLUME_CONTAIN_HIDDEN"], Application::GetName(), choices);
choiceDialog.SetSize (wxSize (Gui->GetCharWidth (&choiceDialog) * 60, -1));
choiceDialog.SetSelection (0);
if (choiceDialog.ShowModal() != wxID_OK)
return;
switch (choiceDialog.GetSelection())
{
case 0:
volumeType = VolumeType::Hidden;
continue;
case 1:
break;
default:
return;
@@ -313,60 +347,64 @@ namespace VeraCrypt
{
wxBusyCursor busy;
// Re-encrypt volume header
SecureBuffer newHeaderBuffer (normalVolume->GetLayout()->GetHeaderSize());
ReEncryptHeaderThreadRoutine routine(newHeaderBuffer, normalVolume->GetHeader(), normalVolumeMountOptions.Password, normalVolumeMountOptions.Pim, normalVolumeMountOptions.Keyfiles, normalVolumeMountOptions.EMVSupportEnabled);
ExecuteWaitThreadRoutine (parent, &routine);
backupFile.Write (newHeaderBuffer);
if (hiddenVolume)
{
// Re-encrypt hidden volume header
ReEncryptHeaderThreadRoutine hiddenRoutine(newHeaderBuffer, hiddenVolume->GetHeader(), hiddenVolumeMountOptions.Password, hiddenVolumeMountOptions.Pim, hiddenVolumeMountOptions.Keyfiles, hiddenVolumeMountOptions.EMVSupportEnabled);
ExecuteWaitThreadRoutine (parent, &hiddenRoutine);
}
else
{
// Store random data in place of hidden volume header
shared_ptr <EncryptionAlgorithm> ea = normalVolume->GetEncryptionAlgorithm();
Core->RandomizeEncryptionAlgorithmKey (ea);
ea->Encrypt (newHeaderBuffer);
}
backupFile.Write (newHeaderBuffer);
}
ShowWarning ("VOL_HEADER_BACKED_UP");
+
+ // display again warning that master key is vulnerable
+ if (masterKeyVulnerable)
+ ShowWarning ("ERR_XTS_MASTERKEY_VULNERABLE");
}
void GraphicUserInterface::BeginInteractiveBusyState (wxWindow *window)
{
static unique_ptr <wxCursor> arrowWaitCursor;
if (arrowWaitCursor.get() == nullptr)
arrowWaitCursor.reset (new wxCursor (wxCURSOR_ARROWWAIT));
window->SetCursor (*arrowWaitCursor);
}
void GraphicUserInterface::CreateKeyfile (shared_ptr <FilePath> keyfilePath) const
{
try
{
KeyfileGeneratorDialog dialog (GetActiveWindow());
dialog.ShowModal();
}
catch (exception &e)
{
ShowError (e);
}
}
void GraphicUserInterface::ClearListCtrlSelection (wxListCtrl *listCtrl) const
{
foreach (long item, GetListCtrlSelectedItems (listCtrl))
listCtrl->SetItemState (item, 0, wxLIST_STATE_SELECTED);
}
@@ -425,87 +463,61 @@ namespace VeraCrypt
#ifdef __WXGTK__
// GTK for some reason unhides a hidden window if it is a parent of a new window
if (IsInBackgroundMode())
return nullptr;
#endif
if (wxTopLevelWindows.size() == 1)
return dynamic_cast <wxTopLevelWindow *> (wxTopLevelWindows.front());
#ifdef __WXGTK__
wxLongLong startTime = wxGetLocalTimeMillis();
do
{
#endif
foreach (wxWindow *window, wxTopLevelWindows)
{
wxTopLevelWindow *topLevelWin = dynamic_cast <wxTopLevelWindow *> (window);
if (topLevelWin && topLevelWin->IsActive() && topLevelWin->IsShown())
return topLevelWin;
}
#ifdef __WXGTK__
Yield(); // GTK does a lot of operations asynchronously, which makes it prone to many race conditions
} while (wxGetLocalTimeMillis() - startTime < 500);
#endif
return dynamic_cast <wxTopLevelWindow *> (ActiveFrame ? ActiveFrame : GetTopWindow());
}
shared_ptr <GetStringFunctor> GraphicUserInterface::GetAdminPasswordRequestHandler ()
{
- struct AdminPasswordRequestHandler : public GetStringFunctor
- {
- virtual void operator() (string &passwordStr)
- {
-
- wxString sValue;
- if (Gui->GetWaitDialog())
- {
- Gui->GetWaitDialog()->RequestAdminPassword(sValue);
- if (sValue.IsEmpty())
- throw UserAbort (SRC_POS);
- }
- else
- {
- wxPasswordEntryDialog dialog (Gui->GetActiveWindow(), LangString["LINUX_ADMIN_PW_QUERY"], LangString["LINUX_ADMIN_PW_QUERY_TITLE"]);
- if (dialog.ShowModal() != wxID_OK)
- throw UserAbort (SRC_POS);
- sValue = dialog.GetValue();
- }
- wstring wPassword (sValue); // A copy of the password is created here by wxWidgets, which cannot be erased
- finally_do_arg (wstring *, &wPassword, { StringConverter::Erase (*finally_arg); });
-
- StringConverter::ToSingle (wPassword, passwordStr);
- }
- };
-
- return shared_ptr <GetStringFunctor> (new AdminPasswordRequestHandler);
+ return shared_ptr <GetStringFunctor> (new AdminPasswordGUIRequestHandler);
}
int GraphicUserInterface::GetCharHeight (wxWindow *window) const
{
int width;
int height;
window->GetTextExtent (L"a", &width, &height);
if (height < 1)
return 14;
return height;
}
int GraphicUserInterface::GetCharWidth (wxWindow *window) const
{
int width;
int height;
window->GetTextExtent (L"a", &width, &height);
if (width < 1)
return 7;
return width;
}
wxFont GraphicUserInterface::GetDefaultBoldFont (wxWindow *window) const
{
return wxFont (
#ifdef __WXGTK__
@@ -965,61 +977,61 @@ namespace VeraCrypt
wxLog::SetLogLevel (logLevel);
if (SingleInstanceChecker->IsAnotherRunning())
{
#ifdef TC_WINDOWS
class Client: public wxDDEClient
{
public:
Client() {};
wxConnectionBase *OnMakeConnection () { return new Connection; }
};
unique_ptr <wxDDEClient> client (new Client);
unique_ptr <wxConnectionBase> connection (client->MakeConnection (L"localhost", serverName, L"raise"));
if (connection.get() && connection->Execute (nullptr))
{
connection->Disconnect();
Application::SetExitCode (0);
return false;
}
#endif
#if defined(TC_UNIX) && !defined(TC_MACOSX)
try
{
int showFifo = open (string (MainFrame::GetShowRequestFifoPath()).c_str(), O_WRONLY | O_NONBLOCK);
throw_sys_if (showFifo == -1);
- byte buf[1] = { 1 };
+ uint8 buf[1] = { 1 };
if (write (showFifo, buf, 1) == 1)
{
close (showFifo);
Gui->ShowInfo (LangString["LINUX_VC_RUNNING_ALREADY"]);
Application::SetExitCode (0);
return false;
}
close (showFifo);
}
catch (...)
{
#ifdef DEBUG
throw;
#endif
}
// This is a false positive as VeraCrypt is not running (pipe not available)
// we continue running after cleaning the lock file
// and creating a new instance of the checker
wxString lockFileName = wxGetHomeDir();
if ( lockFileName.Last() != wxT('/') )
{
lockFileName += wxT('/');
}
lockFileName << instanceCheckerName;
if (wxRemoveFile (lockFileName))
{
SingleInstanceChecker.reset (new wxSingleInstanceChecker (instanceCheckerName));
@@ -1413,112 +1425,115 @@ namespace VeraCrypt
// Ask whether to restore internal or external backup
bool restoreInternalBackup;
wxArrayString choices;
choices.Add (LangString["HEADER_RESTORE_INTERNAL"]);
choices.Add (LangString["HEADER_RESTORE_EXTERNAL"]);
wxSingleChoiceDialog choiceDialog (parent, LangString["HEADER_RESTORE_EXTERNAL_INTERNAL"], Application::GetName(), choices);
choiceDialog.SetSize (wxSize (Gui->GetCharWidth (&choiceDialog) * 80, -1));
choiceDialog.SetSelection (0);
if (choiceDialog.ShowModal() != wxID_OK)
return;
switch (choiceDialog.GetSelection())
{
case 0:
restoreInternalBackup = true;
break;
case 1:
restoreInternalBackup = false;
break;
default:
return;
}
/* force the display of the random enriching interface */
RandomNumberGenerator::SetEnrichedByUserStatus (false);
+ bool masterKeyVulnerable = false;
if (restoreInternalBackup)
{
// Restore header from the internal backup
shared_ptr <Volume> volume;
MountOptions options;
options.Path = volumePath;
MountOptionsDialog dialog (parent, options, wxEmptyString, true);
while (!volume)
{
dialog.Hide();
if (dialog.ShowModal() != wxID_OK)
return;
try
{
wxBusyCursor busy;
OpenVolumeThreadRoutine routine(
options.Path,
options.PreserveTimestamps,
options.Password,
options.Pim,
options.Kdf,
options.Keyfiles,
options.EMVSupportEnabled,
options.Protection,
options.ProtectionPassword,
options.ProtectionPim,
options.ProtectionKdf,
options.ProtectionKeyfiles,
options.SharedAccessAllowed,
VolumeType::Unknown,
true
);
ExecuteWaitThreadRoutine (parent, &routine);
volume = routine.m_pVolume;
}
catch (PasswordException &e)
{
ShowWarning (e);
}
}
shared_ptr <VolumeLayout> layout = volume->GetLayout();
if (typeid (*layout) == typeid (VolumeLayoutV1Normal))
{
ShowError ("VOLUME_HAS_NO_BACKUP_HEADER");
return;
}
+ masterKeyVulnerable = volume->IsMasterKeyVulnerable();
+
RandomNumberGenerator::Start();
UserEnrichRandomPool (nullptr);
// Re-encrypt volume header
wxBusyCursor busy;
SecureBuffer newHeaderBuffer (volume->GetLayout()->GetHeaderSize());
ReEncryptHeaderThreadRoutine routine(newHeaderBuffer, volume->GetHeader(), options.Password, options.Pim, options.Keyfiles, options.EMVSupportEnabled);
ExecuteWaitThreadRoutine (parent, &routine);
// Write volume header
int headerOffset = volume->GetLayout()->GetHeaderOffset();
shared_ptr <File> volumeFile = volume->GetFile();
if (headerOffset >= 0)
volumeFile->SeekAt (headerOffset);
else
volumeFile->SeekEnd (headerOffset);
volumeFile->Write (newHeaderBuffer);
}
else
{
// Restore header from an external backup
wxString confirmMsg = LangString["CONFIRM_VOL_HEADER_RESTORE"];
if (!AskYesNo (wxString::Format (confirmMsg, wstring (*volumePath).c_str()), true, true))
return;
@@ -1563,115 +1578,122 @@ namespace VeraCrypt
{
wxBusyCursor busy;
// Test volume layouts
foreach (shared_ptr <VolumeLayout> layout, VolumeLayout::GetAvailableLayouts ())
{
if (layout->HasDriveHeader())
continue;
if (!legacyBackup && (typeid (*layout) == typeid (VolumeLayoutV1Normal)))
continue;
if (legacyBackup && (typeid (*layout) == typeid (VolumeLayoutV2Normal) || typeid (*layout) == typeid (VolumeLayoutV2Hidden)))
continue;
SecureBuffer headerBuffer (layout->GetHeaderSize());
backupFile.ReadAt (headerBuffer, layout->GetType() == VolumeType::Hidden ? layout->GetHeaderSize() : 0);
// Decrypt header
shared_ptr <VolumePassword> passwordKey = Keyfile::ApplyListToPassword (options.Keyfiles, options.Password, options.EMVSupportEnabled);
Pkcs5KdfList keyDerivationFunctions = layout->GetSupportedKeyDerivationFunctions();
EncryptionAlgorithmList encryptionAlgorithms = layout->GetSupportedEncryptionAlgorithms();
EncryptionModeList encryptionModes = layout->GetSupportedEncryptionModes();
DecryptThreadRoutine decryptRoutine(layout->GetHeader(), headerBuffer, *passwordKey, options.Pim, options.Kdf, keyDerivationFunctions, encryptionAlgorithms, encryptionModes);
ExecuteWaitThreadRoutine (parent, &decryptRoutine);
if (decryptRoutine.m_bResult)
{
+ masterKeyVulnerable = layout->GetHeader()->IsMasterKeyVulnerable();
decryptedLayout = layout;
break;
}
}
if (!decryptedLayout)
throw PasswordIncorrect (SRC_POS);
}
catch (PasswordException &e)
{
ShowWarning (e);
}
}
File volumeFile;
volumeFile.Open (*volumePath, File::OpenReadWrite, File::ShareNone, File::PreserveTimestamps);
RandomNumberGenerator::Start();
UserEnrichRandomPool (nullptr);
// Re-encrypt volume header
wxBusyCursor busy;
SecureBuffer newHeaderBuffer (decryptedLayout->GetHeaderSize());
ReEncryptHeaderThreadRoutine routine(newHeaderBuffer, decryptedLayout->GetHeader(), options.Password, options.Pim, options.Keyfiles, options.EMVSupportEnabled);
ExecuteWaitThreadRoutine (parent, &routine);
// Write volume header
int headerOffset = decryptedLayout->GetHeaderOffset();
if (headerOffset >= 0)
volumeFile.SeekAt (headerOffset);
else
volumeFile.SeekEnd (headerOffset);
volumeFile.Write (newHeaderBuffer);
if (decryptedLayout->HasBackupHeader())
{
// Re-encrypt backup volume header
ReEncryptHeaderThreadRoutine backupRoutine(newHeaderBuffer, decryptedLayout->GetHeader(), options.Password, options.Pim, options.Keyfiles, options.EMVSupportEnabled);
ExecuteWaitThreadRoutine (parent, &backupRoutine);
// Write backup volume header
headerOffset = decryptedLayout->GetBackupHeaderOffset();
if (headerOffset >= 0)
volumeFile.SeekAt (headerOffset);
else
volumeFile.SeekEnd (headerOffset);
volumeFile.Write (newHeaderBuffer);
}
}
ShowInfo ("VOL_HEADER_RESTORED");
+
+ // display warning if the volume master key is vulnerable
+ if (masterKeyVulnerable)
+ {
+ ShowWarning ("ERR_XTS_MASTERKEY_VULNERABLE");
+ }
}
DevicePath GraphicUserInterface::SelectDevice (wxWindow *parent) const
{
try
{
DeviceSelectionDialog dialog (parent);
if (dialog.ShowModal() == wxID_OK)
{
return dialog.SelectedDevice.Path;
}
}
catch (exception &e)
{
Gui->ShowError (e);
}
return DevicePath();
}
DirectoryPath GraphicUserInterface::SelectDirectory (wxWindow *parent, const wxString &message, bool existingOnly) const
{
/* Avoid OS leaking previously used directory when user choose not to save history */
wxString defaultPath;
if (!GetPreferences().SaveHistory)
defaultPath = wxGetHomeDir ();
return DirectoryPath (::wxDirSelector (!message.empty() ? message :
#ifdef __WXGTK__
wxDirSelectorPromptStr,
@@ -1825,60 +1847,68 @@ namespace VeraCrypt
listCtrl->DeleteAllItems();
}
else
listCtrl->GetItemRect (0, itemRect);
int headerHeight = itemRect.y;
#ifdef TC_WINDOWS
headerHeight += 4;
#elif defined (TC_MACOSX)
headerHeight += 7;
#elif defined (__WXGTK__)
headerHeight += 5;
#endif
int rowHeight = itemRect.height;
#ifdef TC_MACOSX
rowHeight += 1;
#endif
listCtrl->SetMinSize (wxSize (listCtrl->GetMinSize().GetWidth(), rowHeight * rowCount + headerHeight));
}
void GraphicUserInterface::SetListCtrlWidth (wxListCtrl *listCtrl, size_t charCount, bool hasVerticalScrollbar) const
{
int width = GetCharWidth (listCtrl) * charCount;
#ifdef TC_MACOSX
if (!hasVerticalScrollbar)
width += GetScrollbarWidth (listCtrl);
#endif
listCtrl->SetMinSize (wxSize (width, listCtrl->GetMinSize().GetHeight()));
}
+
+ void GraphicUserInterface::SetContentProtection (bool enable) const
+ {
+#if defined(TC_WINDOWS) || defined(TC_MACOSX)
+ GetActiveWindow()->SetContentProtection(enable ? wxCONTENT_PROTECTION_ENABLED : wxCONTENT_PROTECTION_NONE);
+#endif
+ }
+
void GraphicUserInterface::ShowErrorTopMost (const wxString &message) const
{
ShowMessage (message, wxOK | wxICON_ERROR, true);
}
void GraphicUserInterface::ShowInfoTopMost (const wxString &message) const
{
ShowMessage (message, wxOK | wxICON_INFORMATION, true);
}
int GraphicUserInterface::ShowMessage (const wxString &message, long style, bool topMost) const
{
wxString caption = Application::GetName();
wxString subMessage = message;
#ifdef TC_MACOSX
size_t p = message.find (L"\n");
if (p != string::npos)
{
// Divide message to caption and info message
caption = message.substr (0, p);
p = message.find_first_not_of (L'\n', p);
if (p != string::npos)
subMessage = message.substr (p);
else
subMessage.clear();
if (subMessage.EndsWith (L"?"))
{
diff --git a/src/Main/GraphicUserInterface.h b/src/Main/GraphicUserInterface.h
index d48b7973..d333551c 100644
--- a/src/Main/GraphicUserInterface.h
+++ b/src/Main/GraphicUserInterface.h
@@ -59,60 +59,61 @@ namespace VeraCrypt
virtual list <long> GetListCtrlSelectedItems (wxListCtrl *listCtrl) const;
virtual wxString GetListCtrlSubItemText (wxListCtrl *listCtrl, long itemIndex, int columnIndex) const;
virtual void ImportTokenKeyfiles () const { ThrowTextModeRequired(); }
virtual void InitSecurityTokenLibrary () const;
virtual void InsertToListCtrl (wxListCtrl *listCtrl, long itemIndex, const vector <wstring> &itemFields, int imageIndex = -1, void *itemDataPtr = nullptr) const;
virtual bool IsInBackgroundMode () const { return BackgroundMode; }
virtual bool IsTheOnlyTopLevelWindow (const wxWindow *window) const;
virtual void ListTokenKeyfiles () const;
virtual void ListSecurityTokenKeyfiles () const;
virtual void ListEMVTokenKeyfiles () const;
virtual VolumeInfoList MountAllDeviceHostedVolumes (MountOptions &options) const;
virtual shared_ptr <VolumeInfo> MountVolume (MountOptions &options) const;
virtual void MoveListCtrlItem (wxListCtrl *listCtrl, long itemIndex, long newItemIndex) const;
virtual void OnAutoDismountAllEvent ();
virtual bool OnInit ();
virtual void OnLogOff ();
virtual void OpenDocument (wxWindow *parent, const wxFileName &document);
virtual void OpenHomepageLink (wxWindow *parent, const wxString &linkId, const wxString &extraVars = wxEmptyString);
virtual void OpenOnlineHelp (wxWindow *parent);
virtual void OpenUserGuide (wxWindow *parent);
virtual void RestoreVolumeHeaders (shared_ptr <VolumePath> volumePath) const;
virtual DevicePath SelectDevice (wxWindow *parent) const;
virtual DirectoryPath SelectDirectory (wxWindow *parent, const wxString &message = wxEmptyString, bool existingOnly = true) const;
virtual FilePathList SelectFiles (wxWindow *parent, const wxString &caption, bool saveMode = false, bool allowMultiple = false, const list < pair <wstring, wstring> > &fileExtensions = (list < pair <wstring, wstring> > ()), const DirectoryPath &directory = DirectoryPath()) const;
virtual FilePath SelectVolumeFile (wxWindow *parent, bool saveMode = false, const DirectoryPath &directory = DirectoryPath()) const;
virtual void SetActiveFrame (wxFrame *frame) { ActiveFrame = frame; }
virtual void SetBackgroundMode (bool state);
virtual void SetListCtrlColumnWidths (wxListCtrl *listCtrl, list <int> columnWidthPermilles, bool hasVerticalScrollbar = true) const;
virtual void SetListCtrlHeight (wxListCtrl *listCtrl, size_t rowCount) const;
virtual void SetListCtrlWidth (wxListCtrl *listCtrl, size_t charCount, bool hasVerticalScrollbar = true) const;
+ virtual void SetContentProtection(bool enable) const;
virtual void ShowErrorTopMost (char *langStringId) const { ShowErrorTopMost (LangString[langStringId]); }
virtual void ShowErrorTopMost (const wxString &message) const;
virtual void ShowInfoTopMost (char *langStringId) const { ShowInfoTopMost (LangString[langStringId]); }
virtual void ShowInfoTopMost (const wxString &message) const;
virtual void ShowWarningTopMost (char *langStringId) const { ShowWarningTopMost (LangString[langStringId]); }
virtual void ShowWarningTopMost (const wxString &message) const;
virtual bool UpdateListCtrlItem (wxListCtrl *listCtrl, long itemIndex, const vector <wstring> &itemFields) const;
virtual void UserEnrichRandomPool (wxWindow *parent, shared_ptr <Hash> hash = shared_ptr <Hash>()) const;
virtual void Yield () const;
virtual shared_ptr <VolumeInfo> MountVolumeThread (MountOptions &options) const;
WaitDialog* GetWaitDialog () { return mWaitDialog; }
void ExecuteWaitThreadRoutine (wxWindow *parent, WaitThreadRoutine *pRoutine) const;
#ifdef TC_MACOSX
virtual void MacOpenFiles (const wxArrayString &fileNames);
virtual void MacReopenApp ();
static bool HandlePasswordEntryCustomEvent (wxEvent& event);
static void InstallPasswordEntryCustomKeyboardShortcuts (wxWindow* window);
#endif
template <class T>
T *GetSelectedData (wxControlWithItems *control) const
{
int sel = control->GetSelection();
if (sel == wxNOT_FOUND)
return nullptr;
return reinterpret_cast <T *> (control->GetClientData (sel));
}
diff --git a/src/Main/LanguageStrings.cpp b/src/Main/LanguageStrings.cpp
index 71914ec7..9a983712 100644
--- a/src/Main/LanguageStrings.cpp
+++ b/src/Main/LanguageStrings.cpp
@@ -16,53 +16,58 @@
#include "Xml.h"
namespace VeraCrypt
{
LanguageStrings::LanguageStrings ()
{
}
LanguageStrings::~LanguageStrings ()
{
}
wxString LanguageStrings::operator[] (const string &key) const
{
if (Map.count (key) > 0)
return wxString (Map.find (key)->second);
// return "VeraCrypt" as it is
if (key == "VeraCrypt")
return L"VeraCrypt";
return wxString (L"?") + StringConverter::ToWide (key) + L"?";
}
wstring LanguageStrings::Get (const string &key) const
{
return wstring (LangString[key]);
}
void LanguageStrings::Init ()
{
- static byte LanguageXml[] =
+ static uint8 LanguageXml[] =
{
# include "Common/Language.xml.h"
, 0
};
string def = string ((const char*) LanguageXml);
foreach (XmlNode node, XmlParser (def).GetNodes (L"entry"))
{
wxString text = node.InnerText;
text.Replace (L"\\n", L"\n");
Map[StringConverter::ToSingle (wstring (node.Attributes[L"key"]))] = text;
}
- foreach (XmlNode node, XmlParser (Resources::GetLanguageXml()).GetNodes (L"entry"))
+ string translatedXml = Resources::GetLanguageXml();
+ foreach (XmlNode node, XmlParser (translatedXml).GetNodes (L"entry"))
{
wxString text = node.InnerText;
text.Replace (L"\\n", L"\n");
Map[StringConverter::ToSingle (wstring (node.Attributes[L"key"]))] = text;
}
+
+ XmlNode node = XmlParser (translatedXml).GetNodes (L"language").front();
+ Map["LANGUAGE_TRANSLATORS"] = wxString (node.Attributes[L"translators"]);
+ Map["CURRENT_LANGUAGE_PACK"] = wxString (node.Attributes[L"name"]);
}
LanguageStrings LangString;
}
diff --git a/src/Main/Main.make b/src/Main/Main.make
index 84f9d755..178c4669 100755
--- a/src/Main/Main.make
+++ b/src/Main/Main.make
@@ -75,181 +75,229 @@ RESOURCES += ../Mount/Drive_icon_96dpi.bmp.h
RESOURCES += ../Mount/Drive_icon_mask_96dpi.bmp.h
RESOURCES += ../Mount/Logo_96dpi.bmp.h
endif
CXXFLAGS += -I$(BASE_DIR)/Main
#------ wxWidgets configuration ------
ifdef TC_NO_GUI
WX_CONFIG_LIBS := base
else
WX_CONFIG_LIBS := adv,core,base
endif
ifeq "$(TC_BUILD_CONFIG)" "Release"
CXXFLAGS += $(shell $(WX_CONFIG) $(WX_CONFIG_ARGS) --cxxflags)
WX_LIBS = $(shell $(WX_CONFIG) $(WX_CONFIG_ARGS) --libs $(WX_CONFIG_LIBS))
else
CXXFLAGS += $(shell $(WX_CONFIG) --debug $(WX_CONFIG_ARGS) --cxxflags)
WX_LIBS = $(shell $(WX_CONFIG) --debug $(WX_CONFIG_ARGS) --libs $(WX_CONFIG_LIBS))
endif
#------ FUSE configuration ------
-FUSE_LIBS = $(shell pkg-config fuse --libs)
+FUSE_LIBS = $(shell $(PKG_CONFIG) $(VC_FUSE_PACKAGE) --libs)
#------ Executable ------
export TC_VERSION := $(shell grep VERSION_STRING ../Common/Tcdefs.h | head -n 1 | cut -d'"' -f 2)
#------ Linux package naming ------
ifeq "$(PLATFORM)" "Linux"
ifdef TC_NO_GUI
INSTALLER_TYPE := console
ifeq "$(origin NOSSE2)" "command line"
PACKAGE_NAME := $(APPNAME)_$(TC_VERSION)_console_$(PLATFORM_ARCH)_legacy.tar.gz
else
PACKAGE_NAME := $(APPNAME)_$(TC_VERSION)_console_$(PLATFORM_ARCH).tar.gz
endif
else
INSTALLER_TYPE := gui
ifeq "$(origin NOSSE2)" "command line"
PACKAGE_NAME := $(APPNAME)_$(TC_VERSION)_$(PLATFORM_ARCH)_legacy.tar.gz
else
PACKAGE_NAME := $(APPNAME)_$(TC_VERSION)_$(PLATFORM_ARCH).tar.gz
endif
endif
+# Determine GUI/GTK conditions
+GUI_CONDITION := $(filter gui,$(INSTALLER_TYPE))
+GTK2_CONDITION := $(filter 2,$(GTK_VERSION))
+
ifeq "$(origin NOSSE2)" "command line"
INTERNAL_INSTALLER_NAME := veracrypt_install_$(INSTALLER_TYPE)_$(CPU_ARCH)_legacy.sh
+
+ifneq (,$(GUI_CONDITION))
+ifneq (,$(GTK2_CONDITION))
+INSTALLER_NAME := veracrypt-$(TC_VERSION)-setup-gtk2-gui-$(CPU_ARCH)-legacy
+else
INSTALLER_NAME := veracrypt-$(TC_VERSION)-setup-$(INSTALLER_TYPE)-$(CPU_ARCH)-legacy
+endif
+else
+INSTALLER_NAME := veracrypt-$(TC_VERSION)-setup-$(INSTALLER_TYPE)-$(CPU_ARCH)-legacy
+endif
+
else
INTERNAL_INSTALLER_NAME := veracrypt_install_$(INSTALLER_TYPE)_$(CPU_ARCH).sh
+
+ifneq (,$(GUI_CONDITION))
+ifneq (,$(GTK2_CONDITION))
+INSTALLER_NAME := veracrypt-$(TC_VERSION)-setup-gtk2-gui-$(CPU_ARCH)
+else
+INSTALLER_NAME := veracrypt-$(TC_VERSION)-setup-$(INSTALLER_TYPE)-$(CPU_ARCH)
+endif
+else
INSTALLER_NAME := veracrypt-$(TC_VERSION)-setup-$(INSTALLER_TYPE)-$(CPU_ARCH)
endif
endif
+
+endif
#-----------------------------------
#------ FreeBSD package naming ------
ifeq "$(PLATFORM)" "FreeBSD"
SYSTEMNAME = $(shell uname -n)
ifdef TC_NO_GUI
INSTALLER_TYPE := console
PACKAGE_NAME := $(APPNAME)_$(TC_VERSION)_$(SYSTEMNAME)_console_$(PLATFORM_ARCH).tar.gz
else
INSTALLER_TYPE := gui
PACKAGE_NAME := $(APPNAME)_$(TC_VERSION)_$(SYSTEMNAME)_$(PLATFORM_ARCH).tar.gz
endif
+# Determine GUI/GTK conditions
+GUI_CONDITION := $(filter gui,$(INSTALLER_TYPE))
+GTK2_CONDITION := $(filter 2,$(GTK_VERSION))
+
INTERNAL_INSTALLER_NAME := veracrypt_install_f$(SYSTEMNAME)_$(INSTALLER_TYPE)_$(CPU_ARCH).sh
+
+ifneq (,$(GUI_CONDITION))
+ifneq (,$(GTK2_CONDITION))
+INSTALLER_NAME := veracrypt-$(TC_VERSION)-$(SYSTEMNAME)-setup-gtk2-gui-$(CPU_ARCH)
+else
+INSTALLER_NAME := veracrypt-$(TC_VERSION)-$(SYSTEMNAME)-setup-$(INSTALLER_TYPE)-$(CPU_ARCH)
+endif
+else
INSTALLER_NAME := veracrypt-$(TC_VERSION)-$(SYSTEMNAME)-setup-$(INSTALLER_TYPE)-$(CPU_ARCH)
+endif
endif
#-----------------------------------
$(APPNAME): $(LIBS) $(OBJS)
@echo Linking $@
- $(CXX) -o $(APPNAME) $(OBJS) $(LIBS) $(FUSE_LIBS) $(WX_LIBS) $(LFLAGS)
+ $(CXX) -o $(APPNAME) $(OBJS) $(LIBS) $(AYATANA_LIBS) $(FUSE_LIBS) $(WX_LIBS) $(LFLAGS)
ifeq "$(TC_BUILD_CONFIG)" "Release"
ifndef NOSTRIP
strip $(APPNAME)
endif
ifndef NOTEST
./$(APPNAME) --text --test >/dev/null || exit 1
endif
ifeq "$(PLATFORM_UNSUPPORTED)" "1"
@echo; echo "WARNING: This platform may be unsupported. To avoid possible serious problems, please read the chapter pertaining to $(PLATFORM) in Readme.txt."; echo
endif
endif
ifeq "$(PLATFORM)" "MacOSX"
prepare: $(APPNAME)
mkdir -p $(APPNAME).app/Contents/MacOS $(APPNAME).app/Contents/Resources/doc/HTML
mkdir -p $(APPNAME).app/Contents/MacOS $(APPNAME).app/Contents/Resources/languages
-rm -f $(APPNAME).app/Contents/MacOS/$(APPNAME)
-rm -f $(APPNAME).app/Contents/MacOS/$(APPNAME)_console
ifeq "$(TC_BUILD_CONFIG)" "Release"
ifdef TC_NO_GUI
cp $(BASE_DIR)/Main/$(APPNAME) $(APPNAME).app/Contents/MacOS/$(APPNAME)_console
else
cp $(BASE_DIR)/Main/$(APPNAME) $(APPNAME).app/Contents/MacOS/$(APPNAME)
endif
else
ifdef TC_NO_GUI
-rm -f $(BASE_DIR)/Main/$(APPNAME)_console
cp $(BASE_DIR)/Main/$(APPNAME) $(BASE_DIR)/Main/$(APPNAME)_console
-ln -sf $(BASE_DIR)/Main/$(APPNAME)_console $(APPNAME).app/Contents/MacOS/$(APPNAME)_console
else
-ln -sf $(BASE_DIR)/Main/$(APPNAME) $(APPNAME).app/Contents/MacOS/$(APPNAME)
endif
endif
cp $(BASE_DIR)/Resources/Icons/VeraCrypt.icns $(APPNAME).app/Contents/Resources
cp $(BASE_DIR)/Resources/Icons/VeraCrypt_Volume.icns $(APPNAME).app/Contents/Resources
cp -R $(BASE_DIR)/../doc/html/* $(APPNAME).app/Contents/Resources/doc/HTML
cp $(BASE_DIR)/../Translations/* $(APPNAME).app/Contents/Resources/languages
echo -n APPLTRUE >$(APPNAME).app/Contents/PkgInfo
ifdef VC_LEGACY_BUILD
sed -e 's/_VERSION_/$(patsubst %a,%.1,$(patsubst %b,%.2,$(TC_VERSION)))/' ../Build/Resources/MacOSX/Info.plist.legacy.xml >$(APPNAME).app/Contents/Info.plist
else
sed -e 's/_VERSION_/$(patsubst %a,%.1,$(patsubst %b,%.2,$(TC_VERSION)))/' ../Build/Resources/MacOSX/Info.plist.xml >$(APPNAME).app/Contents/Info.plist
endif
chmod -R go-w $(APPNAME).app
+ifneq ("$(LOCAL_DEVELOPMENT_BUILD)","true")
codesign -s "Developer ID Application: IDRIX (Z933746L2S)" --timestamp $(APPNAME).app
+endif
install: prepare
cp -R $(APPNAME).app /Applications/.
package: prepare
ifdef VC_LEGACY_BUILD
/usr/local/bin/packagesbuild $(BASE_DIR)/Setup/MacOSX/veracrypt_Legacy.pkgproj
productsign --sign "Developer ID Installer: IDRIX (Z933746L2S)" --timestamp "$(BASE_DIR)/Setup/MacOSX/VeraCrypt Legacy $(TC_VERSION).pkg" $(BASE_DIR)/Setup/MacOSX/VeraCrypt_$(TC_VERSION).pkg
rm -f $(APPNAME)_Legacy_$(TC_VERSION).dmg
else
+ifeq "$(VC_OSX_FUSET)" "1"
+ /usr/local/bin/packagesbuild $(BASE_DIR)/Setup/MacOSX/veracrypt_fuse-t.pkgproj
+else
/usr/local/bin/packagesbuild $(BASE_DIR)/Setup/MacOSX/veracrypt.pkgproj
+endif
+ifneq ("$(LOCAL_DEVELOPMENT_BUILD)","true")
productsign --sign "Developer ID Installer: IDRIX (Z933746L2S)" --timestamp "$(BASE_DIR)/Setup/MacOSX/VeraCrypt $(TC_VERSION).pkg" $(BASE_DIR)/Setup/MacOSX/VeraCrypt_$(TC_VERSION).pkg
+else
+ # copy the unsigned package to the expected location
+ cp "$(BASE_DIR)/Setup/MacOSX/VeraCrypt $(TC_VERSION).pkg" $(BASE_DIR)/Setup/MacOSX/VeraCrypt_$(TC_VERSION).pkg
+endif
rm -f $(APPNAME)_$(TC_VERSION).dmg
endif
rm -f "$(BASE_DIR)/Setup/MacOSX/template.dmg"
rm -fr "$(BASE_DIR)/Setup/MacOSX/VeraCrypt_dmg"
mkdir -p "$(BASE_DIR)/Setup/MacOSX/VeraCrypt_dmg"
bunzip2 -k -f "$(BASE_DIR)/Setup/MacOSX/template.dmg.bz2"
hdiutil attach "$(BASE_DIR)/Setup/MacOSX/template.dmg" -noautoopen -quiet -mountpoint "$(BASE_DIR)/Setup/MacOSX/VeraCrypt_dmg"
cp "$(BASE_DIR)/Setup/MacOSX/VeraCrypt_$(TC_VERSION).pkg" "$(BASE_DIR)/Setup/MacOSX/VeraCrypt_dmg/VeraCrypt_Installer.pkg"
hdiutil detach "$(BASE_DIR)/Setup/MacOSX/VeraCrypt_dmg" -quiet -force
ifdef VC_LEGACY_BUILD
hdiutil convert "$(BASE_DIR)/Setup/MacOSX/template.dmg" -quiet -format UDZO -imagekey zlib-level=9 -o $(APPNAME)_Legacy_$(TC_VERSION).dmg
else
hdiutil convert "$(BASE_DIR)/Setup/MacOSX/template.dmg" -quiet -format UDZO -imagekey zlib-level=9 -o $(APPNAME)_$(TC_VERSION).dmg
endif
rm -f "$(BASE_DIR)/Setup/MacOSX/template.dmg"
rm -fr "$(BASE_DIR)/Setup/MacOSX/VeraCrypt_dmg"
endif
ifeq "$(PLATFORM)" "Linux"
prepare: $(APPNAME)
rm -fr $(BASE_DIR)/Setup/Linux/usr
mkdir -p $(BASE_DIR)/Setup/Linux/usr/bin
mkdir -p $(BASE_DIR)/Setup/Linux/usr/share/doc/$(APPNAME)/HTML
cp $(BASE_DIR)/Main/$(APPNAME) $(BASE_DIR)/Setup/Linux/usr/bin/$(APPNAME)
cp $(BASE_DIR)/Setup/Linux/$(APPNAME)-uninstall.sh $(BASE_DIR)/Setup/Linux/usr/bin/$(APPNAME)-uninstall.sh
chmod +x $(BASE_DIR)/Setup/Linux/usr/bin/$(APPNAME)-uninstall.sh
cp $(BASE_DIR)/License.txt $(BASE_DIR)/Setup/Linux/usr/share/doc/$(APPNAME)/License.txt
cp -R $(BASE_DIR)/../doc/html/* "$(BASE_DIR)/Setup/Linux/usr/share/doc/$(APPNAME)/HTML"
@@ -283,60 +331,62 @@ package: prepare
@echo "#!/bin/sh" > $(INTERNAL_INSTALLER_NAME)
@echo "VERSION=$(TC_VERSION)" >> $(INTERNAL_INSTALLER_NAME)
@echo "PACKAGE_TYPE=tar" >> $(INTERNAL_INSTALLER_NAME)
@echo "PACKAGE_NAME=$(PACKAGE_NAME)" >> $(INTERNAL_INSTALLER_NAME)
@echo "PACKAGE_START=1112" >> $(INTERNAL_INSTALLER_NAME)
@echo "INSTALLER_TYPE=$(INSTALLER_TYPE)" >> $(INTERNAL_INSTALLER_NAME)
@cat $(BASE_DIR)/Setup/Linux/veracrypt_install_template.sh >> $(INTERNAL_INSTALLER_NAME)
@cat $(BASE_DIR)/Setup/Linux/$(PACKAGE_NAME) >> $(INTERNAL_INSTALLER_NAME)
chmod +x $(INTERNAL_INSTALLER_NAME)
rm -fr $(BASE_DIR)/Setup/Linux/packaging
mkdir -p $(BASE_DIR)/Setup/Linux/packaging
cp $(INTERNAL_INSTALLER_NAME) $(BASE_DIR)/Setup/Linux/packaging/.
makeself $(BASE_DIR)/Setup/Linux/packaging $(BASE_DIR)/Setup/Linux/$(INSTALLER_NAME) "VeraCrypt $(TC_VERSION) Installer" ./$(INTERNAL_INSTALLER_NAME)
endif
endif
ifeq "$(PLATFORM)" "FreeBSD"
prepare: $(APPNAME)
rm -fr $(BASE_DIR)/Setup/FreeBSD/usr
mkdir -p $(BASE_DIR)/Setup/FreeBSD/usr/bin
mkdir -p $(BASE_DIR)/Setup/FreeBSD/usr/share/doc/$(APPNAME)/HTML
cp $(BASE_DIR)/Main/$(APPNAME) $(BASE_DIR)/Setup/FreeBSD/usr/bin/$(APPNAME)
cp $(BASE_DIR)/Setup/Linux/$(APPNAME)-uninstall.sh $(BASE_DIR)/Setup/FreeBSD/usr/bin/$(APPNAME)-uninstall.sh
chmod +x $(BASE_DIR)/Setup/FreeBSD/usr/bin/$(APPNAME)-uninstall.sh
cp $(BASE_DIR)/License.txt $(BASE_DIR)/Setup/FreeBSD/usr/share/doc/$(APPNAME)/License.txt
cp -R $(BASE_DIR)/../doc/html/* "$(BASE_DIR)/Setup/FreeBSD/usr/share/doc/$(APPNAME)/HTML"
+ mkdir -p $(BASE_DIR)/Setup/FreeBSD/usr/share/veracrypt/languages
+ cp -r $(BASE_DIR)/../Translations/* $(BASE_DIR)/Setup/FreeBSD/usr/share/veracrypt/languages/
ifndef TC_NO_GUI
mkdir -p $(BASE_DIR)/Setup/FreeBSD/usr/share/applications
mkdir -p $(BASE_DIR)/Setup/FreeBSD/usr/share/pixmaps
mkdir -p $(BASE_DIR)/Setup/Linux/usr/share/mime/packages
cp $(BASE_DIR)/Resources/Icons/VeraCrypt-256x256.xpm $(BASE_DIR)/Setup/FreeBSD/usr/share/pixmaps/$(APPNAME).xpm
cp $(BASE_DIR)/Setup/Linux/$(APPNAME).desktop $(BASE_DIR)/Setup/FreeBSD/usr/share/applications/$(APPNAME).desktop
cp $(BASE_DIR)/Setup/Linux/$(APPNAME).xml $(BASE_DIR)/Setup/Linux/usr/share/mime/packages/$(APPNAME).xml
endif
chown -R root:wheel $(BASE_DIR)/Setup/FreeBSD/usr
chmod -R go-w $(BASE_DIR)/Setup/FreeBSD/usr
install: prepare
ifneq "$(DESTDIR)" ""
mkdir -p $(DESTDIR)
endif
cp -R $(BASE_DIR)/Setup/FreeBSD/usr $(DESTDIR)/.
ifeq "$(TC_BUILD_CONFIG)" "Release"
package: prepare
tar cfz $(BASE_DIR)/Setup/FreeBSD/$(PACKAGE_NAME) --directory $(BASE_DIR)/Setup/FreeBSD usr
@rm -fr $(INTERNAL_INSTALLER_NAME)
@echo "#!/bin/sh" > $(INTERNAL_INSTALLER_NAME)
@echo "VERSION=$(TC_VERSION)" >> $(INTERNAL_INSTALLER_NAME)
@echo "PACKAGE_TYPE=tar" >> $(INTERNAL_INSTALLER_NAME)
@echo "PACKAGE_NAME=$(PACKAGE_NAME)" >> $(INTERNAL_INSTALLER_NAME)
@echo "PACKAGE_START=1108" >> $(INTERNAL_INSTALLER_NAME)
@echo "INSTALLER_TYPE=$(INSTALLER_TYPE)" >> $(INTERNAL_INSTALLER_NAME)
diff --git a/src/Main/Resources.cpp b/src/Main/Resources.cpp
index d9a787a5..f00c14f7 100644
--- a/src/Main/Resources.cpp
+++ b/src/Main/Resources.cpp
@@ -1,266 +1,278 @@
/*
Derived from source code of TrueCrypt 7.1a, which is
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0.
Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2017 IDRIX
and are governed by the Apache License 2.0 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 "Platform/Platform.h"
#include "Resources.h"
#ifdef TC_WINDOWS
#include "Main/resource.h"
#else
#ifdef TC_MACOSX
#include "Application.h"
#endif
#include "Platform/File.h"
#include "Platform/StringConverter.h"
#include <stdio.h>
+#include "UserPreferences.h"
#endif
namespace VeraCrypt
{
#ifdef TC_WINDOWS
static ConstBufferPtr GetWindowsResource (const wchar_t *resourceType, const wchar_t *resourceName)
{
HGLOBAL hResL;
HRSRC hRes;
hRes = FindResource (NULL, resourceName, resourceType);
throw_sys_if (!hRes);
hResL = LoadResource (NULL, hRes);
throw_sys_if (!hResL);
- const byte *resPtr = (const byte *) LockResource (hResL);
+ const uint8 *resPtr = (const uint8 *) LockResource (hResL);
throw_sys_if (!resPtr);
return ConstBufferPtr (resPtr, SizeofResource (NULL, hRes));
}
#endif // TC_WINDOWS
-
string Resources::GetLanguageXml ()
{
#ifdef TC_WINDOWS
ConstBufferPtr res = GetWindowsResource (L"XML", L"IDR_LANGUAGE");
Buffer strBuf (res.Size() + 1);
strBuf.Zero();
strBuf.CopyFrom (res);
return string (reinterpret_cast <char *> (strBuf.Ptr()));
#else
// get language from env LANG
// support: C,POSIX,
// support for e.g. german: de_DE.UTF-8, de.UTF8, de_DE, de
// not support e.g.: de@Euro
string defaultLang("en");
#if defined (TC_MACOSX)
string filenamePrefix = StringConverter::ToSingle (Application::GetExecutableDirectory()) + "/../Resources/languages/Language.";
#else
string filenamePrefix("/usr/share/veracrypt/languages/Language.");
#endif
string filenamePost(".xml");
string filename = filenamePrefix + defaultLang + filenamePost;
- if(const char* env_p = getenv("LANG")){
- string lang(env_p);
+
+ UserPreferences Preferences;
+ Preferences.Load();
+ string preferredLang = string(Preferences.Language.begin(), Preferences.Language.end());
#ifdef DEBUG
- std::cout << lang << std::endl;
+ std::cout << "Config language: " << preferredLang << std::endl;
#endif
- if ( lang.size() > 1 ){
- int found = lang.find(".");
- if ( found > 1 ){
- string langTag = lang.substr (0,found);
- string lowerLangTag(StringConverter::ToLower (langTag) );
- int foundUnderscore = lowerLangTag.find("_");
- if ( foundUnderscore > 0 ) {
- lowerLangTag.replace(foundUnderscore,1,1,'-');
- filename = filenamePrefix + lowerLangTag + filenamePost;
- FilesystemPath xml(filename);
- if (! xml.IsFile()){
- string shortLangTag = lowerLangTag.substr(0,foundUnderscore);
- filename = filenamePrefix + shortLangTag + filenamePost;
+
+ if (preferredLang == "system") {
+ if (const char *env_p = getenv("LANG")) {
+ string lang(env_p);
+#ifdef DEBUG
+ std::cout << "env $LANG: " << lang << std::endl;
+#endif
+ if (lang.size() > 1) {
+ int found = lang.find(".");
+ if (found > 1) {
+ string langTag = lang.substr(0, found);
+ string lowerLangTag(StringConverter::ToLower(langTag));
+ int foundUnderscore = lowerLangTag.find("_");
+ if (foundUnderscore > 0) {
+ lowerLangTag.replace(foundUnderscore, 1, 1, '-');
+ filename = filenamePrefix + lowerLangTag + filenamePost;
FilesystemPath xml(filename);
- if (! xml.IsFile()){
+ if (!xml.IsFile()) {
+ string shortLangTag = lowerLangTag.substr(0, foundUnderscore);
+ filename = filenamePrefix + shortLangTag + filenamePost;
+ FilesystemPath xml(filename);
+ if (!xml.IsFile()) {
+ filename = filenamePrefix + defaultLang + filenamePost;
+ }
+ }
+ } else {
+ filename = filenamePrefix + langTag + filenamePost;
+ FilesystemPath xml(filename);
+ if (!xml.IsFile()) {
filename = filenamePrefix + defaultLang + filenamePost;
}
}
- }else{
- filename = filenamePrefix + langTag + filenamePost;
+ } else {
+ string lowerLang(StringConverter::ToLower(lang));
+ filename = filenamePrefix + lowerLang + filenamePost;
FilesystemPath xml(filename);
- if (! xml.IsFile()){
- filename = filenamePrefix + defaultLang + filenamePost;
- }
- }
- }else{
- string lowerLang(StringConverter::ToLower (lang) );
- filename = filenamePrefix + lowerLang + filenamePost;
- FilesystemPath xml(filename);
- if (! xml.IsFile()){
- int foundUnderscore = lowerLang.find("_");
- if ( foundUnderscore > 0 ) {
- lowerLang.replace(foundUnderscore,1,1,'-');
- filename = filenamePrefix + lowerLang + filenamePost;
- FilesystemPath xml(filename);
- if (! xml.IsFile()){
- filename = filenamePrefix + defaultLang + filenamePost;
+ if (!xml.IsFile()) {
+ int foundUnderscore = lowerLang.find("_");
+ if (foundUnderscore > 0) {
+ lowerLang.replace(foundUnderscore, 1, 1, '-');
+ filename = filenamePrefix + lowerLang + filenamePost;
+ FilesystemPath xml(filename);
+ if (!xml.IsFile()) {
+ filename = filenamePrefix + defaultLang + filenamePost;
+ }
}
}
}
}
}
+ } else {
+ filename = filenamePrefix + preferredLang + filenamePost;
}
FilesystemPath xml(filename);
if ( xml.IsFile() ){
File file;
file.Open (xml, File::OpenRead, File::ShareRead);
- vector <byte> keyfileData (file.Length());
+ vector <uint8> keyfileData (file.Length());
BufferPtr keyfileDataBuf (&keyfileData.front(), keyfileData.size());
file.ReadCompleteBuffer (keyfileDataBuf);
file.Close();
string langxml(keyfileData.begin(), keyfileData.end());
return langxml;
}
- static byte LanguageXml[] =
+ static uint8 LanguageXml[] =
{
# include "Common/Language.xml.h"
, 0
};
return string ((const char*) LanguageXml);
#endif
}
string Resources::GetLegalNotices ()
{
#ifdef TC_WINDOWS
ConstBufferPtr res = GetWindowsResource (L"TEXT", L"IDR_LICENSE");
Buffer strBuf (res.Size() + 1);
strBuf.Zero();
strBuf.CopyFrom (res);
return string (reinterpret_cast <char *> (strBuf.Ptr()));
#else
- static byte License[] =
+ static uint8 License[] =
{
# include "License.txt.h"
, 0
};
return string ((const char*) License);
#endif
}
#ifndef TC_NO_GUI
wxBitmap Resources::GetDriveIconBitmap ()
{
#ifdef TC_WINDOWS
return wxBitmap (L"IDB_DRIVE_ICON", wxBITMAP_TYPE_BMP_RESOURCE).ConvertToImage().Resize (wxSize (16, 12), wxPoint (0, 0));
#else
- static const byte DriveIcon[] =
+ static const uint8 DriveIcon[] =
{
# include "Mount/Drive_icon_96dpi.bmp.h"
};
wxMemoryInputStream stream (DriveIcon, sizeof (DriveIcon));
return wxBitmap (wxImage (stream).Resize (wxSize (16, 12), wxPoint (0, 0)));
#endif
}
wxBitmap Resources::GetDriveIconMaskBitmap ()
{
#ifdef TC_WINDOWS
wxImage image = wxBitmap (L"IDB_DRIVE_ICON_MASK", wxBITMAP_TYPE_BMP_RESOURCE).ConvertToImage().Resize (wxSize (16, 12), wxPoint (0, 0));
return wxBitmap (image.ConvertToMono (0, 0, 0), 1);
#else
- static const byte DriveIconMask[] =
+ static const uint8 DriveIconMask[] =
{
# include "Mount/Drive_icon_mask_96dpi.bmp.h"
};
wxMemoryInputStream stream (DriveIconMask, sizeof (DriveIconMask));
wxImage image (stream);
image.Resize (wxSize (16, 12), wxPoint (0, 0));
-# ifdef __WXGTK__
+# if defined __WXGTK__ || defined TC_MACOSX
return wxBitmap (image.ConvertToMono (0, 0, 0), 1);
# else
return wxBitmap (image);
# endif
#endif
}
wxBitmap Resources::GetLogoBitmap ()
{
#ifdef TC_WINDOWS
return wxBitmap (L"IDB_LOGO", wxBITMAP_TYPE_BMP_RESOURCE);
#else
- static const byte Logo[] =
+ static const uint8 Logo[] =
{
# include "Mount/Logo_96dpi.bmp.h"
};
wxMemoryInputStream stream (Logo, sizeof (Logo));
return wxBitmap (wxImage (stream));
#endif
}
wxBitmap Resources::GetTextualLogoBitmap ()
{
#ifdef TC_WINDOWS
return wxBitmap (L"IDB_TEXTUAL_LOGO", wxBITMAP_TYPE_BMP_RESOURCE);
#else
- static const byte Logo[] =
+ static const uint8 Logo[] =
{
# include "Common/Textual_logo_96dpi.bmp.h"
};
wxMemoryInputStream stream (Logo, sizeof (Logo));
return wxBitmap (wxImage (stream));
#endif
}
wxIcon Resources::GetVeraCryptIcon ()
{
#ifdef TC_WINDOWS
return wxIcon (L"IDI_TRUECRYPT_ICON", wxBITMAP_TYPE_ICO_RESOURCE, 16, 16);
#else
# include "Resources/Icons/VeraCrypt-256x256.xpm"
return wxIcon (VeraCryptIcon256x256);
#endif
}
wxBitmap Resources::GetVolumeCreationWizardBitmap (int height)
{
#ifdef TC_WINDOWS
return wxBitmap (L"IDB_VOLUME_WIZARD_BITMAP", wxBITMAP_TYPE_BMP_RESOURCE);
#else
- static const byte VolumeWizardIcon[] =
+ static const uint8 VolumeWizardIcon[] =
{
# include "Format/VeraCrypt_Wizard.bmp.h"
};
wxMemoryInputStream stream (VolumeWizardIcon, sizeof (VolumeWizardIcon));
wxImage image (stream);
if (height != -1)
{
double scaleFactor = double (height) / double (image.GetHeight());
image.Rescale (int (image.GetWidth() * scaleFactor), int (image.GetHeight() * scaleFactor), wxIMAGE_QUALITY_HIGH);
}
return wxBitmap (image);
#endif
}
#endif // !TC_NO_GUI
}
diff --git a/src/Main/StringFormatter.h b/src/Main/StringFormatter.h
index 33a47a35..d7f64dd0 100644
--- a/src/Main/StringFormatter.h
+++ b/src/Main/StringFormatter.h
@@ -25,44 +25,47 @@ namespace VeraCrypt
StringFormatterArg (const char c) : Empty (false) { string s; s += c; StringArg = StringConverter::ToWide (s); }
StringFormatterArg (const wchar_t c) : Empty (false), Referenced (false), StringArg (c) { }
StringFormatterArg (const char *str) : Empty (false), Referenced (false), StringArg (StringConverter::ToWide (str)) { }
StringFormatterArg (const wchar_t *str) : Empty (false), Referenced (false), StringArg (str) { }
StringFormatterArg (const string &str) : Empty (false), Referenced (false), StringArg (StringConverter::ToWide (str)) { }
StringFormatterArg (const wstring &str) : Empty (false), Referenced (false), StringArg (str) { }
StringFormatterArg (const wxString &str) : Empty (false), Referenced (false), StringArg (str) { }
StringFormatterArg (int32 number) : Empty (false), Referenced (false), StringArg (StringConverter::FromNumber (number)) { }
StringFormatterArg (uint32 number) : Empty (false), Referenced (false), StringArg (StringConverter::FromNumber (number)) { }
StringFormatterArg (int64 number) : Empty (false), Referenced (false), StringArg (StringConverter::FromNumber (number)) { }
StringFormatterArg (uint64 number) : Empty (false), Referenced (false), StringArg (StringConverter::FromNumber (number)) { }
operator wxString () { Referenced = true; return StringArg; }
bool IsEmpty () const { return Empty; }
bool WasReferenced() const { return Referenced; }
protected:
bool Empty;
bool Referenced;
wxString StringArg;
};
class StringFormatter
{
public:
StringFormatter (const wxString &format, StringFormatterArg arg0 = StringFormatterArg(), StringFormatterArg arg1 = StringFormatterArg(), StringFormatterArg arg2 = StringFormatterArg(), StringFormatterArg arg3 = StringFormatterArg(), StringFormatterArg arg4 = StringFormatterArg(), StringFormatterArg arg5 = StringFormatterArg(), StringFormatterArg arg6 = StringFormatterArg(), StringFormatterArg arg7 = StringFormatterArg(), StringFormatterArg arg8 = StringFormatterArg(), StringFormatterArg arg9 = StringFormatterArg());
virtual ~StringFormatter ();
+#if (__cplusplus >= 201103L)
+ explicit
+#endif
operator wstring () const { return wstring (FormattedString); }
operator wxString () const { return FormattedString; }
operator StringFormatterArg () const { return FormattedString; }
protected:
wxString FormattedString;
private:
StringFormatter (const StringFormatter &);
StringFormatter &operator= (const StringFormatter &);
};
}
#endif // TC_HEADER_Main_StringFormatter
diff --git a/src/Main/TextUserInterface.cpp b/src/Main/TextUserInterface.cpp
index 37b346bd..bc3f6f5a 100644
--- a/src/Main/TextUserInterface.cpp
+++ b/src/Main/TextUserInterface.cpp
@@ -3,60 +3,81 @@
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0.
Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2017 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
code distribution packages.
*/
#include "System.h"
#ifdef TC_UNIX
#include <signal.h>
#include <termios.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include "Platform/Unix/Process.h"
#endif
#include <wx/platinfo.h>
#include "Common/Token.h"
#include "Common/SecurityToken.h"
#include "Common/EMVToken.h"
#include "Core/RandomNumberGenerator.h"
#include "Application.h"
#include "TextUserInterface.h"
namespace VeraCrypt
{
+ class AdminPasswordTextRequestHandler : public GetStringFunctor
+ {
+ public:
+ AdminPasswordTextRequestHandler (TextUserInterface *userInterface) : UI (userInterface) { }
+ virtual void operator() (string &passwordStr)
+ {
+ UI->ShowString (_("Enter your user password or administrator password: "));
+
+ TextUserInterface::SetTerminalEcho (false);
+ finally_do ({ TextUserInterface::SetTerminalEcho (true); });
+
+ wstring wPassword (UI->ReadInputStreamLine());
+ finally_do_arg (wstring *, &wPassword, { StringConverter::Erase (*finally_arg); });
+
+ UI->ShowString (L"\n");
+
+ StringConverter::ToSingle (wPassword, passwordStr);
+ }
+ TextUserInterface *UI;
+ };
+
TextUserInterface::TextUserInterface ()
{
#ifdef TC_UNIX
signal (SIGHUP, OnSignal);
signal (SIGINT, OnSignal);
signal (SIGQUIT, OnSignal);
signal (SIGTERM, OnSignal);
struct stat statBuf;
if (fstat (0, &statBuf) != -1)
#endif
{
FInputStream.reset (new wxFFileInputStream (stdin));
// Set fallback encoding of the stream converter to UTF-8
// to make sure we interpret multibyte symbols properly
TextInputStream.reset (new wxTextInputStream (*FInputStream, wxT(" \t"), wxConvAuto(wxFONTENCODING_UTF8)));
}
}
TextUserInterface::~TextUserInterface ()
{
try
{
if (RandomNumberGenerator::IsRunning())
RandomNumberGenerator::Stop();
}
catch (...) { }
#ifdef TC_UNIX
signal (SIGHUP, SIG_DFL);
@@ -73,61 +94,61 @@ namespace VeraCrypt
shared_ptr <KeyfileList> TextUserInterface::AskKeyfiles (const wxString &message) const
{
wxString msg = _("Enter keyfile");
if (!message.empty())
msg = message;
make_shared_auto (KeyfileList, keyfiles);
wxString s;
wxString m = msg + L" [" + _("none") + L"]: ";
while (!(s = AskString (m)).empty())
{
keyfiles->push_back (make_shared <Keyfile> (wstring (s)));
m = msg + L" [" + _("finish") + L"]: ";
}
return keyfiles;
}
shared_ptr <VolumePassword> TextUserInterface::AskPassword (const wxString &message, bool verify) const
{
wxString msg = LangString["ENTER_PASSWORD"] + L": ";
if (!message.empty())
msg = message + L": ";
SetTerminalEcho (false);
finally_do ({ TextUserInterface::SetTerminalEcho (true); });
wchar_t passwordBuf[4096];
- finally_do_arg (BufferPtr, BufferPtr (reinterpret_cast <byte *> (passwordBuf), sizeof (passwordBuf)), { finally_arg.Erase(); });
+ finally_do_arg (BufferPtr, BufferPtr (reinterpret_cast <uint8 *> (passwordBuf), sizeof (passwordBuf)), { finally_arg.Erase(); });
shared_ptr<VolumePassword> password;
bool verPhase = false;
while (true)
{
ShowString (verPhase ? wxString (_("Re-enter password: ")) : msg);
wxString passwordStr;
ReadInputStreamLine (passwordStr);
size_t length = passwordStr.size();
ShowString (L"\n");
if (!verPhase && length < 1)
{
return shared_ptr <VolumePassword>(new VolumePassword ());
}
for (size_t i = 0; i < length && i < VolumePassword::MaxSize; ++i)
{
passwordBuf[i] = (wchar_t) passwordStr[i];
const_cast <wchar_t *> (passwordStr.wc_str())[i] = L'X';
}
if (verify && verPhase)
{
shared_ptr <VolumePassword> verPassword = ToUTF8Password (passwordBuf, length, CmdLine->ArgUseLegacyPassword? VolumePassword::MaxLegacySize : VolumePassword::MaxSize);
@@ -266,60 +287,61 @@ namespace VeraCrypt
if (!volumePath)
throw UserAbort (SRC_POS);
#ifdef TC_WINDOWS
if (Core->IsVolumeMounted (*volumePath))
throw_err (LangString["DISMOUNT_FIRST"]);
#endif
ShowInfo ("EXTERNAL_VOL_HEADER_BAK_FIRST_INFO");
shared_ptr <Pkcs5Kdf> kdf;
if (CmdLine->ArgHash)
{
kdf = Pkcs5Kdf::GetAlgorithm (*CmdLine->ArgHash);
}
shared_ptr <Volume> normalVolume;
shared_ptr <Volume> hiddenVolume;
MountOptions normalVolumeMountOptions;
MountOptions hiddenVolumeMountOptions;
normalVolumeMountOptions.Path = volumePath;
hiddenVolumeMountOptions.Path = volumePath;
normalVolumeMountOptions.EMVSupportEnabled = true;
hiddenVolumeMountOptions.EMVSupportEnabled = true;
VolumeType::Enum volumeType = VolumeType::Normal;
+ bool masterKeyVulnerable = false;
// Open both types of volumes
while (true)
{
shared_ptr <Volume> volume;
MountOptions *options = (volumeType == VolumeType::Hidden ? &hiddenVolumeMountOptions : &normalVolumeMountOptions);
while (!volume)
{
ShowString (L"\n");
options->Password = AskPassword (LangString[volumeType == VolumeType::Hidden ? "ENTER_HIDDEN_VOL_PASSWORD" : "ENTER_NORMAL_VOL_PASSWORD"]);
options->Pim = AskPim (volumeType == VolumeType::Hidden ?_("Enter PIM for the hidden volume") : _("Enter PIM for the normal/outer volume"));
options->Keyfiles = AskKeyfiles();
try
{
volume = Core->OpenVolume (
options->Path,
options->PreserveTimestamps,
options->Password,
options->Pim,
kdf,
options->Keyfiles,
options->EMVSupportEnabled,
options->Protection,
options->ProtectionPassword,
options->ProtectionPim,
options->ProtectionKdf,
options->ProtectionKeyfiles,
true,
@@ -339,60 +361,67 @@ namespace VeraCrypt
options->PreserveTimestamps,
options->Password,
options->Pim,
kdf,
options->Keyfiles,
options->EMVSupportEnabled,
options->Protection,
options->ProtectionPassword,
options->ProtectionPim,
options->ProtectionKdf,
options->ProtectionKeyfiles,
true,
volumeType,
true
);
bFailed = false;
}
catch (...)
{
}
}
if (bFailed)
ShowInfo (e);
else
ShowInfo ("HEADER_DAMAGED_AUTO_USED_HEADER_BAK");
}
}
+ // check if volume master key is vulnerable
+ if (volume->IsMasterKeyVulnerable())
+ {
+ masterKeyVulnerable = true;
+ ShowWarning ("ERR_XTS_MASTERKEY_VULNERABLE");
+ }
+
if (volumeType == VolumeType::Hidden)
hiddenVolume = volume;
else
normalVolume = volume;
// Ask whether a hidden volume is present
if (volumeType == VolumeType::Normal && AskYesNo (L"\n" + LangString["DOES_VOLUME_CONTAIN_HIDDEN"]))
{
volumeType = VolumeType::Hidden;
continue;
}
break;
}
if (hiddenVolume)
{
if (typeid (*normalVolume->GetLayout()) == typeid (VolumeLayoutV1Normal))
throw ParameterIncorrect (SRC_POS);
if (typeid (*normalVolume->GetLayout()) == typeid (VolumeLayoutV2Normal) && typeid (*hiddenVolume->GetLayout()) != typeid (VolumeLayoutV2Hidden))
throw ParameterIncorrect (SRC_POS);
}
// Ask user to select backup file path
wxString confirmMsg = L"\n" + LangString["CONFIRM_VOL_HEADER_BAK"] + L"\n";
if (!AskYesNo (wxString::Format (confirmMsg, wstring (*volumePath).c_str()), true))
return;
@@ -406,60 +435,64 @@ namespace VeraCrypt
backupFile.Open (filePath, File::CreateWrite);
RandomNumberGenerator::Start();
/* force the display of the random enriching interface */
RandomNumberGenerator::SetEnrichedByUserStatus (false);
UserEnrichRandomPool();
// Re-encrypt volume header
SecureBuffer newHeaderBuffer (normalVolume->GetLayout()->GetHeaderSize());
Core->ReEncryptVolumeHeaderWithNewSalt (newHeaderBuffer, normalVolume->GetHeader(), normalVolumeMountOptions.Password, normalVolumeMountOptions.Pim, normalVolumeMountOptions.Keyfiles, normalVolumeMountOptions.EMVSupportEnabled);
backupFile.Write (newHeaderBuffer);
if (hiddenVolume)
{
// Re-encrypt hidden volume header
Core->ReEncryptVolumeHeaderWithNewSalt (newHeaderBuffer, hiddenVolume->GetHeader(), hiddenVolumeMountOptions.Password, hiddenVolumeMountOptions.Pim, hiddenVolumeMountOptions.Keyfiles, hiddenVolumeMountOptions.EMVSupportEnabled);
}
else
{
// Store random data in place of hidden volume header
shared_ptr <EncryptionAlgorithm> ea = normalVolume->GetEncryptionAlgorithm();
Core->RandomizeEncryptionAlgorithmKey (ea);
ea->Encrypt (newHeaderBuffer);
}
backupFile.Write (newHeaderBuffer);
ShowString (L"\n");
ShowInfo ("VOL_HEADER_BACKED_UP");
+
+ // display again warning that master key is vulnerable
+ if (masterKeyVulnerable)
+ ShowWarning ("ERR_XTS_MASTERKEY_VULNERABLE");
}
void TextUserInterface::ChangePassword (shared_ptr <VolumePath> volumePath, shared_ptr <VolumePassword> password, int pim, shared_ptr <Hash> currentHash, shared_ptr <KeyfileList> keyfiles, shared_ptr <VolumePassword> newPassword, int newPim, shared_ptr <KeyfileList> newKeyfiles, shared_ptr <Hash> newHash) const
{
shared_ptr <Volume> volume;
// Volume path
if (!volumePath.get())
{
if (Preferences.NonInteractive)
throw MissingArgument (SRC_POS);
volumePath = AskVolumePath ();
}
if (volumePath->IsEmpty())
throw UserAbort (SRC_POS);
bool passwordInteractive = !password.get();
bool keyfilesInteractive = !keyfiles.get();
shared_ptr<Pkcs5Kdf> kdf;
if (currentHash)
{
kdf = Pkcs5Kdf::GetAlgorithm (*currentHash);
}
while (true)
{
// Current password
@@ -484,60 +517,66 @@ namespace VeraCrypt
if (keyfilesInteractive)
{
// Ask for keyfiles only if required
try
{
keyfiles.reset (new KeyfileList);
volume = Core->OpenVolume (volumePath, Preferences.DefaultMountOptions.PreserveTimestamps, password, pim, kdf, keyfiles, true);
}
catch (PasswordException&)
{
if (!Preferences.NonInteractive)
keyfiles = AskKeyfiles ();
}
}
if (!volume.get())
volume = Core->OpenVolume (volumePath, Preferences.DefaultMountOptions.PreserveTimestamps, password, pim, kdf, keyfiles, true);
}
catch (PasswordException &e)
{
if (Preferences.NonInteractive || !passwordInteractive || !keyfilesInteractive)
throw;
ShowInfo (e);
continue;
}
break;
}
+ // display warning if volume master key is vulnerable
+ if (volume->IsMasterKeyVulnerable())
+ {
+ ShowWarning ("ERR_XTS_MASTERKEY_VULNERABLE");
+ }
+
// New password
if (!newPassword.get() && !Preferences.NonInteractive)
newPassword = AskPassword (_("Enter new password"), true);
// New PIM
if ((newPim < 0) && !Preferences.NonInteractive)
newPim = AskPim (_("Enter new PIM"));
// New keyfiles
if (!newKeyfiles.get() && !Preferences.NonInteractive)
{
if (keyfiles.get() && keyfiles->size() > 0 && AskYesNo (_("Keep current keyfiles?"), true))
newKeyfiles = keyfiles;
else
newKeyfiles = AskKeyfiles (_("Enter new keyfile"));
}
/* force the display of the random enriching interface */
RandomNumberGenerator::SetEnrichedByUserStatus (false);
UserEnrichRandomPool();
Core->ChangePassword (volume, newPassword, newPim, newKeyfiles, true,
newHash ? Pkcs5Kdf::GetAlgorithm (*newHash) : shared_ptr <Pkcs5Kdf>());
ShowInfo ("PASSWORD_CHANGED");
}
void TextUserInterface::CreateKeyfile (shared_ptr <FilePath> keyfilePath) const
{
FilePath path;
@@ -629,107 +668,120 @@ namespace VeraCrypt
File file;
file.Open (fsPath);
hostSize = file.Length();
}
else if (fsPath.IsDevice())
{
hostSize = Core->GetDeviceSize (fsPath);
}
else
{
throw_err (_("Hidden volume can be created only in an existing file or device."));
}
if (hostSize < TC_MIN_HIDDEN_VOLUME_HOST_SIZE)
throw_err (StringFormatter (_("Minimum outer volume size is {0}."), SizeToString (TC_MIN_HIDDEN_VOLUME_HOST_SIZE)));
}
uint64 minVolumeSize = options->Type == VolumeType::Hidden ? TC_MIN_HIDDEN_VOLUME_SIZE : TC_MIN_VOLUME_SIZE;
uint64 maxVolumeSize = options->Type == VolumeType::Hidden ? VolumeLayoutV2Normal().GetMaxDataSize (hostSize) - TC_MIN_FAT_FS_SIZE : TC_MAX_VOLUME_SIZE_GENERAL;
if (options->Path.IsDevice() && options->Type != VolumeType::Hidden)
{
if (options->Size != 0)
throw_err (_("Volume size cannot be changed for device-hosted volumes."));
options->Size = Core->GetDeviceSize (options->Path);
}
else
{
uint64 AvailableDiskSpace = 0;
- wxLongLong diskSpace = 0;
- wxString parentDir = wxFileName (wstring (options->Path)).GetPath();
- if (parentDir.IsEmpty())
+ if (options->Path.IsDevice())
{
- parentDir = wxT(".");
+ AvailableDiskSpace = maxVolumeSize;
}
- if (wxDirExists(parentDir) && wxGetDiskSpace (parentDir, nullptr, &diskSpace))
+ else
{
- AvailableDiskSpace = (uint64) diskSpace.GetValue ();
- if (maxVolumeSize > AvailableDiskSpace)
- maxVolumeSize = AvailableDiskSpace;
+ wxLongLong diskSpace = 0;
+ wxString parentDir = wxFileName (wstring (options->Path)).GetPath();
+ if (parentDir.IsEmpty())
+ {
+ parentDir = wxT(".");
+ }
+ if (options->Type == VolumeType::Normal && wxDirExists(parentDir) && wxGetDiskSpace (parentDir, nullptr, &diskSpace))
+ {
+ AvailableDiskSpace = (uint64) diskSpace.GetValue ();
+ if (maxVolumeSize > AvailableDiskSpace)
+ maxVolumeSize = AvailableDiskSpace;
+ }
}
if (options->Size == (uint64) (-1))
{
- if (AvailableDiskSpace)
+ if (options->Type == VolumeType::Hidden) {
+ throw_err (_("Please do not use maximum size for hidden volume. As we do not mount the outer volume to determine the available space, it is your responsibility to choose a value so that the hidden volume does not overlap the outer volume."));
+ }
+ else if (AvailableDiskSpace)
{
// caller requesting maximum size
- // we use maxVolumeSize because it is guaranteed to be less of equal to AvailableDiskSpace
+ // we use maxVolumeSize because it is guaranteed to be less or equal to AvailableDiskSpace for outer volumes
options->Size = maxVolumeSize;
}
else
{
throw_err (_("Failed to get available disk space on the selected target."));
}
}
options->Quick = false;
uint32 sectorSizeRem = options->Size % options->SectorSize;
if (sectorSizeRem != 0)
options->Size += options->SectorSize - sectorSizeRem;
while (options->Size == 0)
{
if (Preferences.NonInteractive)
throw MissingArgument (SRC_POS);
uint64 multiplier = 1024 * 1024;
- wxString sizeStr = AskString (options->Type == VolumeType::Hidden ? _("\nEnter hidden volume size (sizeK/size[M]/sizeG/sizeT/max): ") : _("\nEnter volume size (sizeK/size[M]/sizeG.sizeT/max): "));
+ wxString sizeStr = AskString (options->Type == VolumeType::Hidden ? _("\nEnter hidden volume size (sizeK/size[M]/sizeG/sizeT): ") : _("\nEnter volume size (sizeK/size[M]/sizeG.sizeT/max): "));
if (sizeStr.CmpNoCase(wxT("max")) == 0)
{
multiplier = 1;
- if (AvailableDiskSpace)
+ if (options->Type == VolumeType::Hidden) {
+ throw_err (_("Please do not use maximum size for hidden volume. As we do not mount the outer volume to determine the available space, it is your responsibility to choose a value so that the hidden volume does not overlap the outer volume."));
+ }
+ else if (AvailableDiskSpace)
{
// caller requesting maximum size
- // we use maxVolumeSize because it is guaranteed to be less of equal to AvailableDiskSpace
+ // we use maxVolumeSize because it is guaranteed to be less or equal to AvailableDiskSpace for outer volumes
options->Size = maxVolumeSize;
}
else
{
throw_err (_("Failed to get available disk space on the selected target."));
}
}
else
{
multiplier = 1024 * 1024;
size_t index = sizeStr.find_first_not_of (wxT("0123456789"));
if (index == 0)
{
continue;
}
else if (index != (size_t) wxNOT_FOUND)
{
wxString sizeSuffix = sizeStr.Mid(index);
if (sizeSuffix.CmpNoCase(wxT("K")) == 0 || sizeSuffix.CmpNoCase(wxT("KiB")) == 0)
multiplier = BYTES_PER_KB;
else if (sizeSuffix.CmpNoCase(wxT("M")) == 0 || sizeSuffix.CmpNoCase(wxT("MiB")) == 0)
multiplier = BYTES_PER_MB;
else if (sizeSuffix.CmpNoCase(wxT("G")) == 0 || sizeSuffix.CmpNoCase(wxT("GiB")) == 0)
multiplier = BYTES_PER_GB;
else if (sizeSuffix.CmpNoCase(wxT("T")) == 0 || sizeSuffix.CmpNoCase(wxT("TiB")) == 0)
multiplier = BYTES_PER_TB;
else
continue;
sizeStr = sizeStr.Left (index);
@@ -1020,165 +1072,145 @@ namespace VeraCrypt
}
#endif // TC_UNIX
ShowInfo (options->Type == VolumeType::Hidden ? "HIDVOL_FORMAT_FINISHED_HELP" : "FORMAT_FINISHED_INFO");
}
void TextUserInterface::DeleteSecurityTokenKeyfiles () const
{
shared_ptr <KeyfileList> keyfiles = AskKeyfiles();
if (keyfiles->empty())
throw UserAbort();
foreach_ref (const Keyfile &keyfile, *keyfiles)
{
SecurityToken::DeleteKeyfile (TokenKeyfilePath (FilePath (keyfile)));
}
}
void TextUserInterface::DoShowError (const wxString &message) const
{
wcerr << L"Error: " << static_cast<wstring> (message) << endl;
}
void TextUserInterface::DoShowInfo (const wxString &message) const
{
wcout << static_cast<wstring> (message) << endl;
}
void TextUserInterface::DoShowString (const wxString &str) const
{
- wcout << str.c_str();
+ wcout << str.c_str() << flush;
}
void TextUserInterface::DoShowWarning (const wxString &message) const
{
wcerr << L"Warning: " << static_cast<wstring> (message) << endl;
}
void TextUserInterface::ExportTokenKeyfile () const
{
wstring keyfilePath = AskString (_("Enter token keyfile path: "));
if (keyfilePath.empty())
throw UserAbort (SRC_POS);
shared_ptr<TokenKeyfile> tokenKeyfile = Token::getTokenKeyfile(keyfilePath);
- vector <byte> keyfileData;
+ vector <uint8> keyfileData;
tokenKeyfile->GetKeyfileData (keyfileData);
BufferPtr keyfileDataBuf (&keyfileData.front(), keyfileData.size());
finally_do_arg (BufferPtr, keyfileDataBuf, { finally_arg.Erase(); });
FilePath exportFilePath = AskFilePath();
if (exportFilePath.IsEmpty())
throw UserAbort (SRC_POS);
File keyfile;
keyfile.Open (exportFilePath, File::CreateWrite);
keyfile.Write (keyfileDataBuf);
}
shared_ptr <GetStringFunctor> TextUserInterface::GetAdminPasswordRequestHandler ()
{
- struct AdminPasswordRequestHandler : public GetStringFunctor
- {
- AdminPasswordRequestHandler (TextUserInterface *userInterface) : UI (userInterface) { }
- virtual void operator() (string &passwordStr)
- {
- UI->ShowString (_("Enter your user password or administrator password: "));
-
- TextUserInterface::SetTerminalEcho (false);
- finally_do ({ TextUserInterface::SetTerminalEcho (true); });
-
- wstring wPassword (UI->ReadInputStreamLine());
- finally_do_arg (wstring *, &wPassword, { StringConverter::Erase (*finally_arg); });
-
- UI->ShowString (L"\n");
-
- StringConverter::ToSingle (wPassword, passwordStr);
- }
- TextUserInterface *UI;
- };
-
- return shared_ptr <GetStringFunctor> (new AdminPasswordRequestHandler (this));
+ return shared_ptr <GetStringFunctor> (new AdminPasswordTextRequestHandler (this));
}
void TextUserInterface::ImportTokenKeyfiles () const
{
list <shared_ptr<TokenInfo>> tokens = Token::GetAvailableTokens();
if (tokens.empty())
throw_err (LangString ["NO_TOKENS_FOUND"]);
CK_SLOT_ID slotId;
if (tokens.size() == 1)
{
slotId = tokens.front()->SlotId;
}
else
{
foreach (const shared_ptr<TokenInfo> &token, tokens)
{
wstringstream tokenLabel;
tokenLabel << L"[" << token->SlotId << L"] " << LangString["TOKEN_SLOT_ID"].c_str() << L" " << token->SlotId << L" " << token->Label;
ShowInfo (tokenLabel.str());
}
slotId = (CK_SLOT_ID) AskSelection (tokens.back()->SlotId, tokens.front()->SlotId);
}
shared_ptr <KeyfileList> keyfiles;
if (CmdLine->ArgKeyfiles.get() && !CmdLine->ArgKeyfiles->empty())
keyfiles = CmdLine->ArgKeyfiles;
else if (!Preferences.NonInteractive)
{
keyfiles = AskKeyfiles();
if (keyfiles->empty())
throw UserAbort();
}
else
throw MissingArgument (SRC_POS);
foreach_ref (const Keyfile &keyfilePath, *keyfiles)
{
File keyfile;
keyfile.Open (keyfilePath, File::OpenRead, File::ShareReadWrite, File::PreserveTimestamps);
if (keyfile.Length() > 0)
{
- vector <byte> keyfileData (keyfile.Length());
+ vector <uint8> keyfileData (keyfile.Length());
BufferPtr keyfileDataBuf (&keyfileData.front(), keyfileData.size());
keyfile.ReadCompleteBuffer (keyfileDataBuf);
finally_do_arg (BufferPtr, keyfileDataBuf, { finally_arg.Erase(); });
SecurityToken::CreateKeyfile (slotId, keyfileData, string (FilePath (keyfilePath).ToBaseName()));
}
else
throw InsufficientData (SRC_POS, FilePath (keyfilePath));
}
}
void TextUserInterface::InitSecurityTokenLibrary () const
{
if (Preferences.SecurityTokenModule.IsEmpty())
throw_err (LangString ["NO_PKCS11_MODULE_SPECIFIED"]);
struct PinRequestHandler : public GetPinFunctor
{
PinRequestHandler (const TextUserInterface *userInterface) : UI (userInterface) { }
virtual void operator() (string &passwordStr)
{
if (CmdLine->ArgTokenPin && CmdLine->ArgTokenPin->IsAllocated ())
{
passwordStr.clear();
passwordStr.insert (0, (char*) CmdLine->ArgTokenPin->Ptr (), CmdLine->ArgTokenPin->Size());
return;
}
@@ -1375,61 +1407,60 @@ namespace VeraCrypt
{
// Try to mount the volume using the backup header
options.UseBackupHeaders = true;
try
{
volume = UserInterface::MountVolume (options);
ShowWarning ("HEADER_DAMAGED_AUTO_USED_HEADER_BAK");
}
catch (...)
{
options.UseBackupHeaders = false;
ShowInfo (e);
options.Password.reset();
options.Pim = -1;
}
}
else
{
ShowInfo (e);
options.Password.reset();
options.Pim = -1;
}
ShowString (L"\n");
}
catch (PasswordException &e)
{
ShowInfo (e);
options.Password.reset();
- options.Pim = -1;
}
}
#ifdef TC_LINUX
if (!Preferences.NonInteractive && !Preferences.DisableKernelEncryptionModeWarning
&& volume->EncryptionModeName != L"XTS")
{
ShowWarning (LangString["ENCRYPTION_MODE_NOT_SUPPORTED_BY_KERNEL"]);
}
#endif
return volume;
}
bool TextUserInterface::OnInit ()
{
try
{
DefaultMessageOutput = new wxMessageOutputStderr;
wxMessageOutput::Set (DefaultMessageOutput);
InterfaceType = UserInterfaceType::Text;
Init();
}
catch (exception &e)
{
ShowError (e);
return false;
}
return true;
@@ -1499,107 +1530,110 @@ namespace VeraCrypt
// Ask whether to restore internal or external backup
bool restoreInternalBackup;
shared_ptr <Pkcs5Kdf> kdf;
if (CmdLine->ArgHash)
{
kdf = Pkcs5Kdf::GetAlgorithm (*CmdLine->ArgHash);
}
ShowInfo (LangString["HEADER_RESTORE_EXTERNAL_INTERNAL"]);
ShowInfo (L"\n1) " + LangString["HEADER_RESTORE_INTERNAL"]);
ShowInfo (L"2) " + LangString["HEADER_RESTORE_EXTERNAL"] + L"\n");
switch (AskSelection (2))
{
case 1:
restoreInternalBackup = true;
break;
case 2:
restoreInternalBackup = false;
break;
default:
throw UserAbort (SRC_POS);
}
/* force the display of the random enriching interface */
RandomNumberGenerator::SetEnrichedByUserStatus (false);
+ bool masterKeyVulnerable = false;
if (restoreInternalBackup)
{
// Restore header from the internal backup
shared_ptr <Volume> volume;
MountOptions options;
options.Path = volumePath;
options.EMVSupportEnabled = true;
while (!volume)
{
ShowString (L"\n");
options.Password = AskPassword();
options.Pim = AskPim();
options.Keyfiles = AskKeyfiles();
try
{
volume = Core->OpenVolume (
options.Path,
options.PreserveTimestamps,
options.Password,
options.Pim,
kdf,
options.Keyfiles,
options.EMVSupportEnabled,
options.Protection,
options.ProtectionPassword,
options.ProtectionPim,
options.ProtectionKdf,
options.ProtectionKeyfiles,
options.SharedAccessAllowed,
VolumeType::Unknown,
true
);
}
catch (PasswordException &e)
{
ShowInfo (e);
}
}
shared_ptr <VolumeLayout> layout = volume->GetLayout();
if (typeid (*layout) == typeid (VolumeLayoutV1Normal))
{
throw_err (LangString ["VOLUME_HAS_NO_BACKUP_HEADER"]);
}
+ masterKeyVulnerable = volume->IsMasterKeyVulnerable();
+
RandomNumberGenerator::Start();
UserEnrichRandomPool();
// Re-encrypt volume header
SecureBuffer newHeaderBuffer (volume->GetLayout()->GetHeaderSize());
Core->ReEncryptVolumeHeaderWithNewSalt (newHeaderBuffer, volume->GetHeader(), options.Password, options.Pim, options.Keyfiles, options.EMVSupportEnabled);
// Write volume header
int headerOffset = volume->GetLayout()->GetHeaderOffset();
shared_ptr <File> volumeFile = volume->GetFile();
if (headerOffset >= 0)
volumeFile->SeekAt (headerOffset);
else
volumeFile->SeekEnd (headerOffset);
volumeFile->Write (newHeaderBuffer);
}
else
{
// Restore header from an external backup
wxString confirmMsg = L"\n\n" + LangString["CONFIRM_VOL_HEADER_RESTORE"];
if (!AskYesNo (wxString::Format (confirmMsg, wstring (*volumePath).c_str()), true, true))
return;
ShowString (L"\n");
FilePath filePath = AskFilePath();
@@ -1633,110 +1667,116 @@ namespace VeraCrypt
shared_ptr <VolumeLayout> decryptedLayout;
while (!decryptedLayout)
{
options.Password = AskPassword (L"\n" + LangString["ENTER_HEADER_BACKUP_PASSWORD"]);
options.Pim = AskPim (_("Enter PIM"));
options.Keyfiles = AskKeyfiles();
try
{
// Test volume layouts
foreach (shared_ptr <VolumeLayout> layout, VolumeLayout::GetAvailableLayouts ())
{
if (layout->HasDriveHeader())
continue;
if (!legacyBackup && (typeid (*layout) == typeid (VolumeLayoutV1Normal)))
continue;
if (legacyBackup && (typeid (*layout) == typeid (VolumeLayoutV2Normal) || typeid (*layout) == typeid (VolumeLayoutV2Hidden)))
continue;
SecureBuffer headerBuffer (layout->GetHeaderSize());
backupFile.ReadAt (headerBuffer, layout->GetType() == VolumeType::Hidden ? layout->GetHeaderSize() : 0);
// Decrypt header
shared_ptr <VolumePassword> passwordKey = Keyfile::ApplyListToPassword (options.Keyfiles, options.Password, options.EMVSupportEnabled);
if (layout->GetHeader()->Decrypt (headerBuffer, *passwordKey, options.Pim, kdf, layout->GetSupportedKeyDerivationFunctions(), layout->GetSupportedEncryptionAlgorithms(), layout->GetSupportedEncryptionModes()))
{
decryptedLayout = layout;
+ masterKeyVulnerable = layout->GetHeader()->IsMasterKeyVulnerable();
break;
}
}
if (!decryptedLayout)
throw PasswordIncorrect (SRC_POS);
}
catch (PasswordException &e)
{
ShowWarning (e);
}
}
File volumeFile;
volumeFile.Open (*volumePath, File::OpenReadWrite, File::ShareNone, File::PreserveTimestamps);
RandomNumberGenerator::Start();
UserEnrichRandomPool();
// Re-encrypt volume header
SecureBuffer newHeaderBuffer (decryptedLayout->GetHeaderSize());
Core->ReEncryptVolumeHeaderWithNewSalt (newHeaderBuffer, decryptedLayout->GetHeader(), options.Password, options.Pim, options.Keyfiles, options.EMVSupportEnabled);
// Write volume header
int headerOffset = decryptedLayout->GetHeaderOffset();
if (headerOffset >= 0)
volumeFile.SeekAt (headerOffset);
else
volumeFile.SeekEnd (headerOffset);
volumeFile.Write (newHeaderBuffer);
if (decryptedLayout->HasBackupHeader())
{
// Re-encrypt backup volume header
Core->ReEncryptVolumeHeaderWithNewSalt (newHeaderBuffer, decryptedLayout->GetHeader(), options.Password, options.Pim, options.Keyfiles, options.EMVSupportEnabled);
// Write backup volume header
headerOffset = decryptedLayout->GetBackupHeaderOffset();
if (headerOffset >= 0)
volumeFile.SeekAt (headerOffset);
else
volumeFile.SeekEnd (headerOffset);
volumeFile.Write (newHeaderBuffer);
}
}
ShowString (L"\n");
ShowInfo ("VOL_HEADER_RESTORED");
+ // display warning if the volume master key is vulnerable
+ if (masterKeyVulnerable)
+ {
+ ShowWarning ("ERR_XTS_MASTERKEY_VULNERABLE");
+ }
}
void TextUserInterface::SetTerminalEcho (bool enable)
{
if (CmdLine->ArgDisplayPassword)
return;
#ifdef TC_UNIX
struct termios termAttr;
if (tcgetattr (0, &termAttr) == 0)
{
if (!enable)
{
termAttr.c_lflag &= ~ECHO;
throw_sys_if (tcsetattr (0, TCSANOW, &termAttr) != 0);
}
else
{
termAttr.c_lflag |= ECHO;
throw_sys_if (tcsetattr (0, TCSANOW, &termAttr) != 0);
}
}
#endif
}
void TextUserInterface::UserEnrichRandomPool () const
{
RandomNumberGenerator::Start();
if (RandomNumberGenerator::IsEnrichedByUser())
@@ -1745,45 +1785,45 @@ namespace VeraCrypt
if (CmdLine->ArgHash)
RandomNumberGenerator::SetHash (CmdLine->ArgHash);
if (!CmdLine->ArgRandomSourcePath.IsEmpty())
{
SecureBuffer buffer (RandomNumberGenerator::PoolSize);
File randSourceFile;
randSourceFile.Open (CmdLine->ArgRandomSourcePath, File::OpenRead);
for (size_t i = 0; i < buffer.Size(); ++i)
{
if (randSourceFile.Read (buffer.GetRange (i, 1)) < 1)
break;
}
RandomNumberGenerator::AddToPool (buffer);
RandomNumberGenerator::SetEnrichedByUserStatus (true);
}
else if (!Preferences.NonInteractive)
{
int randCharsRequired = RandomNumberGenerator::PoolSize;
ShowInfo (StringFormatter (_("\nPlease type at least {0} randomly chosen characters and then press Enter:"), randCharsRequired));
SetTerminalEcho (false);
finally_do ({ TextUserInterface::SetTerminalEcho (true); });
while (randCharsRequired > 0)
{
wstring randStr = AskString();
- RandomNumberGenerator::AddToPool (ConstBufferPtr ((byte *) randStr.c_str(), randStr.size() * sizeof (wchar_t)));
+ RandomNumberGenerator::AddToPool (ConstBufferPtr ((uint8 *) randStr.c_str(), randStr.size() * sizeof (wchar_t)));
randCharsRequired -= randStr.size();
if (randCharsRequired > 0)
ShowInfo (StringFormatter (_("Characters remaining: {0}"), randCharsRequired));
}
ShowString (L"\n");
RandomNumberGenerator::SetEnrichedByUserStatus (true);
}
}
wxMessageOutput *DefaultMessageOutput;
}
diff --git a/src/Main/TextUserInterface.h b/src/Main/TextUserInterface.h
index becb1d59..34a7cb40 100644
--- a/src/Main/TextUserInterface.h
+++ b/src/Main/TextUserInterface.h
@@ -1,54 +1,56 @@
/*
Derived from source code of TrueCrypt 7.1a, which is
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0.
Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2017 IDRIX
and are governed by the Apache License 2.0 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_TextUserInterface
#define TC_HEADER_Main_TextUserInterface
#include "System.h"
#include "Main.h"
#include "UserInterface.h"
namespace VeraCrypt
{
+ class AdminPasswordTextRequestHandler;
class TextUserInterface : public UserInterface
{
public:
+ friend class AdminPasswordTextRequestHandler;
TextUserInterface ();
virtual ~TextUserInterface ();
virtual FilePath AskFilePath (const wxString &message = wxEmptyString) const;
virtual shared_ptr <KeyfileList> AskKeyfiles (const wxString &message = L"") const;
virtual shared_ptr <VolumePassword> AskPassword (const wxString &message = L"", bool verify = false) const;
virtual int AskPim (const wxString &message = L"") const;
virtual ssize_t AskSelection (ssize_t optionCount, ssize_t defaultOption = -1) const;
virtual wstring AskString (const wxString &message = wxEmptyString) const;
virtual shared_ptr <VolumePath> AskVolumePath (const wxString &message = L"") const;
virtual bool AskYesNo (const wxString &message, bool defaultYes = false, bool warning = false) const;
virtual void BackupVolumeHeaders (shared_ptr <VolumePath> volumePath) const;
virtual void BeginBusyState () const { }
virtual void ChangePassword (shared_ptr <VolumePath> volumePath = shared_ptr <VolumePath>(), shared_ptr <VolumePassword> password = shared_ptr <VolumePassword>(), int pim = 0, shared_ptr <Hash> currentHash = shared_ptr <Hash>(), shared_ptr <KeyfileList> keyfiles = shared_ptr <KeyfileList>(), shared_ptr <VolumePassword> newPassword = shared_ptr <VolumePassword>(), int newPim = 0, shared_ptr <KeyfileList> newKeyfiles = shared_ptr <KeyfileList>(), shared_ptr <Hash> newHash = shared_ptr <Hash>()) const;
virtual void CreateKeyfile (shared_ptr <FilePath> keyfilePath = shared_ptr <FilePath>()) const;
virtual void CreateVolume (shared_ptr <VolumeCreationOptions> options) const;
virtual void DeleteSecurityTokenKeyfiles () const;
virtual void DoShowError (const wxString &message) const;
virtual void DoShowInfo (const wxString &message) const;
virtual void DoShowString (const wxString &str) const;
virtual void DoShowWarning (const wxString &message) const;
virtual void EndBusyState () const { }
virtual void ExportTokenKeyfile () const;
virtual shared_ptr <GetStringFunctor> GetAdminPasswordRequestHandler ();
virtual void ImportTokenKeyfiles () const;
#ifndef TC_NO_GUI
virtual bool Initialize (int &argc, wxChar **argv) { return wxAppBase::Initialize(argc, argv); }
#endif
virtual void InitSecurityTokenLibrary () const;
virtual void ListTokenKeyfiles () const;
diff --git a/src/Main/Unix/Main.cpp b/src/Main/Unix/Main.cpp
index 39a2eaba..ffc71a8d 100644
--- a/src/Main/Unix/Main.cpp
+++ b/src/Main/Unix/Main.cpp
@@ -49,61 +49,61 @@ int main (int argc, char **argv)
try
{
CoreService::ProcessElevatedRequests();
return 0;
}
catch (exception &e)
{
#ifdef DEBUG
SystemLog::WriteException (e);
#endif
}
catch (...) { }
return 1;
}
// Start core service
CoreService::Start();
finally_do ({ CoreService::Stop(); });
// Start encryption thread pool
EncryptionThreadPool::Start();
finally_do ({ EncryptionThreadPool::Stop(); });
#ifdef TC_NO_GUI
bool forceTextUI = true;
#else
bool forceTextUI = false;
#endif
#ifdef __WXGTK__
- if (!getenv ("DISPLAY"))
+ if (!getenv ("DISPLAY") && !getenv ("WAYLAND_DISPLAY"))
forceTextUI = true;
#endif
// Initialize application
if (forceTextUI || (argc > 1 && (strcmp (argv[1], "-t") == 0 || strcmp (argv[1], "--text") == 0)))
{
Application::Initialize (UserInterfaceType::Text);
}
else
{
#if defined (TC_MACOSX) && !defined (TC_NO_GUI)
if (argc > 1 && !(argc == 2 && strstr (argv[1], "-psn_") == argv[1]))
{
ProcessSerialNumber p;
if (GetCurrentProcess (&p) == noErr)
{
TransformProcessType (&p, kProcessTransformToForegroundApplication);
SetFrontProcess (&p);
}
}
#endif
Application::Initialize (UserInterfaceType::Graphic);
}
Application::SetExitCode (1);
// Start application
if (::wxEntry (argc, argv) == 0)
Application::SetExitCode (0);
}
diff --git a/src/Main/UserInterface.cpp b/src/Main/UserInterface.cpp
index 822c53c7..ad2f22b8 100644
--- a/src/Main/UserInterface.cpp
+++ b/src/Main/UserInterface.cpp
@@ -5,60 +5,69 @@
Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2017 IDRIX
and are governed by the Apache License 2.0 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 <set>
#include <typeinfo>
#include <wx/apptrait.h>
#include <wx/cmdline.h>
#include "Crypto/cpu.h"
#include "Platform/PlatformTest.h"
#include "Common/PCSCException.h"
#ifdef TC_UNIX
#include <errno.h>
#include "Platform/Unix/Process.h"
#endif
#include "Platform/SystemInfo.h"
#include "Platform/SystemException.h"
#include "Common/SecurityToken.h"
#include "Volume/EncryptionTest.h"
#include "Application.h"
#include "FavoriteVolume.h"
#include "UserInterface.h"
namespace VeraCrypt
{
+ class AdminPasswordRequestHandler : public GetStringFunctor
+ {
+ public:
+ virtual void operator() (string &str)
+ {
+ throw ElevationFailed (SRC_POS, "sudo", 1, "");
+ }
+ };
+
UserInterface::UserInterface ()
{
}
UserInterface::~UserInterface ()
{
Core->WarningEvent.Disconnect (this);
Core->VolumeMountedEvent.Disconnect (this);
try
{
if (SecurityToken::IsInitialized())
SecurityToken::CloseLibrary();
}
catch (...) { }
}
void UserInterface::CheckRequirementsForMountingVolume () const
{
#ifdef TC_LINUX
if (!Preferences.NonInteractive)
{
if (!SystemInfo::IsVersionAtLeast (2, 6, 24))
ShowWarning (LangString["LINUX_KERNEL_OLD"]);
}
#endif // TC_LINUX
}
void UserInterface::CloseExplorerWindows (shared_ptr <VolumeInfo> mountedVolume) const
{
@@ -363,61 +372,61 @@ namespace VeraCrypt
size_t pos = typeName.find ("VeraCrypt::");
if (pos != string::npos)
{
return StringConverter::ToWide (typeName.substr (pos + string ("VeraCrypt::").size()))
+ L" at " + StringConverter::ToWide (ex.what());
}
return StringConverter::ToWide (typeName) + L" at " + StringConverter::ToWide (ex.what());
}
wxString UserInterface::ExceptionToString (const Exception &ex)
{
// Error messages
const ErrorMessage *errMsgEx = dynamic_cast <const ErrorMessage *> (&ex);
if (errMsgEx)
return wstring (*errMsgEx).c_str();
// ExecutedProcessFailed
const ExecutedProcessFailed *execEx = dynamic_cast <const ExecutedProcessFailed *> (&ex);
if (execEx)
{
wstring errOutput;
// ElevationFailed
if (dynamic_cast <const ElevationFailed*> (&ex))
errOutput += wxString (LangString["LINUX_CANT_GET_ADMIN_PRIV"]) + (StringConverter::Trim (execEx->GetErrorOutput()).empty() ? L". " : L": ");
errOutput += StringConverter::ToWide (execEx->GetErrorOutput());
if (errOutput.empty())
- return errOutput + StringFormatter (LangString["LINUX_COMMAND_GET_ERROR"], execEx->GetCommand(), execEx->GetExitCode());
+ return errOutput + static_cast<wstring>(StringFormatter (LangString["LINUX_COMMAND_GET_ERROR"], execEx->GetCommand(), execEx->GetExitCode()));
return wxString (errOutput).Trim (true);
}
// PasswordIncorrect
if (dynamic_cast <const PasswordException *> (&ex))
{
wxString message = ExceptionTypeToString (typeid (ex));
#ifndef TC_NO_GUI
if (Application::GetUserInterfaceType() == UserInterfaceType::Graphic && wxGetKeyState (WXK_CAPITAL))
message += wxString (L"\n\n") + LangString["CAPSLOCK_ON"];
#endif
if (Keyfile::WasHiddenFilePresentInKeyfilePath())
{
#ifdef TC_UNIX
message += LangString["LINUX_HIDDEN_FILES_PRESENT_IN_KEYFILE_PATH"];
#else
message += LangString["HIDDEN_FILES_PRESENT_IN_KEYFILE_PATH"];
#endif
}
return message;
}
// PKCS#11 Exception
if (dynamic_cast <const Pkcs11Exception *> (&ex))
{
string errorString = string (dynamic_cast <const Pkcs11Exception &> (ex));
@@ -483,116 +492,108 @@ namespace VeraCrypt
EX2MSG (NoDriveLetterAvailable, LangString["NO_FREE_DRIVES"]);
EX2MSG (PasswordEmpty, LangString["LINUX_EX2MSG_PASSWORDEMPTY"]);
EX2MSG (PasswordIncorrect, LangString["PASSWORD_WRONG"]);
EX2MSG (PasswordKeyfilesIncorrect, LangString["PASSWORD_OR_KEYFILE_WRONG"]);
EX2MSG (PasswordOrKeyboardLayoutIncorrect, LangString["PASSWORD_OR_KEYFILE_WRONG"] + LangString["LINUX_EX2MSG_PASSWORDORKEYBOARDLAYOUTINCORRECT"]);
EX2MSG (PasswordOrMountOptionsIncorrect, LangString["PASSWORD_OR_KEYFILE_OR_MODE_WRONG"] + LangString["LINUX_EX2MSG_PASSWORDORMOUNTOPTIONSINCORRECT"]);
EX2MSG (PasswordTooLong, StringFormatter (LangString["LINUX_EX2MSG_PASSWORDTOOLONG"], (int) VolumePassword::MaxSize));
EX2MSG (PasswordUTF8TooLong, LangString["PASSWORD_UTF8_TOO_LONG"]);
EX2MSG (PasswordLegacyUTF8TooLong, LangString["LEGACY_PASSWORD_UTF8_TOO_LONG"]);
EX2MSG (PasswordUTF8Invalid, LangString["PASSWORD_UTF8_INVALID"]);
EX2MSG (PartitionDeviceRequired, LangString["LINUX_EX2MSG_PARTITIONDEVICEREQUIRED"]);
EX2MSG (ProtectionPasswordIncorrect, LangString["LINUX_EX2MSG_PROTECTIONPASSWORDINCORRECT"]);
EX2MSG (ProtectionPasswordKeyfilesIncorrect, LangString["LINUX_EX2MSG_PROTECTIONPASSWORDKEYFILESINCORRECT"]);
EX2MSG (RootDeviceUnavailable, LangString["NODRIVER"]);
EX2MSG (SecurityTokenKeyfileAlreadyExists, LangString["TOKEN_KEYFILE_ALREADY_EXISTS"]);
EX2MSG (SecurityTokenKeyfileNotFound, LangString["TOKEN_KEYFILE_NOT_FOUND"]);
EX2MSG (SecurityTokenLibraryNotInitialized, LangString["PKCS11_MODULE_INIT_FAILED"]);
EX2MSG (StringConversionFailed, LangString["LINUX_EX2MSG_STRINGCONVERSIONFAILED"]);
EX2MSG (StringFormatterException, LangString["LINUX_EX2MSG_STRINGFORMATTEREXCEPTION"]);
EX2MSG (TemporaryDirectoryFailure, LangString["LINUX_EX2MSG_TEMPORARYDIRECTORYFAILURE"]);
EX2MSG (UnportablePassword, LangString["UNSUPPORTED_CHARS_IN_PWD"]);
EX2MSG (CommandAPDUNotValid, LangString["COMMAND_APDU_INVALID"]);
EX2MSG (ExtendedAPDUNotSupported, LangString["EXTENDED_APDU_UNSUPPORTED"]);
EX2MSG (ScardLibraryInitializationFailed, LangString["SCARD_MODULE_INIT_FAILED"]);
EX2MSG (EMVUnknownCardType, LangString["EMV_UNKNOWN_CARD_TYPE"]);
EX2MSG (EMVSelectAIDFailed, LangString["EMV_SELECT_AID_FAILED"]);
EX2MSG (EMVIccCertNotFound, LangString["EMV_ICC_CERT_NOTFOUND"]);
EX2MSG (EMVIssuerCertNotFound, LangString["EMV_ISSUER_CERT_NOTFOUND"]);
EX2MSG (EMVCPLCNotFound, LangString["EMV_CPLC_NOTFOUND"]);
- EX2MSG (InvalidEMVPath, LangString["EMV_PAN_NOTFOUND"]);
- EX2MSG (EMVKeyfileDataNotFound, LangString["INVALID_EMV_PATH"]);
- EX2MSG (EMVPANNotFound, LangString["EMV_KEYFILE_DATA_NOTFOUND"]);
+ EX2MSG (InvalidEMVPath, LangString["INVALID_EMV_PATH"]);
+ EX2MSG (EMVKeyfileDataNotFound, LangString["EMV_KEYFILE_DATA_NOTFOUND"]);
+ EX2MSG (EMVPANNotFound, LangString["EMV_PAN_NOTFOUND"]);
#if defined (TC_LINUX)
EX2MSG (TerminalNotFound, LangString["LINUX_EX2MSG_TERMINALNOTFOUND"]);
EX2MSG (UnsupportedSectorSize, LangString["SECTOR_SIZE_UNSUPPORTED"]);
EX2MSG (UnsupportedSectorSizeHiddenVolumeProtection, LangString["LINUX_EX2MSG_UNSUPPORTEDSECTORSIZEHIDDENVOLUMEPROTECTION"]);
EX2MSG (UnsupportedSectorSizeNoKernelCrypto, LangString["LINUX_EX2MSG_UNSUPPORTEDSECTORSIZENOKERNELCRYPTO"]);
#else
EX2MSG (UnsupportedSectorSize, LangString["LINUX_EX2MSG_UNSUPPORTEDSECTORSIZE"]);
#endif
EX2MSG (VolumeAlreadyMounted, LangString["VOL_ALREADY_MOUNTED"]);
EX2MSG (VolumeEncryptionNotCompleted, LangString["ERR_ENCRYPTION_NOT_COMPLETED"]);
EX2MSG (VolumeHostInUse, LangString["LINUX_EX2MSG_VOLUMEHOSTINUSE"]);
EX2MSG (VolumeSlotUnavailable, LangString["LINUX_EX2MSG_VOLUMESLOTUNAVAILABLE"]);
#ifdef TC_MACOSX
EX2MSG (HigherFuseVersionRequired, LangString["LINUX_EX2MSG_HIGHERFUSEVERSIONREQUIRED"]);
#endif
#undef EX2MSG
return L"";
}
void UserInterface::Init ()
{
SetAppName (Application::GetName());
SetClassName (Application::GetName());
#ifdef CRYPTOPP_CPUID_AVAILABLE
DetectX86Features ();
#endif
LangString.Init();
Core->Init();
CmdLine.reset (new CommandLineInterface (argc, argv, InterfaceType));
SetPreferences (CmdLine->Preferences);
Core->SetApplicationExecutablePath (Application::GetExecutablePath());
if (!Preferences.NonInteractive)
{
Core->SetAdminPasswordCallback (GetAdminPasswordRequestHandler());
}
else
{
- struct AdminPasswordRequestHandler : public GetStringFunctor
- {
- virtual void operator() (string &str)
- {
- throw ElevationFailed (SRC_POS, "sudo", 1, "");
- }
- };
-
Core->SetAdminPasswordCallback (shared_ptr <GetStringFunctor> (new AdminPasswordRequestHandler));
}
#if defined(TC_LINUX ) || defined (TC_FREEBSD)
Core->ForceUseDummySudoPassword (CmdLine->ArgUseDummySudoPassword);
#endif
Core->WarningEvent.Connect (EventConnector <UserInterface> (this, &UserInterface::OnWarning));
Core->VolumeMountedEvent.Connect (EventConnector <UserInterface> (this, &UserInterface::OnVolumeMounted));
if (!CmdLine->Preferences.SecurityTokenModule.IsEmpty() && !SecurityToken::IsInitialized())
{
try
{
InitSecurityTokenLibrary();
}
catch (exception &e)
{
if (Preferences.NonInteractive)
throw;
ShowError (e);
}
}
}
void UserInterface::ListMountedVolumes (const VolumeInfoList &volumes) const
{
if (volumes.size() < 1)
throw_err (LangString["NO_VOLUMES_MOUNTED"]);
@@ -624,213 +625,230 @@ namespace VeraCrypt
BusyScope busy (this);
VolumeInfoList newMountedVolumes;
if (!options.MountPoint)
options.MountPoint.reset (new DirectoryPath);
Core->CoalesceSlotNumberAndMountPoint (options);
bool sharedAccessAllowed = options.SharedAccessAllowed;
bool someVolumesShared = false;
HostDeviceList devices;
foreach (shared_ptr <HostDevice> device, Core->GetHostDevices (true))
{
if (device->Partitions.empty())
devices.push_back (device);
else
{
foreach (shared_ptr <HostDevice> partition, device->Partitions)
devices.push_back (partition);
}
}
set <wstring> mountedVolumes;
foreach_ref (const VolumeInfo &v, Core->GetMountedVolumes())
mountedVolumes.insert (v.Path);
bool protectedVolumeMounted = false;
bool legacyVolumeMounted = false;
+ bool vulnerableVolumeMounted = false;
foreach_ref (const HostDevice &device, devices)
{
if (mountedVolumes.find (wstring (device.Path)) != mountedVolumes.end())
continue;
Yield();
options.SlotNumber = Core->GetFirstFreeSlotNumber (options.SlotNumber);
options.MountPoint.reset (new DirectoryPath);
options.Path.reset (new VolumePath (device.Path));
try
{
try
{
options.SharedAccessAllowed = sharedAccessAllowed;
newMountedVolumes.push_back (Core->MountVolume (options));
}
catch (VolumeHostInUse&)
{
if (!sharedAccessAllowed)
{
try
{
options.SharedAccessAllowed = true;
newMountedVolumes.push_back (Core->MountVolume (options));
someVolumesShared = true;
}
catch (VolumeHostInUse&)
{
continue;
}
}
else
continue;
}
if (newMountedVolumes.back()->Protection == VolumeProtection::HiddenVolumeReadOnly)
protectedVolumeMounted = true;
if (newMountedVolumes.back()->EncryptionAlgorithmMinBlockSize == 8)
legacyVolumeMounted = true;
+
+ if (newMountedVolumes.back()->MasterKeyVulnerable)
+ vulnerableVolumeMounted = true;
+
}
catch (DriverError&) { }
catch (MissingVolumeData&) { }
catch (PasswordException&) { }
catch (SystemException&) { }
catch (ExecutedProcessFailed&) { }
}
if (newMountedVolumes.empty())
{
ShowWarning (LangString [options.Keyfiles && !options.Keyfiles->empty() ? "PASSWORD_OR_KEYFILE_WRONG_AUTOMOUNT" : "PASSWORD_WRONG_AUTOMOUNT"]);
}
else
{
+ if (vulnerableVolumeMounted)
+ ShowWarning ("ERR_XTS_MASTERKEY_VULNERABLE");
+
if (someVolumesShared)
ShowWarning ("DEVICE_IN_USE_INFO");
if (legacyVolumeMounted)
ShowWarning ("WARN_64_BIT_BLOCK_CIPHER");
if (protectedVolumeMounted)
ShowInfo (LangString[newMountedVolumes.size() > 1 ? "HIDVOL_PROT_WARN_AFTER_MOUNT_PLURAL" : "HIDVOL_PROT_WARN_AFTER_MOUNT"]);
}
if (!newMountedVolumes.empty() && GetPreferences().CloseSecurityTokenSessionsAfterMount)
SecurityToken::CloseAllSessions();
return newMountedVolumes;
}
VolumeInfoList UserInterface::MountAllFavoriteVolumes (MountOptions &options)
{
BusyScope busy (this);
VolumeInfoList newMountedVolumes;
foreach_ref (const FavoriteVolume &favorite, FavoriteVolume::LoadList())
{
shared_ptr <VolumeInfo> mountedVolume = Core->GetMountedVolume (favorite.Path);
if (mountedVolume)
{
if (mountedVolume->MountPoint != favorite.MountPoint)
ShowInfo (StringFormatter (LangString["VOLUME_ALREADY_MOUNTED"], wstring (favorite.Path)));
continue;
}
favorite.ToMountOptions (options);
+ bool mountPerformed = false;
if (Preferences.NonInteractive)
{
BusyScope busy (this);
newMountedVolumes.push_back (Core->MountVolume (options));
+ mountPerformed = true;
}
else
{
try
{
BusyScope busy (this);
newMountedVolumes.push_back (Core->MountVolume (options));
+ mountPerformed = true;
}
catch (...)
{
UserPreferences prefs = GetPreferences();
if (prefs.CloseSecurityTokenSessionsAfterMount)
Preferences.CloseSecurityTokenSessionsAfterMount = false;
shared_ptr <VolumeInfo> volume = MountVolume (options);
if (prefs.CloseSecurityTokenSessionsAfterMount)
Preferences.CloseSecurityTokenSessionsAfterMount = true;
if (!volume)
break;
newMountedVolumes.push_back (volume);
}
}
+
+ if (mountPerformed && newMountedVolumes.back()->MasterKeyVulnerable)
+ ShowWarning ("ERR_XTS_MASTERKEY_VULNERABLE");
}
if (!newMountedVolumes.empty() && GetPreferences().CloseSecurityTokenSessionsAfterMount)
SecurityToken::CloseAllSessions();
return newMountedVolumes;
}
shared_ptr <VolumeInfo> UserInterface::MountVolume (MountOptions &options) const
{
shared_ptr <VolumeInfo> volume;
try
{
volume = MountVolumeThread (options);
}
catch (VolumeHostInUse&)
{
if (options.SharedAccessAllowed)
throw_err (LangString["FILE_IN_USE_FAILED"]);
if (!AskYesNo (StringFormatter (LangString["VOLUME_HOST_IN_USE"], wstring (*options.Path)), false, true))
throw UserAbort (SRC_POS);
try
{
options.SharedAccessAllowed = true;
volume = Core->MountVolume (options);
}
catch (VolumeHostInUse&)
{
throw_err (LangString["FILE_IN_USE_FAILED"]);
}
}
+ if (volume->MasterKeyVulnerable)
+ ShowWarning ("ERR_XTS_MASTERKEY_VULNERABLE");
+
if (volume->EncryptionAlgorithmMinBlockSize == 8)
ShowWarning ("WARN_64_BIT_BLOCK_CIPHER");
if (VolumeHasUnrecommendedExtension (*options.Path))
ShowWarning ("EXE_FILE_EXTENSION_MOUNT_WARNING");
if (options.Protection == VolumeProtection::HiddenVolumeReadOnly)
ShowInfo ("HIDVOL_PROT_WARN_AFTER_MOUNT");
if (GetPreferences().CloseSecurityTokenSessionsAfterMount)
SecurityToken::CloseAllSessions();
return volume;
}
void UserInterface::OnUnhandledException ()
{
try
{
throw;
}
catch (UserAbort&)
{
}
catch (exception &e)
{
ShowError (e);
}
catch (...)
{
@@ -1181,61 +1199,62 @@ namespace VeraCrypt
"--restore-headers[=VOLUME_PATH]\n"
" Restore volume headers from the embedded or an external backup. All required\n"
" options are requested from the user.\n"
"\n"
"--save-preferences\n"
" Save user preferences.\n"
"\n"
"--test\n"
" Test internal algorithms used in the process of encryption and decryption.\n"
"\n"
"--version\n"
" Display program version.\n"
"\n"
"--volume-properties[=MOUNTED_VOLUME]\n"
" Display properties of a mounted volume. See below for description of\n"
" MOUNTED_VOLUME.\n"
"\n"
"MOUNTED_VOLUME:\n"
" Specifies a mounted volume. One of the following forms can be used:\n"
" 1) Path to the encrypted VeraCrypt volume.\n"
" 2) Mount directory of the volume's filesystem (if mounted).\n"
" 3) Slot number of the mounted volume (requires --slot).\n"
"\n"
"\n"
"Options:\n"
"\n"
"--display-password\n"
" Display password characters while typing.\n"
"\n"
"--encryption=ENCRYPTION_ALGORITHM\n"
- " Use specified encryption algorithm when creating a new volume. When cascasing algorithms, they must be seperated by a dash. For example: AES-Twofish. \n"
+ " Use specified encryption algorithm when creating a new volume. When cascading\n"
+ " algorithms, they must be separated by a dash. For example: AES-Twofish.\n"
"\n"
"--filesystem=TYPE\n"
" Filesystem type to mount. The TYPE argument is passed to mount(8) command\n"
" with option -t. Default type is 'auto'. When creating a new volume, this\n"
" option specifies the filesystem to be created on the new volume.\n"
" Filesystem type 'none' disables mounting or creating a filesystem.\n"
"\n"
"--force\n"
" Force mounting of a volume in use, dismounting of a volume in use, or\n"
" overwriting a file. Note that this option has no effect on some platforms.\n"
"\n"
"--fs-options=OPTIONS\n"
" Filesystem mount options. The OPTIONS argument is passed to mount(8)\n"
" command with option -o when a filesystem on a VeraCrypt volume is mounted.\n"
" This option is not available on some platforms.\n"
"\n"
"--hash=HASH\n"
" Use specified hash algorithm when creating a new volume or changing password\n"
" and/or keyfiles. This option also specifies the mixing PRF of the random\n"
" number generator.\n"
"\n"
"-k, --keyfiles=KEYFILE1[,KEYFILE2,KEYFILE3,...]\n"
" Use specified keyfiles when mounting a volume or when changing password\n"
" and/or keyfiles. When a directory is specified, all files inside it will be\n"
" used (non-recursively). Multiple keyfiles must be separated by comma.\n"
" Use double comma (,,) to specify a comma contained in keyfile's name.\n"
" Keyfile stored on a security token must be specified as\n"
" token://slot/SLOT_NUMBER/file/FILENAME for a security token keyfile\n"
" and emv://slot/SLOT_NUMBER for an EMV token keyfile.\n"
" An empty keyfile (-k \"\") disables\n"
@@ -1488,61 +1507,61 @@ namespace VeraCrypt
else if (speed > 1024ULL*1024*1024*1024*1024)
return wxString::Format (L"%.1f %s", (double)(speed/1024.0/1024/1024/1024/1024), LangString["PB_PER_SEC"].c_str());
else if (speed > 1024ULL*1024*1024*1024*99)
s << speed/1024/1024/1024/1024 << L" " << LangString["TB_PER_SEC"].c_str();
else if (speed > 1024ULL*1024*1024*1024)
return wxString::Format (L"%.1f %s", (double)(speed/1024.0/1024/1024/1024), LangString["TB_PER_SEC"].c_str());
else if (speed > 1024ULL*1024*1024*99)
s << speed/1024/1024/1024 << L" " << LangString["GB_PER_SEC"].c_str();
else if (speed > 1024ULL*1024*999)
return wxString::Format (L"%.1f %s", (double)(speed/1024.0/1024/1024), LangString["GB_PER_SEC"].c_str());
else if (speed > 1024ULL*1024*9)
s << speed/1024/1024 << L" " << LangString["MB_PER_SEC"].c_str();
else if (speed > 1024ULL*999)
return wxString::Format (L"%.1f %s", (double)(speed/1024.0/1024), LangString["MB_PER_SEC"].c_str());
else if (speed > 1024ULL)
s << speed/1024 << L" " << LangString["KB_PER_SEC"].c_str();
else
s << speed << L" " << LangString["B_PER_SEC"].c_str();
return s.str();
}
void UserInterface::Test () const
{
if (!PlatformTest::TestAll())
throw TestFailed (SRC_POS);
EncryptionTest::TestAll();
// StringFormatter
- if (StringFormatter (L"{9} {8} {7} {6} {5} {4} {3} {2} {1} {0} {{0}}", "1", L"2", '3', L'4', 5, 6, 7, 8, 9, 10) != L"10 9 8 7 6 5 4 3 2 1 {0}")
+ if (static_cast<wstring>(StringFormatter (L"{9} {8} {7} {6} {5} {4} {3} {2} {1} {0} {{0}}", "1", L"2", '3', L'4', 5, 6, 7, 8, 9, 10)) != L"10 9 8 7 6 5 4 3 2 1 {0}")
throw TestFailed (SRC_POS);
try
{
StringFormatter (L"{0} {1}", 1);
throw TestFailed (SRC_POS);
}
catch (StringFormatterException&) { }
try
{
StringFormatter (L"{0} {1} {1}", 1, 2, 3);
throw TestFailed (SRC_POS);
}
catch (StringFormatterException&) { }
try
{
StringFormatter (L"{0} 1}", 1, 2);
throw TestFailed (SRC_POS);
}
catch (StringFormatterException&) { }
try
{
StringFormatter (L"{0} {1", 1, 2);
throw TestFailed (SRC_POS);
}
catch (StringFormatterException&) { }
ShowInfo ("TESTS_PASSED");
diff --git a/src/Main/UserPreferences.cpp b/src/Main/UserPreferences.cpp
index 9dbd35f6..194cb6df 100644
--- a/src/Main/UserPreferences.cpp
+++ b/src/Main/UserPreferences.cpp
@@ -31,127 +31,136 @@ namespace VeraCrypt
cfgVar = 0;
else
cfgVar = StringConverter::ToUInt32 (wstring (cfgText));
}
void UserPreferences::SetValue (const wxString &cfgText, uint64 &cfgVar)
{
if (cfgText.empty())
cfgVar = 0;
else
cfgVar = StringConverter::ToUInt64 (wstring (cfgText));
}
void UserPreferences::SetValue (const wxString &cfgText, wstring &cfgVar)
{
cfgVar = cfgText;
}
void UserPreferences::SetValue (const wxString &cfgText, wxString &cfgVar)
{
cfgVar = cfgText;
}
void UserPreferences::SetValue (const wxString &cfgText, FilesystemPath &cfgVar)
{
cfgVar = wstring (cfgText);
}
void UserPreferences::Load()
{
+ // first we clear the unknown config map entries
+ UnknownConfigMapEntries.clear();
+
// Preferences
FilePath cfgPath = Application::GetConfigFilePath (GetPreferencesFileName());
if (cfgPath.IsFile())
{
map <wxString, wxString> configMap;
foreach (XmlNode node, XmlParser (cfgPath).GetNodes (L"config"))
{
configMap[node.Attributes[L"key"]] = node.InnerText;
}
-#define TC_CONFIG_SET(NAME) SetValue (configMap[L###NAME], NAME)
+#define TC_CONFIG_SET(NAME) if (configMap.count(L###NAME) > 0) { SetValue (configMap[L###NAME], NAME); configMap.erase (L###NAME); }
TC_CONFIG_SET (BackgroundTaskEnabled);
TC_CONFIG_SET (BackgroundTaskMenuDismountItemsEnabled);
TC_CONFIG_SET (BackgroundTaskMenuMountItemsEnabled);
TC_CONFIG_SET (BackgroundTaskMenuOpenItemsEnabled);
TC_CONFIG_SET (BeepAfterHotkeyMountDismount);
- SetValue (configMap[L"CachePasswords"], DefaultMountOptions.CachePassword);
+ if (configMap.count(L"CachePasswords") > 0) { SetValue (configMap[L"CachePasswords"], DefaultMountOptions.CachePassword); configMap.erase (L"CachePasswords"); }
TC_CONFIG_SET (CloseBackgroundTaskOnNoVolumes);
TC_CONFIG_SET (CloseExplorerWindowsOnDismount);
TC_CONFIG_SET (CloseSecurityTokenSessionsAfterMount);
TC_CONFIG_SET (EMVSupportEnabled);
TC_CONFIG_SET (DisableKernelEncryptionModeWarning);
TC_CONFIG_SET (DismountOnInactivity);
TC_CONFIG_SET (DismountOnLogOff);
TC_CONFIG_SET (DismountOnPowerSaving);
TC_CONFIG_SET (DismountOnScreenSaver);
TC_CONFIG_SET (DisplayMessageAfterHotkeyDismount);
TC_CONFIG_SET (BackgroundTaskEnabled);
- SetValue (configMap[L"FilesystemOptions"], DefaultMountOptions.FilesystemOptions);
+ if (configMap.count(L"FilesystemOptions") > 0) { SetValue (configMap[L"FilesystemOptions"], DefaultMountOptions.FilesystemOptions); configMap.erase (L"FilesystemOptions"); }
TC_CONFIG_SET (ForceAutoDismount);
+ TC_CONFIG_SET (Language);
TC_CONFIG_SET (LastSelectedSlotNumber);
TC_CONFIG_SET (MaxVolumeIdleTime);
TC_CONFIG_SET (MountDevicesOnLogon);
TC_CONFIG_SET (MountFavoritesOnLogon);
bool readOnly = false;
- SetValue (configMap[L"MountVolumesReadOnly"], readOnly);
+ if (configMap.count(L"MountVolumesReadOnly") > 0) { SetValue (configMap[L"MountVolumesReadOnly"], readOnly); configMap.erase (L"MountVolumesReadOnly"); }
DefaultMountOptions.Protection = readOnly ? VolumeProtection::ReadOnly : VolumeProtection::None;
- SetValue (configMap[L"MountVolumesRemovable"], DefaultMountOptions.Removable);
- SetValue (configMap[L"NoHardwareCrypto"], DefaultMountOptions.NoHardwareCrypto);
- SetValue (configMap[L"NoKernelCrypto"], DefaultMountOptions.NoKernelCrypto);
+ if (configMap.count(L"MountVolumesRemovable") > 0) { SetValue (configMap[L"MountVolumesRemovable"], DefaultMountOptions.Removable); configMap.erase (L"MountVolumesRemovable"); }
+ if (configMap.count(L"NoHardwareCrypto") > 0) { SetValue (configMap[L"NoHardwareCrypto"], DefaultMountOptions.NoHardwareCrypto); configMap.erase (L"NoHardwareCrypto"); }
+ if (configMap.count(L"NoKernelCrypto") > 0) { SetValue (configMap[L"NoKernelCrypto"], DefaultMountOptions.NoKernelCrypto); configMap.erase (L"NoKernelCrypto"); }
TC_CONFIG_SET (OpenExplorerWindowAfterMount);
- SetValue (configMap[L"PreserveTimestamps"], DefaultMountOptions.PreserveTimestamps);
+ if (configMap.count(L"PreserveTimestamps") > 0) { SetValue (configMap[L"PreserveTimestamps"], DefaultMountOptions.PreserveTimestamps); configMap.erase (L"PreserveTimestamps"); }
TC_CONFIG_SET (SaveHistory);
- SetValue (configMap[L"SecurityTokenLibrary"], SecurityTokenModule);
+ if (configMap.count(L"SecurityTokenLibrary") > 0) { SetValue (configMap[L"SecurityTokenLibrary"], SecurityTokenModule); configMap.erase (L"SecurityTokenLibrary"); }
TC_CONFIG_SET (StartOnLogon);
TC_CONFIG_SET (UseKeyfiles);
TC_CONFIG_SET (WipeCacheOnAutoDismount);
TC_CONFIG_SET (WipeCacheOnClose);
wstring defaultPrf;
- SetValue (configMap[L"DefaultPRF"], defaultPrf);
+ if (configMap.count(L"DefaultPRF") > 0) { SetValue (configMap[L"DefaultPRF"], defaultPrf); configMap.erase (L"DefaultPRF"); }
+ if (defaultPrf.empty())
+ defaultPrf = L"autodetection";
shared_ptr <Pkcs5Kdf> savedKdf;
try
{
if (defaultPrf != L"autodetection")
savedKdf = Pkcs5Kdf::GetAlgorithm (defaultPrf);
}
catch (ParameterIncorrect&)
{
}
DefaultMountOptions.Kdf = savedKdf;
DefaultMountOptions.ProtectionKdf = savedKdf;
+
+ // at this point, the configMap should be empty, if not, we have unknown config entries that we need to store
+ UnknownConfigMapEntries = configMap;
}
// Default keyfiles
cfgPath = Application::GetConfigFilePath (GetDefaultKeyfilesFileName());
if (cfgPath.IsFile())
{
foreach (const XmlNode &node, XmlParser (cfgPath).GetNodes (L"keyfile"))
{
DefaultKeyfiles.push_back (make_shared <Keyfile> ((wstring) node.InnerText));
}
}
#ifdef TC_WINDOWS
// Hotkeys
Hotkeys = Hotkey::LoadList();
#endif
}
void UserPreferences::Save() const
{
// Preferences
class ConfigXmlFormatter
{
public:
void AddEntry (const wchar_t *key, const wxString &value)
{
if (!value.empty())
{
XmlNode config (L"config");
config.Attributes[L"key"] = key;
@@ -179,82 +188,89 @@ namespace VeraCrypt
AddEntry (key, s.str());
}
XmlNode XmlConfig;
};
ConfigXmlFormatter formatter;
formatter.XmlConfig.Name = L"configuration";
#define TC_CONFIG_ADD(NAME) formatter.AddEntry (L###NAME, NAME)
TC_CONFIG_ADD (BackgroundTaskEnabled);
TC_CONFIG_ADD (BackgroundTaskMenuDismountItemsEnabled);
TC_CONFIG_ADD (BackgroundTaskMenuMountItemsEnabled);
TC_CONFIG_ADD (BackgroundTaskMenuOpenItemsEnabled);
TC_CONFIG_ADD (BeepAfterHotkeyMountDismount);
formatter.AddEntry (L"CachePasswords", DefaultMountOptions.CachePassword);
TC_CONFIG_ADD (CloseBackgroundTaskOnNoVolumes);
TC_CONFIG_ADD (CloseExplorerWindowsOnDismount);
TC_CONFIG_ADD (CloseSecurityTokenSessionsAfterMount);
TC_CONFIG_ADD (EMVSupportEnabled);
TC_CONFIG_ADD (DisableKernelEncryptionModeWarning);
TC_CONFIG_ADD (DismountOnInactivity);
TC_CONFIG_ADD (DismountOnLogOff);
TC_CONFIG_ADD (DismountOnPowerSaving);
TC_CONFIG_ADD (DismountOnScreenSaver);
TC_CONFIG_ADD (DisplayMessageAfterHotkeyDismount);
TC_CONFIG_ADD (BackgroundTaskEnabled);
formatter.AddEntry (L"FilesystemOptions", DefaultMountOptions.FilesystemOptions);
TC_CONFIG_ADD (ForceAutoDismount);
+ TC_CONFIG_ADD (Language);
TC_CONFIG_ADD (LastSelectedSlotNumber);
TC_CONFIG_ADD (MaxVolumeIdleTime);
TC_CONFIG_ADD (MountDevicesOnLogon);
TC_CONFIG_ADD (MountFavoritesOnLogon);
formatter.AddEntry (L"MountVolumesReadOnly", DefaultMountOptions.Protection == VolumeProtection::ReadOnly);
formatter.AddEntry (L"MountVolumesRemovable", DefaultMountOptions.Removable);
formatter.AddEntry (L"NoHardwareCrypto", DefaultMountOptions.NoHardwareCrypto);
formatter.AddEntry (L"NoKernelCrypto", DefaultMountOptions.NoKernelCrypto);
TC_CONFIG_ADD (OpenExplorerWindowAfterMount);
formatter.AddEntry (L"PreserveTimestamps", DefaultMountOptions.PreserveTimestamps);
TC_CONFIG_ADD (SaveHistory);
formatter.AddEntry (L"SecurityTokenLibrary", wstring (SecurityTokenModule));
TC_CONFIG_ADD (StartOnLogon);
TC_CONFIG_ADD (UseKeyfiles);
TC_CONFIG_ADD (WipeCacheOnAutoDismount);
TC_CONFIG_ADD (WipeCacheOnClose);
wstring defaultPrf = L"autodetection";
if (DefaultMountOptions.Kdf)
defaultPrf = DefaultMountOptions.Kdf->GetName ();
formatter.AddEntry (L"DefaultPRF", defaultPrf);
+ // add unknown config entries by iterating over all elements of the UnknownConfigMapEntries map
+ for (map<wxString, wxString>::const_iterator it = UnknownConfigMapEntries.begin(); it != UnknownConfigMapEntries.end(); ++it)
+ {
+ formatter.AddEntry(it->first.c_str(), it->second);
+ }
+
XmlWriter writer (Application::GetConfigFilePath (GetPreferencesFileName(), true));
writer.WriteNode (formatter.XmlConfig);
writer.Close();
// Default keyfiles
FilePath keyfilesCfgPath = Application::GetConfigFilePath (GetDefaultKeyfilesFileName(), true);
if (DefaultKeyfiles.empty())
{
if (keyfilesCfgPath.IsFile())
keyfilesCfgPath.Delete();
}
else
{
XmlNode keyfilesXml (L"defaultkeyfiles");
foreach_ref (const Keyfile &keyfile, DefaultKeyfiles)
{
keyfilesXml.InnerNodes.push_back (XmlNode (L"keyfile", wxString (wstring(FilesystemPath (keyfile)))));
}
XmlWriter keyfileWriter (keyfilesCfgPath);
keyfileWriter.WriteNode (keyfilesXml);
keyfileWriter.Close();
}
#ifdef TC_WINDOWS
// Hotkeys
Hotkey::SaveList (Hotkeys);
#endif
diff --git a/src/Main/UserPreferences.h b/src/Main/UserPreferences.h
index 6d53fb5f..25621656 100644
--- a/src/Main/UserPreferences.h
+++ b/src/Main/UserPreferences.h
@@ -12,104 +12,110 @@
#ifndef TC_HEADER_Main_UserPreferences
#define TC_HEADER_Main_UserPreferences
#include "System.h"
#include "Main.h"
#include "Hotkey.h"
namespace VeraCrypt
{
struct UserPreferences
{
UserPreferences ()
:
BackgroundTaskEnabled (true),
BackgroundTaskMenuDismountItemsEnabled (true),
BackgroundTaskMenuMountItemsEnabled (true),
BackgroundTaskMenuOpenItemsEnabled (true),
BeepAfterHotkeyMountDismount (false),
CloseBackgroundTaskOnNoVolumes (true),
CloseExplorerWindowsOnDismount (true),
CloseSecurityTokenSessionsAfterMount (false),
EMVSupportEnabled (false),
DisableKernelEncryptionModeWarning (false),
DismountOnInactivity (false),
DismountOnLogOff (true),
DismountOnPowerSaving (false),
DismountOnScreenSaver (false),
DisplayMessageAfterHotkeyDismount (false),
ForceAutoDismount (true),
+ Language (L"system"),
LastSelectedSlotNumber (0),
MaxVolumeIdleTime (60),
MountDevicesOnLogon (false),
MountFavoritesOnLogon (false),
NonInteractive (false),
UseStandardInput (false),
OpenExplorerWindowAfterMount (false),
SaveHistory (false),
StartOnLogon (false),
UseKeyfiles (false),
Verbose (false),
WipeCacheOnAutoDismount (true),
WipeCacheOnClose (false)
{
}
virtual ~UserPreferences ()
{
}
void Load();
void Save() const;
HotkeyList Hotkeys;
KeyfileList DefaultKeyfiles;
MountOptions DefaultMountOptions;
bool BackgroundTaskEnabled;
bool BackgroundTaskMenuDismountItemsEnabled;
bool BackgroundTaskMenuMountItemsEnabled;
bool BackgroundTaskMenuOpenItemsEnabled;
bool BeepAfterHotkeyMountDismount;
bool CloseBackgroundTaskOnNoVolumes;
bool CloseExplorerWindowsOnDismount;
bool CloseSecurityTokenSessionsAfterMount;
bool EMVSupportEnabled;
bool DisableKernelEncryptionModeWarning;
bool DismountOnInactivity;
bool DismountOnLogOff;
bool DismountOnPowerSaving;
bool DismountOnScreenSaver;
bool DisplayMessageAfterHotkeyDismount;
bool ForceAutoDismount;
+ wstring Language;
uint64 LastSelectedSlotNumber;
int32 MaxVolumeIdleTime;
bool MountDevicesOnLogon;
bool MountFavoritesOnLogon;
bool NonInteractive;
bool UseStandardInput;
bool OpenExplorerWindowAfterMount;
bool SaveHistory;
FilePath SecurityTokenModule;
bool StartOnLogon;
bool UseKeyfiles;
bool Verbose;
bool WipeCacheOnAutoDismount;
bool WipeCacheOnClose;
+ // A map used to store unknown entries from the configuration file in order to preserve them when saving the configuration.
+ // This helps to preserve unknown entries that may be used by future versions of VeraCrypt or entries used by old versions that were removed from current version.
+ map <wxString, wxString> UnknownConfigMapEntries;
+
protected:
wxString GetDefaultKeyfilesFileName () const { return L"Default Keyfiles.xml"; }
#ifdef TC_PROTOTYPE
wxString GetPreferencesFileName () const { return L"Configuration_Debug.xml"; }
#else
wxString GetPreferencesFileName () const { return L"Configuration.xml"; }
#endif
void SetValue (const wxString &cfgText, bool &cfgVar);
void SetValue (const wxString &cfgText, int &cfgVar);
void SetValue (const wxString &cfgText, uint64 &cfgVar);
void SetValue (const wxString &cfgText, wstring &cfgVar);
void SetValue (const wxString &cfgText, wxString &cfgVar);
void SetValue (const wxString &cfgText, FilesystemPath &cfgVar);
};
}
#endif // TC_HEADER_Main_UserPreferences
diff --git a/src/Main/Xml.cpp b/src/Main/Xml.cpp
index 6d0faa18..bf286a55 100644
--- a/src/Main/Xml.cpp
+++ b/src/Main/Xml.cpp
@@ -81,61 +81,61 @@ namespace VeraCrypt
if (innerTextEnd == string::npos)
throw ParameterIncorrect (SRC_POS);
xmlNode.InnerText = ConvertEscapedChars (XmlText.substr (innerTextPos, innerTextEnd - innerTextPos));
nodePos = innerTextEnd;
}
nodeList.push_back (xmlNode);
}
return nodeList;
}
XmlWriter::XmlWriter (const FilePath &fileName)
{
MemOutStream.reset (new wxMemoryOutputStream);
TextOutStream.reset (new wxTextOutputStream (*MemOutStream));
OutFile.Open (fileName, File::CreateWrite);
*TextOutStream << L"<?xml version=\"1.0\" encoding=\"utf-8\"?>" << endl << L"<VeraCrypt>" << endl;
CurrentIndentLevel = 0;
}
void XmlWriter::Close()
{
if (MemOutStream.get())
{
*TextOutStream << L"</VeraCrypt>" << endl;
wxStreamBuffer *buf = MemOutStream->GetOutputStreamBuffer();
- OutFile.Write (ConstBufferPtr (reinterpret_cast <byte *> (buf->GetBufferStart()), buf->GetBufferSize()));
+ OutFile.Write (ConstBufferPtr (reinterpret_cast <uint8 *> (buf->GetBufferStart()), buf->GetBufferSize()));
OutFile.Close();
TextOutStream.reset();
MemOutStream.reset();
}
}
wxString XmlWriter::EscapeChars (wxString rawString) const
{
rawString.Replace (L"<", L"&lt;");
rawString.Replace (L">", L"&gt;");
rawString.Replace (L"&", L"&amp;");
rawString.Replace (L"\"", L"&quot;");
return rawString;
}
void XmlWriter::WriteNode (const XmlNode &xmlNode)
{
XmlNodeList nodes;
nodes.push_back (xmlNode);
WriteNodes (nodes);
}
void XmlWriter::WriteNodes (const XmlNodeList &xmlNodes)
{
CurrentIndentLevel++;
wxString indent;
for (int i = 0; i < CurrentIndentLevel; ++i)
indent += L"\t";