VeraCrypt
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2014-09-21 21:48:59 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2014-11-08 23:23:31 +0100
commitb80ee2b7b9e0ff31b651cbc639e74babb58798f3 (patch)
treeafa727c02baf43af8e7f0faea3e35da6cf6273c7
parent8a028aca45ccb5bbce20c51050a3bf0f11d36a78 (diff)
downloadVeraCrypt-b80ee2b7b9e0ff31b651cbc639e74babb58798f3.tar.gz
VeraCrypt-b80ee2b7b9e0ff31b651cbc639e74babb58798f3.zip
Windows : display the correct tray icon when explorer is restarted (i.e. after an explorer crash).
-rw-r--r--src/Mount/Mount.c28
-rw-r--r--src/Mount/Mount.h2
2 files changed, 18 insertions, 12 deletions
diff --git a/src/Mount/Mount.c b/src/Mount/Mount.c
index 82e6b794..d95124e9 100644
--- a/src/Mount/Mount.c
+++ b/src/Mount/Mount.c
@@ -4404,7 +4404,7 @@ static void Benchmark (HWND hwndDlg)
}
-static BOOL CheckMountList ()
+static BOOL CheckMountList (BOOL bForceTaskBarUpdate)
{
MOUNT_LIST_STRUCT current;
static BootEncryptionStatus newBootEncStatus;
@@ -4413,7 +4413,7 @@ static BOOL CheckMountList ()
GetMountList (&current);
- if ((current.ulMountedDrives != lastUlMountedDrives || bUseDifferentTrayIconIfVolMounted != lastbUseDifferentTrayIconIfVolMounted)
+ if ((bForceTaskBarUpdate || current.ulMountedDrives != lastUlMountedDrives || bUseDifferentTrayIconIfVolMounted != lastbUseDifferentTrayIconIfVolMounted)
&& TaskBarIconMutex != NULL)
{
lastUlMountedDrives = current.ulMountedDrives;
@@ -4422,6 +4422,11 @@ static BOOL CheckMountList ()
TaskBarIconChange (MainDlg, current.ulMountedDrives != 0 && bUseDifferentTrayIconIfVolMounted ? IDI_TRUECRYPT_MOUNTED_ICON : IDI_TRUECRYPT_ICON);
}
+ if (bForceTaskBarUpdate)
+ {
+ return TRUE;
+ }
+
if (LastKnownLogicalDrives != GetLogicalDrives()
|| memcmp (&LastKnownMountList, &current, sizeof (current)) != 0)
{
@@ -4910,7 +4915,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
Silent = FALSE;
GetMountList (&LastKnownMountList);
- SetTimer (hwndDlg, TIMER_ID_MAIN, TIMER_INTERVAL_MAIN, NULL);
+ SetTimer (hwndDlg, TIMER_ID_MAIN, TIMER_INTERVAL_MAIN, NULL);
taskBarCreatedMsg = RegisterWindowMessage ("TaskbarCreated");
@@ -5065,7 +5070,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
case WM_TIMER:
{
// Check mount list and update GUI if needed
- CheckMountList ();
+ CheckMountList (FALSE);
// Cache status
if (IsPasswordCacheEmpty() == IsWindowEnabled (GetDlgItem (hwndDlg, IDC_WIPE_CACHE)))
@@ -5340,7 +5345,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
}
else if (sel >= TRAYICON_MENU_DRIVE_OFFSET + 26 && sel < TRAYICON_MENU_DRIVE_OFFSET + 26*2)
{
- if (CheckMountList ())
+ if (CheckMountList (FALSE))
{
if (Dismount (hwndDlg, sel - TRAYICON_MENU_DRIVE_OFFSET - 26))
{
@@ -5524,7 +5529,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
KeyFilesApply (&mountOptions.ProtectedHidVolPassword, hidVolProtKeyFilesParam.FirstKeyFile);
}
- if (CheckMountList ())
+ if (CheckMountList (FALSE))
Mount (hwndDlg, 0, 0);
}
return 1;
@@ -5620,7 +5625,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
break;
case IDM_UNMOUNT_VOLUME:
- if (CheckMountList ())
+ if (CheckMountList (FALSE))
Dismount (hwndDlg, 0);
break;
@@ -5651,7 +5656,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
mountOptions = defaultMountOptions;
bPrebootPasswordDlgMode = FALSE;
- if (CheckMountList ())
+ if (CheckMountList (FALSE))
Mount (hwndDlg, 0, 0);
}
break;
@@ -5708,7 +5713,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
return 1;
}
- if (CheckMountList ())
+ if (CheckMountList (FALSE))
Dismount (hwndDlg, 0);
return 1;
}
@@ -5794,7 +5799,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
mountOptions.PartitionInInactiveSysEncScope = TRUE;
bPrebootPasswordDlgMode = TRUE;
- if (CheckMountList ())
+ if (CheckMountList (FALSE))
Mount (hwndDlg, 0, 0);
bPrebootPasswordDlgMode = FALSE;
@@ -6509,6 +6514,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
{
TaskBarIconRemove (hwndDlg);
TaskBarIconAdd (hwndDlg);
+ CheckMountList(TRUE);
return 1;
}
}
@@ -8529,7 +8535,7 @@ void MountSelectedVolume (HWND hwndDlg, BOOL mountWithOptions)
KeyFilesApply (&mountOptions.ProtectedHidVolPassword, hidVolProtKeyFilesParam.FirstKeyFile);
}
- if (CheckMountList ())
+ if (CheckMountList (FALSE))
Mount (hwndDlg, 0, 0);
}
else
diff --git a/src/Mount/Mount.h b/src/Mount/Mount.h
index 7509542c..f0f5885f 100644
--- a/src/Mount/Mount.h
+++ b/src/Mount/Mount.h
@@ -85,7 +85,7 @@ static BOOL Dismount (HWND hwndDlg, int nDosDriveNo);
static BOOL DismountAll (HWND hwndDlg, BOOL forceUnmount, BOOL interact, int dismountMaxRetries, int dismountAutoRetryDelay);
static void KeyfileDefaultsDlg (HWND hwndDlg);
static void HandleHotKey (HWND hwndDlg, WPARAM wParam);
-static BOOL CheckMountList ();
+static BOOL CheckMountList (BOOL bForceTaskBarUpdate);
int GetCipherBlockSizeByDriveNo (int nDosDriveNo);
int GetModeOfOperationByDriveNo (int nDosDriveNo);
void ChangeMainWindowVisibility ();