Signed-off-by: Alex Henrie alexhenrie24@gmail.com --- dlls/kernel32/process.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c index b31d73bc5a5..9041b00d512 100644 --- a/dlls/kernel32/process.c +++ b/dlls/kernel32/process.c @@ -638,7 +638,7 @@ DWORD WINAPI GetMaximumProcessorCount(WORD group) /*********************************************************************** * GetMaximumProcessorGroupCount (KERNEL32.@) */ -DWORD WINAPI GetMaximumProcessorGroupCount(void) +WORD WINAPI GetMaximumProcessorGroupCount(void) { FIXME("semi-stub, always returning 1\n"); return 1;
Signed-off-by: Alex Henrie alexhenrie24@gmail.com --- v2: Fix memory leak on error path --- dlls/kernel32/process.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c index 9041b00d512..710dfad8b7a 100644 --- a/dlls/kernel32/process.c +++ b/dlls/kernel32/process.c @@ -609,8 +609,24 @@ HRESULT WINAPI RegisterApplicationRecoveryCallback(APPLICATION_RECOVERY_CALLBACK */ WORD WINAPI GetActiveProcessorGroupCount(void) { - FIXME("semi-stub, always returning 1\n"); - return 1; + WORD groups; + DWORD size = 0; + SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX *info; + + TRACE("()\n"); + + 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; + } + + groups = info->Group.ActiveGroupCount; + + HeapFree(GetProcessHeap(), 0, info); + return groups; }
/***********************************************************************
Signed-off-by: Alex Henrie alexhenrie24@gmail.com --- v2: Fix memory leak on error path --- 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 710dfad8b7a..acdedd979f3 100644 --- a/dlls/kernel32/process.c +++ b/dlls/kernel32/process.c @@ -634,9 +634,32 @@ WORD WINAPI GetActiveProcessorGroupCount(void) */ DWORD WINAPI GetActiveProcessorCount(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].ActiveProcessorCount; + } + else + { + if (group < info->Group.ActiveGroupCount) + cpus = info->Group.GroupInfo[group].ActiveProcessorCount; + } + + HeapFree(GetProcessHeap(), 0, info); return cpus; }
Signed-off-by: Alex Henrie alexhenrie24@gmail.com --- v2: Fix memory leak on error path --- 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; }
Signed-off-by: Alex Henrie alexhenrie24@gmail.com --- v2: Fix memory leak on error path --- dlls/kernel32/process.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c index 6de094950e3..aa0922f5164 100644 --- a/dlls/kernel32/process.c +++ b/dlls/kernel32/process.c @@ -702,8 +702,24 @@ DWORD WINAPI GetMaximumProcessorCount(WORD group) */ WORD WINAPI GetMaximumProcessorGroupCount(void) { - FIXME("semi-stub, always returning 1\n"); - return 1; + WORD groups; + DWORD size = 0; + SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX *info; + + TRACE("()\n"); + + 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; + } + + groups = info->Group.MaximumGroupCount; + + HeapFree(GetProcessHeap(), 0, info); + return groups; }
/***********************************************************************