kernel32: Retrieve the system affinity mask from ntdll.

This commit is contained in:
Hans Leidekker 2015-01-21 13:23:36 +01:00 committed by Alexandre Julliard
parent 0258e5319b
commit b51476ad42
1 changed files with 9 additions and 1 deletions

View File

@ -3259,13 +3259,21 @@ BOOL WINAPI GetProcessAffinityMask( HANDLE hProcess, PDWORD_PTR process_mask, PD
{
NTSTATUS status = STATUS_SUCCESS;
if (system_mask) *system_mask = (1 << NtCurrentTeb()->Peb->NumberOfProcessors) - 1;
if (process_mask)
{
if ((status = NtQueryInformationProcess( hProcess, ProcessAffinityMask,
process_mask, sizeof(*process_mask), NULL )))
SetLastError( RtlNtStatusToDosError(status) );
}
if (system_mask && status == STATUS_SUCCESS)
{
SYSTEM_BASIC_INFORMATION info;
if ((status = NtQuerySystemInformation( SystemBasicInformation, &info, sizeof(info), NULL )))
SetLastError( RtlNtStatusToDosError(status) );
else
*system_mask = info.ActiveProcessorsAffinityMask;
}
return !status;
}