diff options
author | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2023-06-30 23:03:56 +0200 |
---|---|---|
committer | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2023-06-30 23:03:56 +0200 |
commit | a438e19f61836ef0ba658daca0f434c927c45a0c (patch) | |
tree | 852c163d52f9f8991c0fdb96b8c2e12f852e13a4 /src/ExpandVolume | |
parent | 4defec4aebdf3a9ce69341733ff2c4cf79d6449c (diff) | |
download | VeraCrypt-a438e19f61836ef0ba658daca0f434c927c45a0c.tar.gz VeraCrypt-a438e19f61836ef0ba658daca0f434c927c45a0c.zip |
Windows: Support drag-n-drop of files in Expander for mounting. Fix drag-n-drop of keyfiles.
To fix drag-n-drop of keyfiles, we remove the password drop target since it was blocking the standard drop of files and drop target doesn't work because of UIPI restrictions across privilege levels since Expander is started elevated
Diffstat (limited to 'src/ExpandVolume')
-rw-r--r-- | src/ExpandVolume/WinMain.cpp | 36 |
1 files changed, 12 insertions, 24 deletions
diff --git a/src/ExpandVolume/WinMain.cpp b/src/ExpandVolume/WinMain.cpp index 69f4c23b..c1ee3308 100644 --- a/src/ExpandVolume/WinMain.cpp +++ b/src/ExpandVolume/WinMain.cpp @@ -206,6 +206,7 @@ static void InitMainDialog (HWND hwndDlg) /* Call the common dialog init code */ InitDialog (hwndDlg); LocalizeDialog (hwndDlg, NULL); + DragAcceptFiles (hwndDlg, TRUE); SendMessage (GetDlgItem (hwndDlg, IDC_VOLUME), CB_LIMITTEXT, TC_MAX_PATH, 0); SetWindowTextW (hwndDlg, lpszTitle); @@ -516,17 +517,6 @@ BOOL CALLBACK ExtcvPasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARA SetWindowPos (hwndDlg, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); } - - if (!bSecureDesktopOngoing) - { - PasswordEditDropTarget* pTarget = new PasswordEditDropTarget (); - if (pTarget->Register (hwndDlg)) - { - SetWindowLongPtr (hwndDlg, DWLP_USER, (LONG_PTR) pTarget); - } - else - delete pTarget; - } } return 0; @@ -819,19 +809,6 @@ BOOL CALLBACK ExtcvPasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARA DragFinish (hdrop); } return 1; - - case WM_NCDESTROY: - { - /* unregister drap-n-drop support */ - PasswordEditDropTarget* pTarget = (PasswordEditDropTarget*) GetWindowLongPtr (hwndDlg, DWLP_USER); - if (pTarget) - { - SetWindowLongPtr (hwndDlg, DWLP_USER, (LONG_PTR) 0); - pTarget->Revoke (); - pTarget->Release(); - } - } - return 0; } return 0; @@ -1044,6 +1021,17 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa localcleanup (); return 0; + case WM_DROPFILES: + { + HDROP hdrop = (HDROP) wParam; + DragQueryFile (hdrop, 0, szFileName, ARRAYSIZE (szFileName)); + DragFinish (hdrop); + + AddComboItem (GetDlgItem (hwndDlg, IDC_VOLUME), szFileName, bHistory); + SetFocus (GetDlgItem (hwndDlg, IDOK)); + } + return 1; + case WM_COMMAND: if (lw == IDCANCEL || lw == IDC_EXIT) |