VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/ExpandVolume/WinMain.cpp
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/ExpandVolume/WinMain.cpp
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/ExpandVolume/WinMain.cpp')
-rw-r--r--src/ExpandVolume/WinMain.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/ExpandVolume/WinMain.cpp b/src/ExpandVolume/WinMain.cpp
index 10c1af40..49422319 100644
--- a/src/ExpandVolume/WinMain.cpp
+++ b/src/ExpandVolume/WinMain.cpp
@@ -490,6 +490,17 @@ 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;
@@ -782,6 +793,19 @@ 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;