diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c index e039cad7685..c2630922f4a 100644 --- a/dlls/kernel32/process.c +++ b/dlls/kernel32/process.c @@ -3137,24 +3137,18 @@ BOOL WINAPI SetProcessAffinityMask( HANDLE hProcess, DWORD_PTR affmask ) /********************************************************************** * GetProcessAffinityMask (KERNEL32.@) */ -BOOL WINAPI GetProcessAffinityMask( HANDLE hProcess, - PDWORD_PTR lpProcessAffinityMask, - PDWORD_PTR lpSystemAffinityMask ) +BOOL WINAPI GetProcessAffinityMask( HANDLE hProcess, PDWORD_PTR process_mask, PDWORD_PTR system_mask ) { - PROCESS_BASIC_INFORMATION pbi; - NTSTATUS status; + NTSTATUS status = STATUS_SUCCESS; - status = NtQueryInformationProcess(hProcess, - ProcessBasicInformation, - &pbi, sizeof(pbi), NULL); - if (status) + if (system_mask) *system_mask = (1 << NtCurrentTeb()->Peb->NumberOfProcessors) - 1; + if (process_mask) { - SetLastError( RtlNtStatusToDosError(status) ); - return FALSE; + if ((status = NtQueryInformationProcess( hProcess, ProcessAffinityMask, + process_mask, sizeof(*process_mask), NULL ))) + SetLastError( RtlNtStatusToDosError(status) ); } - if (lpProcessAffinityMask) *lpProcessAffinityMask = pbi.AffinityMask; - if (lpSystemAffinityMask) *lpSystemAffinityMask = (1 << NtCurrentTeb()->Peb->NumberOfProcessors) - 1; - return TRUE; + return !status; } diff --git a/dlls/ntdll/process.c b/dlls/ntdll/process.c index eff3f589d9c..a39f5d0719e 100644 --- a/dlls/ntdll/process.c +++ b/dlls/ntdll/process.c @@ -134,7 +134,6 @@ NTSTATUS WINAPI NtQueryInformationProcess( UNIMPLEMENTED_INFO_CLASS(ProcessEnableAlignmentFaultFixup); UNIMPLEMENTED_INFO_CLASS(ProcessPriorityClass); UNIMPLEMENTED_INFO_CLASS(ProcessWx86Information); - UNIMPLEMENTED_INFO_CLASS(ProcessAffinityMask); UNIMPLEMENTED_INFO_CLASS(ProcessPriorityBoost); UNIMPLEMENTED_INFO_CLASS(ProcessDeviceMap); UNIMPLEMENTED_INFO_CLASS(ProcessSessionInformation); @@ -385,6 +384,24 @@ NTSTATUS WINAPI NtQueryInformationProcess( ret = STATUS_INFO_LENGTH_MISMATCH; } break; + + case ProcessAffinityMask: + len = sizeof(ULONG_PTR); + if (ProcessInformationLength == len) + { + const ULONG_PTR system_mask = ((ULONG_PTR)1 << NtCurrentTeb()->Peb->NumberOfProcessors) - 1; + + SERVER_START_REQ(get_process_info) + { + req->handle = wine_server_obj_handle( ProcessHandle ); + if (!(ret = wine_server_call( req ))) + *(ULONG_PTR *)ProcessInformation = reply->affinity & system_mask; + } + SERVER_END_REQ; + } + else ret = STATUS_INFO_LENGTH_MISMATCH; + break; + case ProcessWow64Information: len = sizeof(DWORD); if (ProcessInformationLength == len)