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 )
/**********************************************************************
* 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;
}
......
......@@ -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)
......
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