VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common
diff options
context:
space:
mode:
Diffstat (limited to 'src/Common')
-rw-r--r--src/Common/Common.rc35
-rw-r--r--src/Common/Dlgcode.c50
-rw-r--r--src/Common/Dlgcode.h1
3 files changed, 61 insertions, 25 deletions
diff --git a/src/Common/Common.rc b/src/Common/Common.rc
index 233abd7a..be7e171c 100644
--- a/src/Common/Common.rc
+++ b/src/Common/Common.rc
@@ -204,28 +204,28 @@ BEGIN
CONTROL "",IDC_INFO_BOX_TEXT,"RichEdit20A",ES_MULTILINE | ES_READONLY | ES_NUMBER | WS_BORDER | WS_VSCROLL | WS_TABSTOP,5,6,361,188
END
-IDD_KEYFILE_GENERATOR DIALOGEX 0, 0, 308, 325
+IDD_KEYFILE_GENERATOR DIALOGEX 0, 0, 357, 325
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "VeraCrypt - Keyfile Generator"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
- DEFPUSHBUTTON "Close",IDCLOSE,237,10,59,14
- COMBOBOX IDC_PRF_ID,79,49,91,90,CBS_DROPDOWNLIST | WS_TABSTOP
- PUSHBUTTON "Generate and Save Keyfile...",IDC_GENERATE_AND_SAVE_KEYFILE,92,302,141,14
- LTEXT "IMPORTANT: Move your mouse as randomly as possible within this window. The longer you move it, the better. This significantly increases the cryptographic strength of the keyfile.",IDT_KEYFILE_GENERATOR_NOTE,11,5,213,33
- CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,1,40,307,1,WS_EX_STATICEDGE
- RTEXT "Mixing PRF:",IDT_PRF,6,51,67,10,SS_CENTERIMAGE
- GROUPBOX "Current Pool Content",IDT_POOL_CONTENTS,6,70,296,170
- CONTROL "",IDC_POOL_CONTENTS,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,16,83,282,148,WS_EX_TRANSPARENT
- CONTROL "Display pool content",IDC_DISPLAY_POOL_CONTENTS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,191,51,111,10
- LTEXT "Number of keyfiles:",IDT_NUMBER_KEYFILES,9,247,75,8
- EDITTEXT IDC_NUMBER_KEYFILES,92,244,51,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER
- LTEXT "Keyfiles base name:",IDT_KEYFILES_BASE_NAME,9,287,75,8
- EDITTEXT IDC_KEYFILES_BASE_NAME,92,284,141,14,ES_AUTOHSCROLL
- LTEXT "Keyfiles size (in Bytes):",IDT_KEYFILES_SIZE,9,266,75,8
- EDITTEXT IDC_KEYFILES_SIZE,92,264,51,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER
+ DEFPUSHBUTTON "Close",IDCLOSE,291,10,59,14
+ COMBOBOX IDC_PRF_ID,97,49,91,90,CBS_DROPDOWNLIST | WS_TABSTOP
+ CONTROL "Display pool content",IDC_DISPLAY_POOL_CONTENTS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,209,51,141,10
+ EDITTEXT IDC_NUMBER_KEYFILES,124,244,51,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER
+ EDITTEXT IDC_KEYFILES_SIZE,124,264,51,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER
CONTROL "Random size ( 64 <-> 1048576 )",IDC_KEYFILES_RANDOM_SIZE,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,149,266,140,10
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,181,266,174,10
+ EDITTEXT IDC_KEYFILES_BASE_NAME,124,284,141,14,ES_AUTOHSCROLL
+ PUSHBUTTON "Generate and Save Keyfile...",IDC_GENERATE_AND_SAVE_KEYFILE,124,302,141,14
+ LTEXT "IMPORTANT: Move your mouse as randomly as possible within this window. The longer you move it, the better. This significantly increases the cryptographic strength of the keyfile.",IDT_KEYFILE_GENERATOR_NOTE,11,5,271,33
+ CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,1,40,356,1,WS_EX_STATICEDGE
+ RTEXT "Mixing PRF:",IDT_PRF,7,51,85,10,SS_CENTERIMAGE
+ GROUPBOX "Current Pool Content",IDT_POOL_CONTENTS,6,70,344,170
+ CONTROL "",IDC_POOL_CONTENTS,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,16,83,323,148,WS_EX_TRANSPARENT
+ RTEXT "Number of keyfiles:",IDT_NUMBER_KEYFILES,9,247,110,8
+ RTEXT "Keyfiles base name:",IDT_KEYFILES_BASE_NAME,9,287,110,8
+ RTEXT "Keyfiles size (in Bytes):",IDT_KEYFILES_SIZE,9,266,110,8
END
IDD_MULTI_CHOICE_DLG DIALOGEX 0, 0, 167, 322
@@ -402,7 +402,6 @@ BEGIN
IDD_KEYFILE_GENERATOR, DIALOG
BEGIN
LEFTMARGIN, 7
- RIGHTMARGIN, 299
TOPMARGIN, 7
BOTTOMMARGIN, 321
END
diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c
index a295d5b5..65801bea 100644
--- a/src/Common/Dlgcode.c
+++ b/src/Common/Dlgcode.c
@@ -6592,6 +6592,43 @@ BOOL CALLBACK WaitDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
}
}
+
+void BringToForeground(HWND hWnd)
+{
+ if(!::IsWindow(hWnd)) return;
+
+ DWORD lockTimeOut = 0;
+ HWND hCurrWnd = ::GetForegroundWindow();
+ DWORD dwThisTID = ::GetCurrentThreadId(),
+ dwCurrTID = ::GetWindowThreadProcessId(hCurrWnd,0);
+
+ if(dwThisTID != dwCurrTID)
+ {
+ ::AttachThreadInput(dwThisTID, dwCurrTID, TRUE);
+
+ ::SystemParametersInfo(SPI_GETFOREGROUNDLOCKTIMEOUT,0,&lockTimeOut,0);
+ ::SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT,0,0,SPIF_SENDWININICHANGE | SPIF_UPDATEINIFILE);
+
+ ::AllowSetForegroundWindow(ASFW_ANY);
+ }
+
+ ::SetForegroundWindow(hWnd);
+
+ if(dwThisTID != dwCurrTID)
+ {
+ ::SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT,0,(PVOID)lockTimeOut,SPIF_SENDWININICHANGE | SPIF_UPDATEINIFILE);
+ ::AttachThreadInput(dwThisTID, dwCurrTID, FALSE);
+ }
+
+#ifdef TCMOUNT
+ if (hWnd == MainDlg)
+ {
+ SetFocus (hWnd);
+ ::SendMessage(hWnd, WM_NEXTDLGCTL, (WPARAM) GetDlgItem (hWnd, IDC_DRIVELIST), 1L);
+ }
+#endif
+}
+
void ShowWaitDialog(HWND hwnd, BOOL bUseHwndAsParent, WaitThreadProc callback, void* pArg)
{
HWND hParent = (hwnd && bUseHwndAsParent)? hwnd : GetDesktopWindow();
@@ -6605,24 +6642,23 @@ void ShowWaitDialog(HWND hwnd, BOOL bUseHwndAsParent, WaitThreadProc callback, v
}
else
{
+ BOOL bIsForeground = FALSE;
WaitDialogDisplaying = TRUE;
if (hwnd)
+ {
+ if (GetForegroundWindow () == hwnd)
+ bIsForeground = TRUE;
EnableWindow (hwnd, FALSE);
+ }
else
EnableWindow (MainDlg, FALSE);
- finally_do_arg (HWND, hwnd, { if (finally_arg) EnableWindow(finally_arg, TRUE); else EnableWindow (MainDlg, TRUE);});
+ finally_do_arg2 (HWND, hwnd, BOOL, bIsForeground, { if (finally_arg) {EnableWindow(finally_arg, TRUE); if (finally_arg2) BringToForeground (finally_arg);} else EnableWindow (MainDlg, TRUE);});
DialogBoxParamW (hInst,
MAKEINTRESOURCEW (IDD_STATIC_MODAL_WAIT_DLG), hParent,
(DLGPROC) WaitDlgProc, (LPARAM) &threadParam);
WaitDialogDisplaying = FALSE;
-
- if (hwnd && IsWindowVisible(hwnd) && !bUseHwndAsParent)
- {
- SetForegroundWindow(hwnd);
- BringWindowToTop(hwnd);
- }
}
}
diff --git a/src/Common/Dlgcode.h b/src/Common/Dlgcode.h
index 5d8d7e29..a7f4affd 100644
--- a/src/Common/Dlgcode.h
+++ b/src/Common/Dlgcode.h
@@ -568,6 +568,7 @@ inline std::wstring AppendSrcPos (const wchar_t* msg, const char* srcPos)
// Display a wait dialog while calling the provided callback with the given parameter
typedef void (CALLBACK* WaitThreadProc)(void* pArg, HWND hWaitDlg);
+void BringToForeground(HWND hWnd);
void ShowWaitDialog(HWND hwnd, BOOL bUseHwndAsParent, WaitThreadProc callback, void* pArg);
#endif // __cplusplus