Alex Henrie : kernel32: Reimplement GetMaximumProcessorCount on top of GetLogicalProcessorInformationEx.
Alexandre Julliard
julliard at winehq.org
Tue May 25 16:08:17 CDT 2021
Module: wine
Branch: master
Commit: 04114db90bf1abc5079417cfa948a3e9ab7a413d
URL: https://source.winehq.org/git/wine.git/?a=commit;h=04114db90bf1abc5079417cfa948a3e9ab7a413d
Author: Alex Henrie <alexhenrie24 at gmail.com>
Date: Mon May 24 02:10:43 2021 -0600
kernel32: Reimplement GetMaximumProcessorCount on top of GetLogicalProcessorInformationEx.
Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/kernel32/process.c | 27 +++++++++++++++++++++++++--
1 file changed, 25 insertions(+), 2 deletions(-)
diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c
index acdedd979f3..6de094950e3 100644
--- a/dlls/kernel32/process.c
+++ b/dlls/kernel32/process.c
@@ -668,9 +668,32 @@ DWORD WINAPI GetActiveProcessorCount(WORD group)
*/
DWORD WINAPI GetMaximumProcessorCount(WORD group)
{
- DWORD cpus = system_info.NumberOfProcessors;
+ DWORD cpus = 0;
+ DWORD size = 0;
+ SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX *info;
- FIXME("(0x%x): semi-stub, returning %u\n", group, cpus);
+ TRACE("(0x%x)\n", group);
+
+ if (!GetLogicalProcessorInformationEx(RelationGroup, NULL, &size)) return 0;
+ if (!(info = HeapAlloc(GetProcessHeap(), 0, size))) return 0;
+ if (!GetLogicalProcessorInformationEx(RelationGroup, info, &size))
+ {
+ HeapFree(GetProcessHeap(), 0, info);
+ return 0;
+ }
+
+ if (group == ALL_PROCESSOR_GROUPS)
+ {
+ for (group = 0; group < info->Group.ActiveGroupCount; group++)
+ cpus += info->Group.GroupInfo[group].MaximumProcessorCount;
+ }
+ else
+ {
+ if (group < info->Group.ActiveGroupCount)
+ cpus = info->Group.GroupInfo[group].MaximumProcessorCount;
+ }
+
+ HeapFree(GetProcessHeap(), 0, info);
return cpus;
}
More information about the wine-cvs
mailing list