ntdll: Implement the ProcessAffinityMask case in NtQueryInformationProcess.

This commit is contained in:
Alexandre Julliard 2011-04-14 19:57:34 +02:00
parent ba2bcaf9c4
commit baa04014eb
2 changed files with 26 additions and 15 deletions

View File

@ -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;
}

View File

@ -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)