Commit b51476ad authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

kernel32: Retrieve the system affinity mask from ntdll.

parent 0258e531
...@@ -3259,13 +3259,21 @@ BOOL WINAPI GetProcessAffinityMask( HANDLE hProcess, PDWORD_PTR process_mask, PD ...@@ -3259,13 +3259,21 @@ BOOL WINAPI GetProcessAffinityMask( HANDLE hProcess, PDWORD_PTR process_mask, PD
{ {
NTSTATUS status = STATUS_SUCCESS; NTSTATUS status = STATUS_SUCCESS;
if (system_mask) *system_mask = (1 << NtCurrentTeb()->Peb->NumberOfProcessors) - 1;
if (process_mask) if (process_mask)
{ {
if ((status = NtQueryInformationProcess( hProcess, ProcessAffinityMask, if ((status = NtQueryInformationProcess( hProcess, ProcessAffinityMask,
process_mask, sizeof(*process_mask), NULL ))) process_mask, sizeof(*process_mask), NULL )))
SetLastError( RtlNtStatusToDosError(status) ); 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; return !status;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment