VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Mount/Mount.c
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2015-06-10 00:58:50 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2015-06-10 01:13:56 +0200
commit6be12f488956e6995830386b64ca3c0dcd77389a (patch)
tree1035c2d5dce0c2d76490381674466884ed7f8fde /src/Mount/Mount.c
parentb7eadfd310bc61e7a982dc8bce4eb32038a6fa09 (diff)
downloadVeraCrypt-6be12f488956e6995830386b64ca3c0dcd77389a.tar.gz
VeraCrypt-6be12f488956e6995830386b64ca3c0dcd77389a.zip
Windows: Implement waiting dialog for Auto-Mount Devices operations to avoid freezing GUI.
Diffstat (limited to 'src/Mount/Mount.c')
-rw-r--r--src/Mount/Mount.c33
1 files changed, 29 insertions, 4 deletions
diff --git a/src/Mount/Mount.c b/src/Mount/Mount.c
index 83767be1..88dbfa5d 100644
--- a/src/Mount/Mount.c
+++ b/src/Mount/Mount.c
@@ -4415,9 +4415,9 @@ retry:
return status;
}
-static BOOL MountAllDevices (HWND hwndDlg, BOOL bPasswordPrompt)
+static BOOL MountAllDevicesThreadCode (HWND hwndDlg, BOOL bPasswordPrompt)
{
- HWND driveList = GetDlgItem (hwndDlg, IDC_DRIVELIST);
+ HWND driveList = GetDlgItem (MainDlg, IDC_DRIVELIST);
int selDrive = ListView_GetSelectionMark (driveList);
BOOL shared = FALSE, status = FALSE, bHeaderBakRetry = FALSE;
int mountedVolCount = 0;
@@ -4536,7 +4536,7 @@ static BOOL MountAllDevices (HWND hwndDlg, BOOL bPasswordPrompt)
if (mounted == 2)
shared = TRUE;
- LoadDriveLetters (hwndDlg, driveList, (HIWORD (GetItemLong (GetDlgItem (hwndDlg, IDC_DRIVELIST), selDrive))));
+ LoadDriveLetters (hwndDlg, driveList, (HIWORD (GetItemLong (GetDlgItem (MainDlg, IDC_DRIVELIST), selDrive))));
selDrive++;
if (bExplore)
@@ -4656,13 +4656,38 @@ ret:
if (UsePreferences)
bCacheInDriver = bCacheInDriverDefault;
- EnableDisableButtons (hwndDlg);
+ EnableDisableButtons (MainDlg);
NormalCursor();
return status;
}
+typedef struct
+{
+ BOOL bPasswordPrompt;
+ BOOL bRet;
+} MountAllDevicesThreadParam;
+
+void CALLBACK mountAllDevicesThreadProc(void* pArg, HWND hwndDlg)
+{
+ MountAllDevicesThreadParam* threadParam =(MountAllDevicesThreadParam*) pArg;
+ BOOL bPasswordPrompt = threadParam->bPasswordPrompt;
+
+ threadParam->bRet = MountAllDevicesThreadCode (hwndDlg, bPasswordPrompt);
+}
+
+static BOOL MountAllDevices (HWND hwndDlg, BOOL bPasswordPrompt)
+{
+ MountAllDevicesThreadParam param;
+ param.bPasswordPrompt = bPasswordPrompt;
+ param.bRet = FALSE;
+
+ ShowWaitDialog (hwndDlg, TRUE, mountAllDevicesThreadProc, &param);
+
+ return param.bRet;
+}
+
static void ChangePassword (HWND hwndDlg)
{
INT_PTR result;