[PATCH 2/5] kernel32: Reimplement GetActiveProcessorGroupCount on top of GetLogicalProcessorInformationEx

Alex Henrie alexhenrie24 at gmail.com
Mon May 24 03:26:23 CDT 2021


On Mon, May 24, 2021 at 12:58 AM Dmitry Timoshkov <dmitry at baikal.ru> wrote:
>
> Alex Henrie <alexhenrie24 at 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.

Fixed in v2, thanks.

> > +
> > +    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.

That may be true now, but I don't know if that's what Alexandre wants
because if Wine supports an arbitrary number of processor groups in
the future, the fixed-size buffer to hold information about 65,534 of
them would require a lot of memory.

-Alex



More information about the wine-devel mailing list