VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common/Dlgcode.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/Common/Dlgcode.c')
-rw-r--r--src/Common/Dlgcode.c71
1 files changed, 61 insertions, 10 deletions
diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c
index 2c707f5d..c3430525 100644
--- a/src/Common/Dlgcode.c
+++ b/src/Common/Dlgcode.c
@@ -2070,3 +2070,4 @@ void HandlePasswordEditWmChar (HWND hwnd, WPARAM wParam)
-// Protects an input field from having its content updated by a Paste action (call ToBootPwdField() to use this).
+
+/* Protects an input field from having its content updated by a paste action */
static LRESULT CALLBACK BootPwdFieldProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
@@ -2074,3 +2075,3 @@ static LRESULT CALLBACK BootPwdFieldProc (HWND hwnd, UINT message, WPARAM wParam
WNDPROC wp = (WNDPROC) GetWindowLongPtrW (hwnd, GWLP_USERDATA);
-
+
switch (message)
@@ -2078,3 +2079,5 @@ static LRESULT CALLBACK BootPwdFieldProc (HWND hwnd, UINT message, WPARAM wParam
case WM_PASTE:
+ Error ("ERROR_PASTE_ACTION", GetParent(hwnd));
return 1;
+
case WM_CHAR:
@@ -2083,3 +2086,2 @@ static LRESULT CALLBACK BootPwdFieldProc (HWND hwnd, UINT message, WPARAM wParam
}
-
return CallWindowProcW (wp, hwnd, message, wParam, lParam);
@@ -2087,3 +2089,2 @@ static LRESULT CALLBACK BootPwdFieldProc (HWND hwnd, UINT message, WPARAM wParam
-
// Protects an input field from having its content updated by a Paste action. Used for pre-boot password
@@ -2106,2 +2107,8 @@ void ToBootPwdField (HWND hwndDlg, UINT ctrlId)
+BOOL CheckIsIMESupported ()
+{
+ if (himm32dll == NULL)
+ return FALSE;
+ return TRUE;
+}
// Ensures that a warning is displayed when user is pasting a password longer than the maximum
@@ -2936,3 +2943,3 @@ SelectAlgo (HWND hComboBox, int *algo_id)
back to a default */
-
+
*algo_id = (int) SendMessage (hComboBox, CB_GETITEMDATA, 0, 0);
@@ -5463,2 +5470,49 @@ BOOL BrowseFiles (HWND hwndDlg, char *stringId, wchar_t *lpszFileName, BOOL keep
+BOOL BrowseFile (HWND hwndDlg, char *stringId, wchar_t *initialDir)
+{
+ OPENFILENAMEW ofn;
+ wchar_t file[TC_MAX_PATH] = { 0 };
+ wchar_t filter[1024];
+ BOOL status = FALSE;
+
+ CoInitialize (NULL);
+
+ ZeroMemory (&ofn, sizeof (ofn));
+
+ if (initialDir)
+ {
+ ofn.lpstrInitialDir = initialDir;
+ }
+
+ ofn.lStructSize = sizeof (ofn);
+ ofn.hwndOwner = hwndDlg;
+ StringCbPrintfW (filter, sizeof(filter), L"%ls (*.*)%c*.*%c",
+ GetString ("ALL_FILES"), 0, 0);
+ ofn.lpstrFilter = filter;
+ ofn.nFilterIndex = 1;
+ ofn.lpstrFile = NULL;
+ ofn.nMaxFile = sizeof (file) / sizeof (file[0]);
+ ofn.lpstrTitle = GetString (stringId);
+ ofn.lpstrDefExt = NULL;
+ ofn.Flags = OFN_HIDEREADONLY
+ | OFN_PATHMUSTEXIST
+ | OFN_DONTADDTORECENT;
+
+ SystemFileSelectorCallerThreadId = GetCurrentThreadId();
+ SystemFileSelectorCallPending = TRUE;
+
+ if (!GetOpenFileNameW (&ofn))
+ goto ret;
+
+ SystemFileSelectorCallPending = FALSE;
+
+ status = TRUE;
+
+ret:
+ SystemFileSelectorCallPending = FALSE;
+ ResetCurrentDirectory();
+ CoUninitialize();
+
+ return status;
+}
@@ -9984,4 +10038,2 @@ BOOL PrintHardCopyTextUTF16 (wchar_t *text, wchar_t *title, size_t textByteLen)
}
-
-
BOOL IsNonInstallMode ()
@@ -10084,3 +10136,2 @@ BOOL IsNonInstallMode ()
-
LRESULT SetCheckBox (HWND hwndDlg, int dlgItem, BOOL state)
@@ -11625,3 +11676,3 @@ BYTE *MapResource (wchar_t *resourceType, int resourceId, PDWORD size)
HRSRC hRes;
- HINSTANCE hResInst = NULL;
+ HINSTANCE hResInst = NULL;
@@ -11637,3 +11688,3 @@ BYTE *MapResource (wchar_t *resourceType, int resourceId, PDWORD size)
hResL = LoadResource (hResInst, hRes);
-
+
if (size != NULL)