From 9b804137e0095c66eff17856cced5bcf5784eb7a Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Mon, 30 Sep 2019 16:08:27 +0200 Subject: Windows: when periodic update of device is disabled, use SetupAPI to list disks on demand instead of testing all disks to reduce CPU usage. --- src/Common/Dlgcode.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/Common') diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c index 46e7d818..654e29a5 100644 --- a/src/Common/Dlgcode.c +++ b/src/Common/Dlgcode.c @@ -12533,7 +12533,7 @@ wstring FindDeviceByVolumeID (const BYTE volumeID [VOLUME_ID_SIZE], BOOL bFromSe /* not mounted. Look for it in the local drives*/ - if (bFromService || !NeedPeriodicDeviceListUpdate) + if (bFromService) { for (int devNumber = 0; devNumber < MAX_HOST_DRIVE_NUMBER; devNumber++) { @@ -12562,6 +12562,8 @@ wstring FindDeviceByVolumeID (const BYTE volumeID [VOLUME_ID_SIZE], BOOL bFromSe static std::vector volumeIdCandidates; EnterCriticalSection (&csMountableDevices); + if (!NeedPeriodicDeviceListUpdate) + UpdateMountableHostDeviceList (); std::vector newDevices = mountableDevices; LeaveCriticalSection (&csMountableDevices); -- cgit v1.2.3