From 909255d55f7c7e4884a33c932fb4665b5cf944e9 Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Sun, 29 Sep 2019 14:44:22 +0200 Subject: 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. --- src/Mount/Mount.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'src/Mount/Mount.c') diff --git a/src/Mount/Mount.c b/src/Mount/Mount.c index dd437090..ed57a617 100644 --- a/src/Mount/Mount.c +++ b/src/Mount/Mount.c @@ -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 -- cgit v1.2.3