1
0
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:
Mounir IDRASSI
2020-07-06 18:00:25 +02:00
parent b54729de48
commit ff391d9a6a
5 changed files with 597 additions and 2 deletions

View File

@@ -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;