Commit 329ab989 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

ntdll: Implemented ntdll.NtSetInformationThread(ThreadAffinityMask).

Reimplemented kernel32.SetThreadAffinityMask on top of it.
parent 1ca3a4af
...@@ -443,17 +443,25 @@ BOOL WINAPI SetThreadPriorityBoost( ...@@ -443,17 +443,25 @@ BOOL WINAPI SetThreadPriorityBoost(
*/ */
DWORD WINAPI SetThreadAffinityMask( HANDLE hThread, DWORD dwThreadAffinityMask ) DWORD WINAPI SetThreadAffinityMask( HANDLE hThread, DWORD dwThreadAffinityMask )
{ {
DWORD ret; NTSTATUS status;
SERVER_START_REQ( set_thread_info ) THREAD_BASIC_INFORMATION tbi;
status = NtQueryInformationThread( hThread, ThreadBasicInformation,
&tbi, sizeof(tbi), NULL );
if (status)
{ {
req->handle = hThread; SetLastError( RtlNtStatusToDosError(status) );
req->affinity = dwThreadAffinityMask; return 0;
req->mask = SET_THREAD_INFO_AFFINITY;
ret = !wine_server_call_err( req );
/* FIXME: should return previous value */
} }
SERVER_END_REQ; status = NtSetInformationThread( hThread, ThreadAffinityMask,
return ret; &dwThreadAffinityMask,
sizeof(dwThreadAffinityMask));
if (status)
{
SetLastError( RtlNtStatusToDosError(status) );
return 0;
}
return tbi.AffinityMask;
} }
......
...@@ -982,10 +982,23 @@ NTSTATUS WINAPI NtSetInformationThread( HANDLE handle, THREADINFOCLASS class, ...@@ -982,10 +982,23 @@ NTSTATUS WINAPI NtSetInformationThread( HANDLE handle, THREADINFOCLASS class,
SERVER_END_REQ; SERVER_END_REQ;
} }
return status; 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 ThreadBasicInformation:
case ThreadTimes: case ThreadTimes:
case ThreadPriority: case ThreadPriority:
case ThreadAffinityMask:
case ThreadDescriptorTableEntry: case ThreadDescriptorTableEntry:
case ThreadEnableAlignmentFaultFixup: case ThreadEnableAlignmentFaultFixup:
case ThreadEventPair_Reusable: case ThreadEventPair_Reusable:
......
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