mirror of
https://github.com/veracrypt/VeraCrypt
synced 2024-11-30 23:13:31 +01:00
Windows: Solve PIN blocked issue when trying to mount a volume right after configuring the PKCS#11 module. Always ensure that we are using a valid window handle as a parent.
This commit is contained in:
parent
5f252f2c50
commit
2b8aa2df16
@ -9864,7 +9864,10 @@ BOOL InitSecurityTokenLibrary (HWND hwndDlg)
|
|||||||
PinRequestHandler(HWND hwnd) : m_hwnd(hwnd) {}
|
PinRequestHandler(HWND hwnd) : m_hwnd(hwnd) {}
|
||||||
virtual void operator() (string &str)
|
virtual void operator() (string &str)
|
||||||
{
|
{
|
||||||
if (DialogBoxParamW (hInst, MAKEINTRESOURCEW (IDD_TOKEN_PASSWORD), m_hwnd, (DLGPROC) SecurityTokenPasswordDlgProc, (LPARAM) &str) == IDCANCEL)
|
HWND hParent = IsWindow (m_hwnd)? m_hwnd : GetActiveWindow();
|
||||||
|
if (!hParent)
|
||||||
|
hParent = GetForegroundWindow ();
|
||||||
|
if (DialogBoxParamW (hInst, MAKEINTRESOURCEW (IDD_TOKEN_PASSWORD), hParent, (DLGPROC) SecurityTokenPasswordDlgProc, (LPARAM) &str) == IDCANCEL)
|
||||||
throw UserAbort (SRC_POS);
|
throw UserAbort (SRC_POS);
|
||||||
|
|
||||||
if (hCursor != NULL)
|
if (hCursor != NULL)
|
||||||
@ -9878,7 +9881,10 @@ BOOL InitSecurityTokenLibrary (HWND hwndDlg)
|
|||||||
WarningHandler(HWND hwnd) : m_hwnd(hwnd) {}
|
WarningHandler(HWND hwnd) : m_hwnd(hwnd) {}
|
||||||
virtual void operator() (const Exception &e)
|
virtual void operator() (const Exception &e)
|
||||||
{
|
{
|
||||||
e.Show (m_hwnd);
|
HWND hParent = IsWindow (m_hwnd)? m_hwnd : GetActiveWindow();
|
||||||
|
if (!hParent)
|
||||||
|
hParent = GetForegroundWindow ();
|
||||||
|
e.Show (hParent);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user