[PATCH 4/4] kernel32: Reimplement GetMaximumProcessorCount on top of SystemCpuInformation
Alex Henrie
alexhenrie24 at gmail.com
Thu Dec 10 23:55:17 CST 2020
Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
---
This fixes the console spam when the Clinithink natural language
processing software <https://www.clinithink.com/> calls
GetMaximumProcessorCount repeatedly.
---
dlls/kernel32/kernel_main.c | 1 +
dlls/kernel32/kernel_private.h | 1 +
dlls/kernel32/process.c | 9 +++++++--
3 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/dlls/kernel32/kernel_main.c b/dlls/kernel32/kernel_main.c
index 89394e16430..531a580749f 100644
--- a/dlls/kernel32/kernel_main.c
+++ b/dlls/kernel32/kernel_main.c
@@ -123,6 +123,7 @@ static BOOL process_attach( HMODULE module )
RtlSetUnhandledExceptionFilter( UnhandledExceptionFilter );
NtQuerySystemInformation( SystemBasicInformation, &system_info, sizeof(system_info), NULL );
+ NtQuerySystemInformation( SystemCpuInformation, &cpu_info, sizeof(cpu_info), NULL );
copy_startup_info();
diff --git a/dlls/kernel32/kernel_private.h b/dlls/kernel32/kernel_private.h
index 633511d6140..cbd23f52f10 100644
--- a/dlls/kernel32/kernel_private.h
+++ b/dlls/kernel32/kernel_private.h
@@ -30,6 +30,7 @@ static inline BOOL set_ntstatus( NTSTATUS status )
}
extern SYSTEM_BASIC_INFORMATION system_info DECLSPEC_HIDDEN;
+extern SYSTEM_CPU_INFORMATION cpu_info DECLSPEC_HIDDEN;
extern WCHAR *FILE_name_AtoW( LPCSTR name, BOOL alloc ) DECLSPEC_HIDDEN;
extern DWORD FILE_name_WtoA( LPCWSTR src, INT srclen, LPSTR dest, INT destlen ) DECLSPEC_HIDDEN;
diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c
index c1c3c484493..564fa703b5a 100644
--- a/dlls/kernel32/process.c
+++ b/dlls/kernel32/process.c
@@ -50,6 +50,7 @@ typedef struct
} LOADPARMS32;
SYSTEM_BASIC_INFORMATION system_info = { 0 };
+SYSTEM_CPU_INFORMATION cpu_info = { 0 };
/* Process flags */
#define PDB32_DEBUGGED 0x0001 /* Process is being debugged */
@@ -620,9 +621,13 @@ DWORD WINAPI GetActiveProcessorCount(WORD group)
*/
DWORD WINAPI GetMaximumProcessorCount(WORD group)
{
- DWORD cpus = system_info.NumberOfProcessors;
+ DWORD cpus = cpu_info.MaximumCpus;
+
+ if (group == ALL_PROCESSOR_GROUPS)
+ TRACE("(0x%x): returning %u\n", group, cpus);
+ else
+ FIXME("(0x%x): processor groups not supported, returning %u\n", group, cpus);
- FIXME("(0x%x): semi-stub, returning %u\n", group, cpus);
return cpus;
}
--
2.29.2
More information about the wine-devel
mailing list