diff options
author | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2015-02-09 10:57:39 +0100 |
---|---|---|
committer | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2015-02-09 11:01:26 +0100 |
commit | 2b8aa2df16c70bcf0bd0b79428f4af8cec17e2a6 (patch) | |
tree | 006f3db2e0084b49120ad507bac0758139b2fde1 /src/Common/Dlgcode.c | |
parent | 5f252f2c505cfeed93496a25eff6eef4e9fe5e41 (diff) | |
download | VeraCrypt-2b8aa2df16c70bcf0bd0b79428f4af8cec17e2a6.tar.gz VeraCrypt-2b8aa2df16c70bcf0bd0b79428f4af8cec17e2a6.zip |
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.
Diffstat (limited to 'src/Common/Dlgcode.c')
-rw-r--r-- | src/Common/Dlgcode.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c index 88bb4014..6503c599 100644 --- a/src/Common/Dlgcode.c +++ b/src/Common/Dlgcode.c @@ -9864,7 +9864,10 @@ BOOL InitSecurityTokenLibrary (HWND hwndDlg) PinRequestHandler(HWND hwnd) : m_hwnd(hwnd) {}
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);
if (hCursor != NULL)
@@ -9878,7 +9881,10 @@ BOOL InitSecurityTokenLibrary (HWND hwndDlg) WarningHandler(HWND hwnd) : m_hwnd(hwnd) {}
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);
}
};
|