GetProcessGroupAffinity function

Retrieves the processor group affinity of the specified process.


BOOL GetProcessGroupAffinity(
  HANDLE  hProcess,
  PUSHORT GroupCount,
  PUSHORT GroupArray



A handle to the process.

This handle must have the PROCESS_QUERY_INFORMATION or PROCESS_QUERY_LIMITED_INFORMATION access right. For more information, see Process Security and Access Rights.


On input, specifies the number of elements in GroupArray array. On output, specifies the number of processor groups written to the array. If the array is too small, the function fails with ERROR_INSUFFICIENT_BUFFER and sets the GroupCount parameter to the number of elements required.


An array of processor group numbers. A group number is included in the array if a thread in the process is assigned to a processor in the group.

Return value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, use GetLastError.

If the error value is ERROR_INSUFFICIENT_BUFFER, the GroupCount parameter contains the required buffer size in number of elements.


To compile an application that uses this function, set _WIN32_WINNT >= 0x0601. For more information, see Using the Windows Headers.


Minimum supported client Windows 7 [desktop apps only]
Minimum supported server Windows Server 2008 R2 [desktop apps only]
Target Platform Windows
Header processtopologyapi.h (include Windows Server 2008 Windows Server 2008 R2, Windows.h)
Library Kernel32.lib
DLL Kernel32.dll

See also


Processor Groups