VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Main/LanguageStrings.cpp
blob: e4c0163e9c03d3aff307a1b7840db5b5afca2ed1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/*
 Copyright (c) 2008-2009 TrueCrypt Developers Association. All rights reserved.

 Governed by the TrueCrypt License 3.0 the full text of which is contained in
 the file License.txt included in TrueCrypt binary and source code distribution
 packages.
*/

#include "System.h"
#include "Resources.h"
#include "LanguageStrings.h"
#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 wxString (L"?") + StringConverter::ToWide (key) + L"?";
	}

	wstring LanguageStrings::Get (const string &key) const
	{
		return wstring (LangString[key]);
	}

	void LanguageStrings::Init ()
	{
		foreach (XmlNode node, XmlParser (Resources::GetLanguageXml()).GetNodes (L"string"))
		{
			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"control"))
		{
			wxString text = node.InnerText;
			text.Replace (L"\\n", L"\n");
			Map[StringConverter::ToSingle (wstring (node.Attributes[L"key"]))] = text;
		}

		Map["EXCEPTION_OCCURRED"] = _("Exception occurred");
		Map["MOUNT"] = _("Mount");
		Map["MOUNT_POINT"] = _("Mount Directory");
		Map["NO"] = _("No");
		Map["NO_VOLUMES_MOUNTED"] = _("No volumes mounted.");
		Map["OPEN_NEW_VOLUME"] = _("Specify a New VeraCrypt Volume");
		Map["PARAMETER_INCORRECT"] = _("Parameter incorrrect");
		Map["SELECT_KEYFILES"] = _("Select Keyfiles");
		Map["START_TC"] = _("Start VeraCrypt");
		Map["VOLUME_ALREADY_MOUNTED"] = _("The volume \"{0}\" is already mounted.");
		Map["UNKNOWN_OPTION"] = _("Unknown option");
		Map["VOLUME_LOCATION"] = _("Volume Location");
		Map["YES"] = _("Yes");
		Map["VOLUME_HOST_IN_USE"] = _("WARNING: The host file/device \"{0}\" is already in use!\n\nIgnoring this can cause undesired results including system instability. All applications that might be using the host file/device should be closed before mounting the volume.\n\nContinue mounting?");
		Map["VIRTUAL_DEVICE"] = _("Virtual Device");
		Map["CONFIRM_BACKGROUND_TASK_DISABLED"] = _("WARNING: If the VeraCrypt Background Task is disabled, the following functions, depending on the platform, will be disabled whenever you exit VeraCrypt:\n\n1) Auto-dismount (e.g., upon logoff, time-out, etc.)\n2) Notifications (e.g., when damage to hidden volume is prevented)\n3) Tray icon\n\nNote: You may shut down the Background Task anytime by right-clicking the VeraCrypt tray icon and selecting 'Exit'.\n\nAre you sure you want to disable the VeraCrypt Background Task?");
		Map["CONFIRM_EXIT"] = _("WARNING: If VeraCrypt exits now, the following functions, depending on the platform, will be disabled:\n\n1) Auto-dismount (e.g., upon logoff, time-out, etc.)\n2) Notifications (e.g., when damage to hidden volume is prevented)\n3) Tray icon\n\nNote: If you do not wish VeraCrypt to continue running in background after you close its window, disable the Background Task in the Preferences.\n\nAre you sure you want VeraCrypt to exit?");
		Map["DAMAGE_TO_HIDDEN_VOLUME_PREVENTED"] = _("WARNING: Data were attempted to be saved to the hidden volume area of the volume \"{0}\"!\n\nVeraCrypt prevented these data from being saved in order to protect the hidden volume. This may have caused filesystem corruption on the outer volume and the operating system may have reported a write error (\"Delayed Write Failed\", \"The parameter is incorrect\", etc.). The entire volume (both the outer and the hidden part) will be write-protected until it is dismounted.\n\nWe strongly recommend that you restart the operating system now.");
		Map["ENTER_PASSWORD"] = _("Enter password");
		Map["ENTER_PASSWORD_FOR"] = _("Enter password for \"{0}\"");
		Map["ENTER_TC_VOL_PASSWORD"] = _("Enter VeraCrypt Volume Password");
		Map["SELECT_KEYFILE_PATH"] = _("Select Keyfile Search Path");
		Map["MORE_INFO_ABOUT"] = _("More information on {0}");
		Map["TWO_LAYER_CASCADE_HELP"] = _("Two ciphers in a cascade operating in XTS mode. Each block is first encrypted with {0} ({1}-bit key) and then with {2} ({3}-bit key). Each cipher uses its own key. All keys are mutually independent.");
		Map["THREE_LAYER_CASCADE_HELP"] = _("Three ciphers in a cascade operating in XTS mode. Each block is first encrypted with {0} ({1}-bit key), then with {2} ({3}-bit key), and finally with {4} ({5}-bit key). Each cipher uses its own key. All keys are mutually independent.");
		Map["CHECKING_FS"] = _("Checking the file system on the VeraCrypt volume mounted as {0}...");
		Map["REPAIRING_FS"] = _("Attempting to repair the file system on the VeraCrypt volume mounted as {0}...");
		Map["UNMOUNT_LOCK_FAILED"] = _("Volume \"{0}\" contains files or folders being used by applications or system.\n\nForce dismount?");
		Map["VOLUME_SIZE_HELP"] = _("Please specify the size of the container to create. Note that the minimum possible size of a volume is 292 KB.");
		Map["ENCRYPTION_MODE_NOT_SUPPORTED_BY_KERNEL"] = _("The volume you have mounted uses a mode of operation that is not supported by the Linux kernel. You may experience slow performance when using this volume. To achieve full performance, you should move the data from this volume to a new volume created by VeraCrypt 5.0 or later.");
	}

	LanguageStrings LangString;
}
class="n">hWnd, clsid, iid, tcServer) == S_OK; if (r) break; else { if (IDRETRY == ErrorRetryCancel ("UAC_INIT_ERROR", hWnd)) continue; else break; } } } else { r = CoCreateInstance (clsid, NULL, CLSCTX_LOCAL_SERVER, iid, tcServer) == S_OK; if (!r) Error ("UAC_INIT_ERROR", hWnd); } return r; } DWORD BaseCom::CallDriver (DWORD ioctl, BSTR input, BSTR *output) { try { BootEncryption bootEnc (NULL); bootEnc.CallDriver (ioctl, (BYTE *) input, !(BYTE *) input ? 0 : ((DWORD *) ((BYTE *) input))[-1], (BYTE *) *output, !(BYTE *) *output ? 0 : ((DWORD *) ((BYTE *) *output))[-1]); } catch (SystemException &) { return GetLastError(); } catch (Exception &e) { e.Show (NULL); return ERROR_EXCEPTION_IN_SERVICE; } catch (...) { return ERROR_EXCEPTION_IN_SERVICE; } return ERROR_SUCCESS; } DWORD BaseCom::CopyFile (BSTR sourceFile, BSTR destinationFile) { if (!::CopyFileW (sourceFile, destinationFile, FALSE)) return GetLastError(); return ERROR_SUCCESS; } DWORD BaseCom::DeleteFile (BSTR file) { if (!::DeleteFileW (file)) return GetLastError(); return ERROR_SUCCESS; } BOOL BaseCom::IsPagingFileActive (BOOL checkNonWindowsPartitionsOnly) { return ::IsPagingFileActive (checkNonWindowsPartitionsOnly); } DWORD BaseCom::ReadWriteFile (BOOL write, BOOL device, BSTR filePath, BSTR *bufferBstr, unsigned __int64 offset, unsigned __int32 size, DWORD *sizeDone) { try { unique_ptr <File> file (device ? new Device (filePath, !write) : new File (filePath, !write)); file->CheckOpened (SRC_POS); file->SeekAt (offset); if (write) { file->Write ((BYTE *) *bufferBstr, size); *sizeDone = size; } else { *sizeDone = file->Read ((BYTE *) *bufferBstr, size); } } catch (SystemException &) { return GetLastError(); } catch (Exception &e) { e.Show (NULL); return ERROR_EXCEPTION_IN_SERVICE; } catch (...) { return ERROR_EXCEPTION_IN_SERVICE; } return ERROR_SUCCESS; } DWORD BaseCom::GetFileSize (BSTR filePath, unsigned __int64 *pSize) { if (!pSize) return ERROR_INVALID_PARAMETER; try { std::wstring path (filePath); File file(filePath, true); file.CheckOpened (SRC_POS); file.GetFileSize (*pSize); } catch (SystemException &) { return GetLastError(); } catch (Exception &e) { e.Show (NULL); return ERROR_EXCEPTION_IN_SERVICE; } catch (...) { return ERROR_EXCEPTION_IN_SERVICE; } return ERROR_SUCCESS; } DWORD BaseCom::DeviceIoControl (BOOL readOnly, BOOL device, BSTR filePath, DWORD dwIoControlCode, BSTR input, BSTR *output) { try { unique_ptr <File> file (device ? new Device (filePath, readOnly == TRUE) : new File (filePath, readOnly == TRUE)); file->CheckOpened (SRC_POS); if (!file->IoCtl (dwIoControlCode, (BYTE *) input, !(BYTE *) input ? 0 : ((DWORD *) ((BYTE *) input))[-1], (BYTE *) *output, !(BYTE *) *output ? 0 : ((DWORD *) ((BYTE *) *output))[-1])) { return GetLastError(); } } catch (SystemException &) { return GetLastError(); } catch (Exception &e) { e.Show (NULL); return ERROR_EXCEPTION_IN_SERVICE; } catch (...) { return ERROR_EXCEPTION_IN_SERVICE; } return ERROR_SUCCESS; } DWORD BaseCom::RegisterFilterDriver (BOOL registerDriver, int filterType) { try { BootEncryption bootEnc (NULL); bootEnc.RegisterFilterDriver (registerDriver ? true : false, (BootEncryption::FilterType) filterType); } catch (SystemException &) { return GetLastError(); } catch (Exception &e) { e.Show (NULL); return ERROR_EXCEPTION_IN_SERVICE; } catch (...) { return ERROR_EXCEPTION_IN_SERVICE; } return ERROR_SUCCESS; } DWORD BaseCom::RegisterSystemFavoritesService (BOOL registerService) { try { BootEncryption bootEnc (NULL); bootEnc.RegisterSystemFavoritesService (registerService); } catch (SystemException &) { return GetLastError(); } catch (Exception &e) { e.Show (NULL); return ERROR_EXCEPTION_IN_SERVICE; } catch (...) { return ERROR_EXCEPTION_IN_SERVICE; } return ERROR_SUCCESS; } DWORD BaseCom::SetDriverServiceStartType (DWORD startType) { try { BootEncryption bootEnc (NULL); bootEnc.SetDriverServiceStartType (startType); } catch (SystemException &) { return GetLastError(); } catch (Exception &e) { e.Show (NULL); return ERROR_EXCEPTION_IN_SERVICE; } catch (...) { return ERROR_EXCEPTION_IN_SERVICE; } return ERROR_SUCCESS; } DWORD BaseCom::WriteLocalMachineRegistryDwordValue (BSTR keyPath, BSTR valueName, DWORD value) { if (!::WriteLocalMachineRegistryDword (keyPath, valueName, value)) return GetLastError(); return ERROR_SUCCESS; } DWORD BaseCom::InstallEfiBootLoader (BOOL preserveUserConfig, BOOL hiddenOSCreation, int pim, int hashAlg) { try { BootEncryption bootEnc (NULL); bootEnc.InstallBootLoader (preserveUserConfig? true : false, hiddenOSCreation? true : false, pim, hashAlg); } catch (SystemException &) { return GetLastError(); } catch (Exception &e) { e.Show (NULL); return ERROR_EXCEPTION_IN_SERVICE; } catch (...) { return ERROR_EXCEPTION_IN_SERVICE; } return ERROR_SUCCESS; } DWORD BaseCom::BackupEfiSystemLoader () { try { BootEncryption bootEnc (NULL); bootEnc.BackupSystemLoader (); } catch (SystemException &) { return GetLastError(); } catch (UserAbort&) { return ERROR_CANCELLED; } catch (Exception &e) { e.Show (NULL); return ERROR_EXCEPTION_IN_SERVICE; } catch (...) { return ERROR_EXCEPTION_IN_SERVICE; } return ERROR_SUCCESS; } DWORD BaseCom::RestoreEfiSystemLoader () { try { BootEncryption bootEnc (NULL); bootEnc.RestoreSystemLoader (); } catch (SystemException &) { return GetLastError(); } catch (Exception &e) { e.Show (NULL); return ERROR_EXCEPTION_IN_SERVICE; } catch (...) { return ERROR_EXCEPTION_IN_SERVICE; } return ERROR_SUCCESS; } DWORD BaseCom::GetEfiBootDeviceNumber (BSTR* pSdn) { if (!pSdn || !(*pSdn) || ((((DWORD *) ((BYTE *) *pSdn))[-1]) < sizeof (STORAGE_DEVICE_NUMBER))) return ERROR_INVALID_PARAMETER; try { BootEncryption bootEnc (NULL); bootEnc.GetEfiBootDeviceNumber ((PSTORAGE_DEVICE_NUMBER) *pSdn); } catch (SystemException &) { return GetLastError(); } catch (Exception &e) { e.Show (NULL); return ERROR_EXCEPTION_IN_SERVICE; } catch (...) { return ERROR_EXCEPTION_IN_SERVICE; } return ERROR_SUCCESS; } DWORD BaseCom::GetSecureBootConfig (BOOL* pSecureBootEnabled, BOOL *pVeraCryptKeysLoaded) { if (!pSecureBootEnabled || !pVeraCryptKeysLoaded) return ERROR_INVALID_PARAMETER; try { BootEncryption bootEnc (NULL); bootEnc.GetSecureBootConfig (pSecureBootEnabled, pVeraCryptKeysLoaded); } catch (SystemException &) { return GetLastError(); } catch (Exception &e) { e.Show (NULL); return ERROR_EXCEPTION_IN_SERVICE; } catch (...) { return ERROR_EXCEPTION_IN_SERVICE; } return ERROR_SUCCESS; } DWORD BaseCom::WriteEfiBootSectorUserConfig (DWORD userConfig, BSTR customUserMessage, int pim, int hashAlg) { if (!customUserMessage) return ERROR_INVALID_PARAMETER; try { DWORD maxSize = ((DWORD *) ((BYTE *) customUserMessage))[-1]; char* msg = (char*) *customUserMessage; if (maxSize > 0) msg [maxSize - 1] = 0; std::string msgStr = maxSize > 0 ? msg : ""; BootEncryption bootEnc (NULL); bootEnc.WriteEfiBootSectorUserConfig ((byte) userConfig, msgStr, pim, hashAlg); } catch (SystemException &) { return GetLastError(); } catch (Exception &e) { e.Show (NULL); return ERROR_EXCEPTION_IN_SERVICE; } catch (...) { return ERROR_EXCEPTION_IN_SERVICE; } return ERROR_SUCCESS; } DWORD BaseCom::UpdateSetupConfigFile (BOOL bForInstall) { try { BootEncryption bootEnc (NULL); bootEnc.UpdateSetupConfigFile (bForInstall? true : false); } catch (SystemException &) { return GetLastError(); } catch (Exception &e) { e.Show (NULL); return ERROR_EXCEPTION_IN_SERVICE; } catch (...) { return ERROR_EXCEPTION_IN_SERVICE; } return ERROR_SUCCESS; }