ntdll: Implemented ntdll.NtSetInformationThread(ThreadAffinityMask).
Reimplemented kernel32.SetThreadAffinityMask on top of it.
This commit is contained in:
parent
1ca3a4afe3
commit
329ab98940
|
@ -443,17 +443,25 @@ BOOL WINAPI SetThreadPriorityBoost(
|
|||
*/
|
||||
DWORD WINAPI SetThreadAffinityMask( HANDLE hThread, DWORD dwThreadAffinityMask )
|
||||
{
|
||||
DWORD ret;
|
||||
SERVER_START_REQ( set_thread_info )
|
||||
NTSTATUS status;
|
||||
THREAD_BASIC_INFORMATION tbi;
|
||||
|
||||
status = NtQueryInformationThread( hThread, ThreadBasicInformation,
|
||||
&tbi, sizeof(tbi), NULL );
|
||||
if (status)
|
||||
{
|
||||
req->handle = hThread;
|
||||
req->affinity = dwThreadAffinityMask;
|
||||
req->mask = SET_THREAD_INFO_AFFINITY;
|
||||
ret = !wine_server_call_err( req );
|
||||
/* FIXME: should return previous value */
|
||||
SetLastError( RtlNtStatusToDosError(status) );
|
||||
return 0;
|
||||
}
|
||||
SERVER_END_REQ;
|
||||
return ret;
|
||||
status = NtSetInformationThread( hThread, ThreadAffinityMask,
|
||||
&dwThreadAffinityMask,
|
||||
sizeof(dwThreadAffinityMask));
|
||||
if (status)
|
||||
{
|
||||
SetLastError( RtlNtStatusToDosError(status) );
|
||||
return 0;
|
||||
}
|
||||
return tbi.AffinityMask;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -982,10 +982,23 @@ NTSTATUS WINAPI NtSetInformationThread( HANDLE handle, THREADINFOCLASS class,
|
|||
SERVER_END_REQ;
|
||||
}
|
||||
return status;
|
||||
case ThreadAffinityMask:
|
||||
{
|
||||
const DWORD *paff = data;
|
||||
if (length != sizeof(DWORD)) return STATUS_INVALID_PARAMETER;
|
||||
SERVER_START_REQ( set_thread_info )
|
||||
{
|
||||
req->handle = handle;
|
||||
req->affinity = *paff;
|
||||
req->mask = SET_THREAD_INFO_AFFINITY;
|
||||
status = wine_server_call( req );
|
||||
}
|
||||
SERVER_END_REQ;
|
||||
}
|
||||
return status;
|
||||
case ThreadBasicInformation:
|
||||
case ThreadTimes:
|
||||
case ThreadPriority:
|
||||
case ThreadAffinityMask:
|
||||
case ThreadDescriptorTableEntry:
|
||||
case ThreadEnableAlignmentFaultFixup:
|
||||
case ThreadEventPair_Reusable:
|
||||
|
|
Loading…
Reference in New Issue