diff options
Diffstat (limited to 'src/Main/GraphicUserInterface.cpp')
-rw-r--r--[-rwxr-xr-x] | src/Main/GraphicUserInterface.cpp | 117 |
1 files changed, 87 insertions, 30 deletions
diff --git a/src/Main/GraphicUserInterface.cpp b/src/Main/GraphicUserInterface.cpp index ba283af4..16db8f83 100755..100644 --- a/src/Main/GraphicUserInterface.cpp +++ b/src/Main/GraphicUserInterface.cpp @@ -58,7 +58,7 @@ namespace VeraCrypt #ifdef TC_MACOSX g_customIdCmdV = wxNewId(); g_customIdCmdA = wxNewId(); - wxApp::s_macHelpMenuTitleName = _("&Help"); + wxApp::s_macHelpMenuTitleName = LangString["MENU_HELP"]; #endif } @@ -191,8 +191,8 @@ namespace VeraCrypt options->Password, options->Pim, options->Kdf, - false, options->Keyfiles, + options->EMVSupportEnabled, options->Protection, options->ProtectionPassword, options->ProtectionPim, @@ -208,7 +208,42 @@ namespace VeraCrypt } catch (PasswordException &e) { - ShowWarning (e); + bool bFailed = true; + if (!options->UseBackupHeaders) + { + try + { + OpenVolumeThreadRoutine routine2( + options->Path, + options->PreserveTimestamps, + options->Password, + 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"); } } @@ -280,7 +315,7 @@ namespace VeraCrypt // Re-encrypt volume header SecureBuffer newHeaderBuffer (normalVolume->GetLayout()->GetHeaderSize()); - ReEncryptHeaderThreadRoutine routine(newHeaderBuffer, normalVolume->GetHeader(), normalVolumeMountOptions.Password, normalVolumeMountOptions.Pim, normalVolumeMountOptions.Keyfiles); + ReEncryptHeaderThreadRoutine routine(newHeaderBuffer, normalVolume->GetHeader(), normalVolumeMountOptions.Password, normalVolumeMountOptions.Pim, normalVolumeMountOptions.Keyfiles, normalVolumeMountOptions.EMVSupportEnabled); ExecuteWaitThreadRoutine (parent, &routine); @@ -289,7 +324,7 @@ namespace VeraCrypt if (hiddenVolume) { // Re-encrypt hidden volume header - ReEncryptHeaderThreadRoutine hiddenRoutine(newHeaderBuffer, hiddenVolume->GetHeader(), hiddenVolumeMountOptions.Password, hiddenVolumeMountOptions.Pim, hiddenVolumeMountOptions.Keyfiles); + ReEncryptHeaderThreadRoutine hiddenRoutine(newHeaderBuffer, hiddenVolume->GetHeader(), hiddenVolumeMountOptions.Password, hiddenVolumeMountOptions.Pim, hiddenVolumeMountOptions.Keyfiles, hiddenVolumeMountOptions.EMVSupportEnabled); ExecuteWaitThreadRoutine (parent, &hiddenRoutine); } @@ -309,7 +344,7 @@ namespace VeraCrypt void GraphicUserInterface::BeginInteractiveBusyState (wxWindow *window) { - static auto_ptr <wxCursor> arrowWaitCursor; + static unique_ptr <wxCursor> arrowWaitCursor; if (arrowWaitCursor.get() == nullptr) arrowWaitCursor.reset (new wxCursor (wxCURSOR_ARROWWAIT)); @@ -374,7 +409,7 @@ namespace VeraCrypt void GraphicUserInterface::EndInteractiveBusyState (wxWindow *window) const { - static auto_ptr <wxCursor> arrowCursor; + static unique_ptr <wxCursor> arrowCursor; if (arrowCursor.get() == nullptr) arrowCursor.reset (new wxCursor (wxCURSOR_ARROW)); @@ -431,7 +466,7 @@ namespace VeraCrypt } else { - wxPasswordEntryDialog dialog (Gui->GetActiveWindow(), _("Enter your user password or administrator password:"), _("Administrator privileges required")); + 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(); @@ -597,7 +632,7 @@ namespace VeraCrypt try { - SecurityToken::InitLibrary (Preferences.SecurityTokenModule, auto_ptr <GetPinFunctor> (new PinRequestHandler), auto_ptr <SendExceptionFunctor> (new WarningHandler)); + SecurityToken::InitLibrary (Preferences.SecurityTokenModule, unique_ptr <GetPinFunctor> (new PinRequestHandler), unique_ptr <SendExceptionFunctor> (new WarningHandler)); } catch (Exception &e) { @@ -642,11 +677,21 @@ namespace VeraCrypt return true; } - void GraphicUserInterface::ListSecurityTokenKeyfiles () const + void GraphicUserInterface::ListTokenKeyfiles () const { SecurityTokenKeyfilesDialog dialog (nullptr); dialog.ShowModal(); } + void GraphicUserInterface::ListSecurityTokenKeyfiles () const + { + SecurityTokenKeyfilesDialog dialog (nullptr); + dialog.ShowModal(); + } + void GraphicUserInterface::ListEMVTokenKeyfiles () const + { + SecurityTokenKeyfilesDialog dialog (nullptr); + dialog.ShowModal(); + } #ifdef TC_MACOSX void GraphicUserInterface::MacOpenFiles (const wxArrayString &fileNames) @@ -788,7 +833,7 @@ namespace VeraCrypt options.Keyfiles = make_shared <KeyfileList> (GetPreferences().DefaultKeyfiles); if ((options.Password && !options.Password->IsEmpty()) - || (options.Keyfiles && !options.Keyfiles->empty() && (options.TrueCryptMode || options.Password))) + || (options.Keyfiles && !options.Keyfiles->empty() && options.Password)) { try { @@ -850,7 +895,7 @@ namespace VeraCrypt #ifdef TC_LINUX if (volume && !Preferences.NonInteractive && !Preferences.DisableKernelEncryptionModeWarning && volume->EncryptionModeName != L"XTS" - && !AskYesNo (LangString["ENCRYPTION_MODE_NOT_SUPPORTED_BY_KERNEL"] + _("\n\nDo you want to show this message next time you mount such a volume?"), true, true)) + && !AskYesNo (LangString["ENCRYPTION_MODE_NOT_SUPPORTED_BY_KERNEL"] + LangString["LINUX_MESSAGE_ON_MOUNT_AGAIN"], true, true)) { UserPreferences prefs = GetPreferences(); prefs.DisableKernelEncryptionModeWarning = true; @@ -930,8 +975,8 @@ namespace VeraCrypt wxConnectionBase *OnMakeConnection () { return new Connection; } }; - auto_ptr <wxDDEClient> client (new Client); - auto_ptr <wxConnectionBase> connection (client->MakeConnection (L"localhost", serverName, L"raise")); + unique_ptr <wxDDEClient> client (new Client); + unique_ptr <wxConnectionBase> connection (client->MakeConnection (L"localhost", serverName, L"raise")); if (connection.get() && connection->Execute (nullptr)) { @@ -951,7 +996,7 @@ namespace VeraCrypt if (write (showFifo, buf, 1) == 1) { close (showFifo); - Gui->ShowInfo (_("VeraCrypt is already running.")); + Gui->ShowInfo (LangString["LINUX_VC_RUNNING_ALREADY"]); Application::SetExitCode (0); return false; } @@ -983,7 +1028,7 @@ namespace VeraCrypt wxLog::FlushActive(); Application::SetExitCode (1); - Gui->ShowInfo (_("VeraCrypt is already running.")); + Gui->ShowInfo (LangString["LINUX_VC_RUNNING_ALREADY"]); return false; #endif } @@ -1274,7 +1319,7 @@ namespace VeraCrypt #elif defined (TC_MACOSX) htmlPath += L"/../Resources/doc/HTML/"; #elif defined (TC_UNIX) - htmlPath = L"/usr/share/veracrypt/doc/HTML/"; + htmlPath = L"/usr/share/doc/veracrypt/HTML/"; #else localFile = false; #endif @@ -1282,7 +1327,14 @@ namespace VeraCrypt { /* check if local file exists */ wxFileName htmlFile = htmlPath + url; - htmlFile.Normalize(); + htmlFile.Normalize ( + wxPATH_NORM_ENV_VARS | + wxPATH_NORM_DOTS | + wxPATH_NORM_CASE | + wxPATH_NORM_LONG | + wxPATH_NORM_SHORTCUT | + wxPATH_NORM_TILDE + ); localFile = htmlFile.FileExists(); } @@ -1412,8 +1464,8 @@ namespace VeraCrypt options.Password, options.Pim, options.Kdf, - options.TrueCryptMode, options.Keyfiles, + options.EMVSupportEnabled, options.Protection, options.ProtectionPassword, options.ProtectionPim, @@ -1446,7 +1498,7 @@ namespace VeraCrypt // Re-encrypt volume header wxBusyCursor busy; SecureBuffer newHeaderBuffer (volume->GetLayout()->GetHeaderSize()); - ReEncryptHeaderThreadRoutine routine(newHeaderBuffer, volume->GetHeader(), options.Password, options.Pim, options.Keyfiles); + ReEncryptHeaderThreadRoutine routine(newHeaderBuffer, volume->GetHeader(), options.Password, options.Pim, options.Keyfiles, options.EMVSupportEnabled); ExecuteWaitThreadRoutine (parent, &routine); @@ -1527,12 +1579,12 @@ namespace VeraCrypt backupFile.ReadAt (headerBuffer, layout->GetType() == VolumeType::Hidden ? layout->GetHeaderSize() : 0); // Decrypt header - shared_ptr <VolumePassword> passwordKey = Keyfile::ApplyListToPassword (options.Keyfiles, options.Password); - Pkcs5KdfList keyDerivationFunctions = layout->GetSupportedKeyDerivationFunctions(options.TrueCryptMode); + 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, options.TrueCryptMode, keyDerivationFunctions, encryptionAlgorithms, encryptionModes); + DecryptThreadRoutine decryptRoutine(layout->GetHeader(), headerBuffer, *passwordKey, options.Pim, options.Kdf, keyDerivationFunctions, encryptionAlgorithms, encryptionModes); ExecuteWaitThreadRoutine (parent, &decryptRoutine); @@ -1561,7 +1613,7 @@ namespace VeraCrypt // Re-encrypt volume header wxBusyCursor busy; SecureBuffer newHeaderBuffer (decryptedLayout->GetHeaderSize()); - ReEncryptHeaderThreadRoutine routine(newHeaderBuffer, decryptedLayout->GetHeader(), options.Password, options.Pim, options.Keyfiles); + ReEncryptHeaderThreadRoutine routine(newHeaderBuffer, decryptedLayout->GetHeader(), options.Password, options.Pim, options.Keyfiles, options.EMVSupportEnabled); ExecuteWaitThreadRoutine (parent, &routine); @@ -1577,7 +1629,7 @@ namespace VeraCrypt if (decryptedLayout->HasBackupHeader()) { // Re-encrypt backup volume header - ReEncryptHeaderThreadRoutine backupRoutine(newHeaderBuffer, decryptedLayout->GetHeader(), options.Password, options.Pim, options.Keyfiles); + ReEncryptHeaderThreadRoutine backupRoutine(newHeaderBuffer, decryptedLayout->GetHeader(), options.Password, options.Pim, options.Keyfiles, options.EMVSupportEnabled); ExecuteWaitThreadRoutine (parent, &backupRoutine); @@ -1719,6 +1771,10 @@ namespace VeraCrypt } BackgroundMode = state; + +#ifdef HAVE_INDICATORS + gtk_menu_item_set_label ((GtkMenuItem*) ((MainFrame*) mMainFrame)->indicator_item_showhide, LangString[Gui->IsInBackgroundMode() ? "SHOW_TC" : "HIDE_TC"].mb_str()); +#endif } void GraphicUserInterface::SetListCtrlColumnWidths (wxListCtrl *listCtrl, list <int> columnWidthPermilles, bool hasVerticalScrollbar) const @@ -1852,9 +1908,9 @@ namespace VeraCrypt else { if (style & wxICON_EXCLAMATION) - caption = wxString (_("Warning")) + L':'; + caption = wxString (LangString["LINUX_WARNING"]) + L':'; else if (style & wxICON_ERROR || style & wxICON_HAND) - caption = wxString (_("Error")) + L':'; + caption = wxString (LangString["LINUX_ERROR"]) + L':'; else caption.clear(); } @@ -1872,8 +1928,9 @@ namespace VeraCrypt style |= wxSTAY_ON_TOP; } - - return wxMessageBox (subMessage, caption, style, GetActiveWindow()); + wxMessageDialog cur(GetActiveWindow(), subMessage, caption, style); + cur.SetYesNoLabels(LangString["UISTR_YES"], LangString["UISTR_NO"]); + return (cur.ShowModal() == wxID_YES ? wxYES : wxNO) ; } } @@ -1888,7 +1945,7 @@ namespace VeraCrypt void GraphicUserInterface::ThrowTextModeRequired () const { - Gui->ShowError (_("This feature is currently supported only in text mode.")); + Gui->ShowError (LangString["LINUX_ONLY_TEXTMODE"]); throw UserAbort (SRC_POS); } |