1
0
mirror of https://github.com/veracrypt/VeraCrypt.git synced 2025-11-11 11:08:02 -06:00

Windows: Use periodic update of connected devices only if there is a Favorite that uses VolumeID. Add command option to disable the period update of devices.

This commit is contained in:
Mounir IDRASSI
2019-09-29 14:44:22 +02:00
parent 7d88577c61
commit 909255d55f
4 changed files with 106 additions and 60 deletions

View File

@@ -512,8 +512,11 @@ static void InitMainDialog (HWND hwndDlg)
e.Show (NULL);
}
// initialize the list of devices available for mounting as early as possible
UpdateMountableHostDeviceList ();
if (NeedPeriodicDeviceListUpdate)
{
// initialize the list of devices available for mounting as early as possible
UpdateMountableHostDeviceList ();
}
if (Silent)
LoadDriveLetters (hwndDlg, NULL, 0);
@@ -7337,7 +7340,8 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
{
if (wParam == TIMER_ID_UPDATE_DEVICE_LIST)
{
UpdateMountableHostDeviceList ();
if (NeedPeriodicDeviceListUpdate)
UpdateMountableHostDeviceList ();
}
else
{
@@ -8873,6 +8877,7 @@ void ExtractCommandLine (HWND hwndDlg, wchar_t *lpszCommandLine)
OptionTryEmptyPassword,
OptionNoWaitDlg,
OptionSecureDesktop,
OptionDisableDeviceUpdate,
};
argument args[]=
@@ -8901,6 +8906,7 @@ void ExtractCommandLine (HWND hwndDlg, wchar_t *lpszCommandLine)
{ OptionTryEmptyPassword, L"/tryemptypass", NULL, FALSE },
{ OptionNoWaitDlg, L"/nowaitdlg", NULL, FALSE },
{ OptionSecureDesktop, L"/secureDesktop", NULL, FALSE },
{ OptionDisableDeviceUpdate, L"/disableDeviceUpdate", NULL, FALSE },
};
argumentspec as;
@@ -8991,6 +8997,12 @@ void ExtractCommandLine (HWND hwndDlg, wchar_t *lpszCommandLine)
}
break;
case OptionDisableDeviceUpdate:
{
DisablePeriodicDeviceListUpdate = TRUE;
}
break;
case OptionCache:
{
wchar_t szTmp[16] = {0};
@@ -9530,8 +9542,6 @@ static VOID WINAPI SystemFavoritesServiceMain (DWORD argc, LPTSTR *argv)
SystemFavoritesServiceSetStatus (SERVICE_START_PENDING, 120000);
SystemFavoritesServiceLogInfo (wstring (L"Initializing list of host devices"));
// initialize the list of devices available for mounting as early as possible
UpdateMountableHostDeviceList ();
SystemFavoritesServiceLogInfo (wstring (L"Starting System Favorites mounting process"));
@@ -10112,9 +10122,6 @@ BOOL MountFavoriteVolumes (HWND hwnd, BOOL systemFavorites, BOOL logOnMount, BOO
{
Sleep (5000);
SystemFavoritesServiceLogInfo (wstring (L"Updating list of host devices"));
UpdateMountableHostDeviceList ();
SystemFavoritesServiceLogInfo (wstring (L"Trying to mount skipped system favorites"));
// Update the service status to avoid being killed