mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2025-11-11 19:08:26 -06:00
Windows: Support direct password drag-n-drop from external applications (e.g. KeePass) which is more secure than using clipboard.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user