Commit baa04014 authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Implement the ProcessAffinityMask case in NtQueryInformationProcess.

parent ba2bcaf9
...@@ -3137,24 +3137,18 @@ BOOL WINAPI SetProcessAffinityMask( HANDLE hProcess, DWORD_PTR affmask ) ...@@ -3137,24 +3137,18 @@ BOOL WINAPI SetProcessAffinityMask( HANDLE hProcess, DWORD_PTR affmask )
/********************************************************************** /**********************************************************************
* GetProcessAffinityMask (KERNEL32.@) * GetProcessAffinityMask (KERNEL32.@)
*/ */
BOOL WINAPI GetProcessAffinityMask( HANDLE hProcess, BOOL WINAPI GetProcessAffinityMask( HANDLE hProcess, PDWORD_PTR process_mask, PDWORD_PTR system_mask )
PDWORD_PTR lpProcessAffinityMask,
PDWORD_PTR lpSystemAffinityMask )
{ {
PROCESS_BASIC_INFORMATION pbi; NTSTATUS status = STATUS_SUCCESS;
NTSTATUS status;
status = NtQueryInformationProcess(hProcess, if (system_mask) *system_mask = (1 << NtCurrentTeb()->Peb->NumberOfProcessors) - 1;
ProcessBasicInformation, if (process_mask)
&pbi, sizeof(pbi), NULL);
if (status)
{ {
SetLastError( RtlNtStatusToDosError(status) ); if ((status = NtQueryInformationProcess( hProcess, ProcessAffinityMask,
return FALSE; process_mask, sizeof(*process_mask), NULL )))
SetLastError( RtlNtStatusToDosError(status) );
} }
if (lpProcessAffinityMask) *lpProcessAffinityMask = pbi.AffinityMask; return !status;
if (lpSystemAffinityMask) *lpSystemAffinityMask = (1 << NtCurrentTeb()->Peb->NumberOfProcessors) - 1;
return TRUE;
} }
......
...@@ -134,7 +134,6 @@ NTSTATUS WINAPI NtQueryInformationProcess( ...@@ -134,7 +134,6 @@ NTSTATUS WINAPI NtQueryInformationProcess(
UNIMPLEMENTED_INFO_CLASS(ProcessEnableAlignmentFaultFixup); UNIMPLEMENTED_INFO_CLASS(ProcessEnableAlignmentFaultFixup);
UNIMPLEMENTED_INFO_CLASS(ProcessPriorityClass); UNIMPLEMENTED_INFO_CLASS(ProcessPriorityClass);
UNIMPLEMENTED_INFO_CLASS(ProcessWx86Information); UNIMPLEMENTED_INFO_CLASS(ProcessWx86Information);
UNIMPLEMENTED_INFO_CLASS(ProcessAffinityMask);
UNIMPLEMENTED_INFO_CLASS(ProcessPriorityBoost); UNIMPLEMENTED_INFO_CLASS(ProcessPriorityBoost);
UNIMPLEMENTED_INFO_CLASS(ProcessDeviceMap); UNIMPLEMENTED_INFO_CLASS(ProcessDeviceMap);
UNIMPLEMENTED_INFO_CLASS(ProcessSessionInformation); UNIMPLEMENTED_INFO_CLASS(ProcessSessionInformation);
...@@ -385,6 +384,24 @@ NTSTATUS WINAPI NtQueryInformationProcess( ...@@ -385,6 +384,24 @@ NTSTATUS WINAPI NtQueryInformationProcess(
ret = STATUS_INFO_LENGTH_MISMATCH; ret = STATUS_INFO_LENGTH_MISMATCH;
} }
break; 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: case ProcessWow64Information:
len = sizeof(DWORD); len = sizeof(DWORD);
if (ProcessInformationLength == len) if (ProcessInformationLength == len)
......
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