VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2017-06-07 23:16:05 (GMT)
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2017-06-07 23:17:48 (GMT)
commit5c009d449e19f38e22a940ea517fde617761f037 (patch)
tree4b982b5a50ce5912ce92e5cffc8dac547cd96653 /src/Common
parent9b0cc3d6795b8c0f38e3986bdddcb91e8aa384a1 (diff)
downloadVeraCrypt-5c009d449e19f38e22a940ea517fde617761f037.zip
VeraCrypt-5c009d449e19f38e22a940ea517fde617761f037.tar.gz
Windows: Validate XML format of EFI DcsProp after user editing and before writing it to disk. Enhance UI handling of DcsProp editing and PlatformInfo display.
Diffstat (limited to 'src/Common')
-rw-r--r--src/Common/Dlgcode.c25
-rw-r--r--src/Common/Dlgcode.h1
-rw-r--r--src/Common/Language.xml6
3 files changed, 25 insertions, 7 deletions
diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c
index 67e6b37..33e0251 100644
--- a/src/Common/Dlgcode.c
+++ b/src/Common/Dlgcode.c
@@ -3361,13 +3361,13 @@ wstring GetDecoyOsInstructionsString (void)
}
struct _TEXT_EDIT_DIALOG_PARAM {
- int Type;
+ BOOL ReadOnly;
std::string& Text;
const WCHAR* Title;
HWND Parent;
- _TEXT_EDIT_DIALOG_PARAM(int _type, const WCHAR* title, std::string& _text) : Title(title), Text(_text), Type(_type) {}
+ _TEXT_EDIT_DIALOG_PARAM(BOOL _readOnly, const WCHAR* title, std::string& _text) : Title(title), Text(_text), ReadOnly(_readOnly) {}
_TEXT_EDIT_DIALOG_PARAM& operator=( const _TEXT_EDIT_DIALOG_PARAM& other) {
- Type = other.Type;
+ ReadOnly = other.ReadOnly;
Text = other.Text;
Title = other.Title;
return *this;
@@ -3375,9 +3375,9 @@ struct _TEXT_EDIT_DIALOG_PARAM {
};
typedef struct _TEXT_EDIT_DIALOG_PARAM TEXT_INFO_DIALOG_PARAM,*TEXT_INFO_DIALOG_PARAM_PTR;
-INT_PTR TextEditDialogBox (int type, HWND parent, const WCHAR* Title, std::string& text)
+INT_PTR TextEditDialogBox (BOOL readOnly, HWND parent, const WCHAR* Title, std::string& text)
{
- TEXT_INFO_DIALOG_PARAM pm(type, Title, text);
+ TEXT_INFO_DIALOG_PARAM pm(readOnly, Title, text);
return DialogBoxParamW (hInst, MAKEINTRESOURCEW (IDD_TEXT_EDIT_DLG), parent, (DLGPROC) TextEditDlgProc, (LPARAM) &pm);
}
@@ -3398,6 +3398,14 @@ BOOL CALLBACK TextEditDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
// Left margin for rich edit text field
SendMessage (GetDlgItem (hwndDlg, IDC_INFO_BOX_TEXT), EM_SETMARGINS, (WPARAM) EC_LEFTMARGIN, (LPARAM) CompensateXDPI (4));
+ if (prm->ReadOnly)
+ {
+ // switch rich edit control to ReadOnly
+ SendMessage(GetDlgItem (hwndDlg, IDC_INFO_BOX_TEXT), ES_READONLY, TRUE, 0);
+ // hide cancel button
+ ShowWindow(GetDlgItem(hwndDlg, IDCANCEL), SW_HIDE);
+ }
+
SendMessage (hwndDlg, TC_APPMSG_LOAD_TEXT_BOX_CONTENT, 0, 0);
}
return 0;
@@ -3405,8 +3413,11 @@ BOOL CALLBACK TextEditDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
case WM_COMMAND:
if (lw == IDOK )
{
- prm->Text.resize(GetWindowTextLengthA (GetDlgItem (hwndDlg, IDC_INFO_BOX_TEXT)) + 1);
- GetWindowTextA (GetDlgItem (hwndDlg, IDC_INFO_BOX_TEXT), &(prm->Text)[0], prm->Text.size());
+ if (!prm->ReadOnly)
+ {
+ prm->Text.resize(GetWindowTextLengthA (GetDlgItem (hwndDlg, IDC_INFO_BOX_TEXT)) + 1);
+ GetWindowTextA (GetDlgItem (hwndDlg, IDC_INFO_BOX_TEXT), &(prm->Text)[0], prm->Text.size());
+ }
NormalCursor ();
EndDialog (hwndDlg, IDOK);
return 1;
diff --git a/src/Common/Dlgcode.h b/src/Common/Dlgcode.h
index 1a66e10..a585218 100644
--- a/src/Common/Dlgcode.h
+++ b/src/Common/Dlgcode.h
@@ -624,6 +624,7 @@ inline std::wstring AppendSrcPos (const wchar_t* msg, const char* srcPos)
return std::wstring (msg? msg : L"") + L"\n\nSource: " + SingleStringToWide (srcPos);
}
void UpdateMountableHostDeviceList ();
+INT_PTR TextEditDialogBox (BOOL readOnly, HWND parent, const WCHAR* Title, std::string& text);
// Display a wait dialog while calling the provided callback with the given parameter
typedef void (CALLBACK* WaitThreadProc)(void* pArg, HWND hWaitDlg);
diff --git a/src/Common/Language.xml b/src/Common/Language.xml
index a2c1312..36c3a42 100644
--- a/src/Common/Language.xml
+++ b/src/Common/Language.xml
@@ -1415,6 +1415,12 @@
<string lang="en" key="RESCUE_DISK_EFI_NON_WIZARD_CREATION">The Rescue Disk image has been created and stored in this file:\n%s\n\nNow you need to extract the Rescue Disk image to a USB stick that is formatted as FAT/FAT32.\n\nIMPORTANT: Note that the zip file must be extracted directly to the root of the USB stick. For example, if the drive letter of the USB stick is E: then extracting the zip file should create a folder E:\\EFI on the USB stick.\n\nAfter you create the Rescue Disk, select 'System' > 'Verify Rescue Disk' to verify that it has been correctly created.</string>
<control lang="en" key="IDC_SECURE_DESKTOP_PASSWORD_ENTRY">Use Secure Desktop for password entry</control>
<string lang="en" key="ERR_REFS_INVALID_VOLUME_SIZE">The volume file size specified in the command line is incompatible with selected ReFS filesystem.</string>
+ <control lang="en" key="IDC_EDIT_DCSPROP">Edit Boot Loader Configuration</control>
+ <control lang="en" key="IDC_SHOW_PLATFORMINFO">Display EFI Platform Information</control>
+ <string lang="en" key="BOOT_LOADER_CONFIGURATION_FILE">Boot Loader Configuration File</string>
+ <string lang="en" key="EFI_PLATFORM_INFORMATION">EFI Platform Information</string>
+ <string lang="en" key="EDIT_DCSPROP_FOR_ADVANCED_ONLY">WARNING: Inexperienced users should never attempt to manually edit boot loader configurations.\n\nContinue?</string>
+ <string lang="en" key="DCSPROP_XML_VALIDATION_FAILED">WARNING: Failed to validate the XML format of the Boot Loader configuration. Please check your modifications.</string>
</localization>
<!-- XML Schema -->
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">