VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Mount
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2020-07-01 17:13:08 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2020-07-02 02:20:50 +0200
commitac3cccdd2156403d66b32ef5ab35017caff43209 (patch)
tree62abdeb7dbad77303c422fd14007c4a92eacc6b0 /src/Mount
parent3f587a362943a59455c6b177829118fa87e6b7b0 (diff)
downloadVeraCrypt-ac3cccdd2156403d66b32ef5ab35017caff43209.tar.gz
VeraCrypt-ac3cccdd2156403d66b32ef5ab35017caff43209.zip
Windows: Replace GetSystemInfo calls by more reliable function to get number of CPUs active on the PC.
Diffstat (limited to 'src/Mount')
-rw-r--r--src/Mount/Mount.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/Mount/Mount.c b/src/Mount/Mount.c
index ece39512..59ef7ba2 100644
--- a/src/Mount/Mount.c
+++ b/src/Mount/Mount.c
@@ -49,6 +49,7 @@
#include "../Platform/Finally.h"
#include "../Platform/ForEach.h"
#include "../Setup/SelfExtract.h"
+#include "../Common/EncryptionThreadPool.h"
#include <Strsafe.h>
#include <InitGuid.h>
@@ -11285,26 +11286,25 @@ static BOOL CALLBACK PerformanceSettingsDlgProc (HWND hwndDlg, UINT msg, WPARAM
EnableWindow (GetDlgItem (hwndDlg, IDC_ENABLE_RAM_ENCRYPTION), FALSE);
}
- SYSTEM_INFO sysInfo;
- GetSystemInfo (&sysInfo);
+ size_t cpuCount = GetCpuCount(NULL);
HWND freeCpuCombo = GetDlgItem (hwndDlg, IDC_ENCRYPTION_FREE_CPU_COUNT);
uint32 encryptionFreeCpuCount = ReadEncryptionThreadPoolFreeCpuCountLimit();
- if (encryptionFreeCpuCount > sysInfo.dwNumberOfProcessors - 1)
- encryptionFreeCpuCount = sysInfo.dwNumberOfProcessors - 1;
+ if (encryptionFreeCpuCount > (uint32) (cpuCount - 1))
+ encryptionFreeCpuCount = (uint32) (cpuCount - 1);
- for (uint32 i = 1; i < sysInfo.dwNumberOfProcessors; ++i)
+ for (uint32 i = 1; i < cpuCount; ++i)
{
wstringstream s;
s << i;
AddComboPair (freeCpuCombo, s.str().c_str(), i);
}
- if (sysInfo.dwNumberOfProcessors < 2 || encryptionFreeCpuCount == 0)
+ if (cpuCount < 2 || encryptionFreeCpuCount == 0)
EnableWindow (freeCpuCombo, FALSE);
- if (sysInfo.dwNumberOfProcessors < 2)
+ if (cpuCount < 2)
EnableWindow (GetDlgItem (hwndDlg, IDC_LIMIT_ENC_THREAD_POOL), FALSE);
if (encryptionFreeCpuCount != 0)