Skip to main content
GetProcessGroupAffinity function

Retrieves the processor group affinity of the specified process.


BOOL GetProcessGroupAffinity(
  _In_    HANDLE  hProcess,
  _Inout_ PUSHORT GroupCount,
  _Out_   PUSHORT GroupArray


hProcess [in]

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.

GroupCount [in, out]

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.

GroupArray [out]

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]


WinBase.h on Windows 7, Windows Server 2008 and Windows Server 2008 R2 (include Windows.h);
Processtopologyapi.h on Windows 8 and Windows Server 2012





See also

Processor Groups