ntdll: Implement ThreadGroupInformation class.

Signed-off-by: Michael Müller <michael@fds-team.de>
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
This commit is contained in:
Michael Müller 2015-09-23 22:51:14 +02:00 committed by Alexandre Julliard
parent 86b1e74f5c
commit 55ae09068b
2 changed files with 66 additions and 0 deletions

View File

@ -1103,6 +1103,29 @@ NTSTATUS WINAPI NtQueryInformationThread( HANDLE handle, THREADINFOCLASS class,
SERVER_END_REQ;
return status;
}
case ThreadGroupInformation:
{
const ULONG_PTR affinity_mask = get_system_affinity_mask();
GROUP_AFFINITY affinity;
memset(&affinity, 0, sizeof(affinity));
affinity.Group = 0; /* Wine only supports max 64 processors */
SERVER_START_REQ( get_thread_info )
{
req->handle = wine_server_obj_handle( handle );
req->tid_in = 0;
if (!(status = wine_server_call( req )))
affinity.Mask = reply->affinity & affinity_mask;
}
SERVER_END_REQ;
if (status == STATUS_SUCCESS)
{
if (data) memcpy( data, &affinity, min( length, sizeof(affinity) ));
if (ret_len) *ret_len = min( length, sizeof(affinity) );
}
}
return status;
case ThreadPriority:
case ThreadBasePriority:
case ThreadImpersonationToken:
@ -1233,6 +1256,33 @@ NTSTATUS WINAPI NtSetInformationThread( HANDLE handle, THREADINFOCLASS class,
SERVER_END_REQ;
}
return status;
case ThreadGroupInformation:
{
const ULONG_PTR affinity_mask = get_system_affinity_mask();
const GROUP_AFFINITY *req_aff;
if (length != sizeof(*req_aff)) return STATUS_INVALID_PARAMETER;
if (!data) return STATUS_ACCESS_VIOLATION;
req_aff = data;
/* On Windows the request fails if the reserved fields are set */
if (req_aff->Reserved[0] || req_aff->Reserved[1] || req_aff->Reserved[2])
return STATUS_INVALID_PARAMETER;
/* Wine only supports max 64 processors */
if (req_aff->Group) return STATUS_INVALID_PARAMETER;
if (req_aff->Mask & ~affinity_mask) return STATUS_INVALID_PARAMETER;
if (!req_aff->Mask) return STATUS_INVALID_PARAMETER;
SERVER_START_REQ( set_thread_info )
{
req->handle = wine_server_obj_handle( handle );
req->affinity = req_aff->Mask;
req->mask = SET_THREAD_INFO_AFFINITY;
status = wine_server_call( req );
}
SERVER_END_REQ;
}
return status;
case ThreadBasicInformation:
case ThreadTimes:
case ThreadPriority:

View File

@ -859,6 +859,22 @@ typedef enum _THREADINFOCLASS {
ThreadSetTlsArrayAddress,
ThreadIsIoPending,
ThreadHideFromDebugger,
ThreadBreakOnTermination,
ThreadSwitchLegacyState,
ThreadIsTerminated,
ThreadLastSystemCall,
ThreadIoPriority,
ThreadCycleTime,
ThreadPagePriority,
ThreadActualBasePriority,
ThreadTebInformation,
ThreadCSwitchMon,
ThreadCSwitchPmu,
ThreadWow64Context,
ThreadGroupInformation,
ThreadUmsInformation,
ThreadCounterProfiling,
ThreadIdealProcessorEx,
MaxThreadInfoClass
} THREADINFOCLASS;