Alex Henrie <alexhenrie24(a)gmail.com> wrote:
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)) return 0;
Memory is leaked here.
+ + groups = info->Group.ActiveGroupCount; + + HeapFree(GetProcessHeap(), 0, info); + return groups; }
After looking at the ntdll implementation it seems, that it should be possible to avoid memory allocation and use buffer of a fixed size. -- Dmitry.