VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Format
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2020-07-06 18:00:25 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2020-07-06 18:18:47 +0200
commitff391d9a6afb856e20e827edbad0aff9e6caffe3 (patch)
treee754e62b246821b7ebf222de94e6785b724776c7 /src/Format
parentb54729de48020ca18faa82a92e95bcc130b454ff (diff)
downloadVeraCrypt-ff391d9a6afb856e20e827edbad0aff9e6caffe3.tar.gz
VeraCrypt-ff391d9a6afb856e20e827edbad0aff9e6caffe3.zip
Windows: Support direct password drag-n-drop from external applications (e.g. KeePass) which is more secure than using clipboard.
Diffstat (limited to 'src/Format')
-rw-r--r--src/Format/Tcformat.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/src/Format/Tcformat.c b/src/Format/Tcformat.c
index dd999f0c..ab7b165b 100644
--- a/src/Format/Tcformat.c
+++ b/src/Format/Tcformat.c
@@ -420,8 +420,8 @@ static void WipePasswordsAndKeyfiles (bool bFull)
// Attempt to wipe passwords stored in the input field buffers
wmemset (tmp, L'X', MAX_PASSWORD);
tmp [MAX_PASSWORD] = 0;
- SetWindowText (hPasswordInputField, tmp);
- SetWindowText (hVerifyPasswordInputField, tmp);
+ SetWindowText (hPasswordInputField, tmp);
+ SetWindowText (hVerifyPasswordInputField, tmp);
burn (&szVerify[0], sizeof (szVerify));
burn (&volumePassword, sizeof (volumePassword));
@@ -6372,6 +6372,14 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
strcpy (szRawPassword, "q");
#endif
+ PasswordEditDropTarget* pTarget = new PasswordEditDropTarget ();
+ if (pTarget->Register (hwndDlg))
+ {
+ SetWindowLongPtr (hwndDlg, DWLP_USER, (LONG_PTR) pTarget);
+ }
+ else
+ delete pTarget;
+
PostMessage (hwndDlg, TC_APPMSG_PERFORM_POST_WMINIT_TASKS, 0, 0);
}
return 0;
@@ -8995,6 +9003,22 @@ ovf_end:
case WM_CLOSE:
PostMessage (hwndDlg, TC_APPMSG_FORMAT_USER_QUIT, 0, 0);
return 1;
+
+ case WM_NCDESTROY:
+ {
+ hPasswordInputField = NULL;
+ hVerifyPasswordInputField = NULL;
+
+ /* 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;