1
0
mirror of https://github.com/veracrypt/VeraCrypt.git synced 2025-11-12 03:18:26 -06:00

Windows: when periodic update of device is disabled, use SetupAPI to list disks on demand instead of testing all disks to reduce CPU usage.

This commit is contained in:
Mounir IDRASSI
2019-09-30 16:08:27 +02:00
parent e3afa296c7
commit 9b804137e0

View File

@@ -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<HostDevice> volumeIdCandidates;
EnterCriticalSection (&csMountableDevices);
if (!NeedPeriodicDeviceListUpdate)
UpdateMountableHostDeviceList ();
std::vector<HostDevice> newDevices = mountableDevices;
LeaveCriticalSection (&csMountableDevices);