Commit 4f196ead authored by Alexandre Julliard's avatar Alexandre Julliard

Implemented the ThreadBasicInformation case for

NtQueryInformationThread.
parent 56aaea2f
......@@ -129,15 +129,16 @@ DWORD WINAPI ResumeThread( HANDLE hthread ) /* [in] Identifies thread to restart
INT WINAPI GetThreadPriority(
HANDLE hthread) /* [in] Handle to thread */
{
INT ret = THREAD_PRIORITY_ERROR_RETURN;
SERVER_START_REQ( get_thread_info )
THREAD_BASIC_INFORMATION info;
NTSTATUS status = NtQueryInformationThread( hthread, ThreadBasicInformation,
&info, sizeof(info), NULL );
if (status)
{
req->handle = hthread;
req->tid_in = 0;
if (!wine_server_call_err( req )) ret = reply->priority;
SetLastError( RtlNtStatusToDosError(status) );
return THREAD_PRIORITY_ERROR_RETURN;
}
SERVER_END_REQ;
return ret;
return info.Priority;
}
......
......@@ -164,24 +164,6 @@ NTSTATUS WINAPI NtSetInformationProcess(
*/
/******************************************************************************
* NtQueryInformationThread [NTDLL.@]
* ZwQueryInformationThread [NTDLL.@]
*
*/
NTSTATUS WINAPI NtQueryInformationThread(
IN HANDLE ThreadHandle,
IN THREADINFOCLASS ThreadInformationClass,
OUT PVOID ThreadInformation,
IN ULONG ThreadInformationLength,
OUT PULONG ReturnLength)
{
FIXME("(%p,0x%08x,%p,0x%08lx,%p),stub!\n",
ThreadHandle, ThreadInformationClass, ThreadInformation,
ThreadInformationLength, ReturnLength);
return 0;
}
/******************************************************************************
* NtSetInformationThread [NTDLL.@]
* ZwSetInformationThread [NTDLL.@]
*/
......
......@@ -154,14 +154,14 @@
@ stub NtQueryAttributesFile
@ stdcall NtQueryDefaultLocale(long ptr)
@ stdcall NtQueryDirectoryFile(long long ptr ptr ptr ptr long long long ptr long)
@ stdcall NtQueryDirectoryObject(long long long long long long long)
@ stdcall NtQueryDirectoryObject(long ptr long long long ptr ptr)
@ stub NtQueryEaFile
@ stdcall NtQueryEvent(long long ptr long ptr)
@ stdcall NtQueryInformationFile(long long long long long)
@ stdcall NtQueryInformationFile(long ptr ptr long long)
@ stub NtQueryInformationPort
@ stdcall NtQueryInformationProcess(long long long long long)
@ stdcall NtQueryInformationThread (long long long long long)
@ stdcall NtQueryInformationToken (long long long long long)
@ stdcall NtQueryInformationProcess(long long ptr long ptr)
@ stdcall NtQueryInformationThread(long long ptr long ptr)
@ stdcall NtQueryInformationToken(long long ptr long ptr)
@ stub NtQueryIntervalProfile
@ stub NtQueryIoCompletion
@ stdcall NtQueryKey (long long ptr long ptr)
......@@ -686,14 +686,14 @@
@ stub ZwQueryAttributesFile
@ stdcall ZwQueryDefaultLocale(long ptr) NtQueryDefaultLocale
@ stdcall ZwQueryDirectoryFile(long long ptr ptr ptr ptr long long long ptr long)NtQueryDirectoryFile
@ stdcall ZwQueryDirectoryObject(long long long long long long long) NtQueryDirectoryObject
@ stdcall ZwQueryDirectoryObject(long ptr long long long ptr ptr) NtQueryDirectoryObject
@ stub ZwQueryEaFile
@ stdcall ZwQueryEvent(long long ptr long ptr) NtQueryEvent
@ stdcall ZwQueryInformationFile(long long long long long) NtQueryInformationFile
@ stdcall ZwQueryInformationFile(long ptr ptr long long) NtQueryInformationFile
@ stub ZwQueryInformationPort
@ stdcall ZwQueryInformationProcess(long long long long long) NtQueryInformationProcess
@ stdcall ZwQueryInformationThread(long long long long long) NtQueryInformationThread
@ stdcall ZwQueryInformationToken(long long long long long) NtQueryInformationToken
@ stdcall ZwQueryInformationProcess(long long ptr long ptr) NtQueryInformationProcess
@ stdcall ZwQueryInformationThread(long long ptr long ptr) NtQueryInformationThread
@ stdcall ZwQueryInformationToken(long long ptr long ptr) NtQueryInformationToken
@ stub ZwQueryIntervalProfile
@ stub ZwQueryIoCompletion
@ stdcall ZwQueryKey(long long ptr long ptr) NtQueryKey
......
......@@ -20,6 +20,9 @@
#include "winternl.h"
#include "wine/server.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(thread);
/***********************************************************************
......@@ -169,3 +172,64 @@ NTSTATUS WINAPI NtGetContextThread( HANDLE handle, CONTEXT *context )
SERVER_END_REQ;
return ret;
}
/******************************************************************************
* NtQueryInformationThread (NTDLL.@)
* ZwQueryInformationThread (NTDLL.@)
*/
NTSTATUS WINAPI NtQueryInformationThread( HANDLE handle, THREADINFOCLASS class,
void *data, ULONG length, ULONG *ret_len )
{
NTSTATUS status;
switch(class)
{
case ThreadBasicInformation:
{
THREAD_BASIC_INFORMATION info;
SERVER_START_REQ( get_thread_info )
{
req->handle = handle;
req->tid_in = 0;
if (!(status = wine_server_call( req )))
{
info.ExitStatus = reply->exit_code;
info.TebBaseAddress = reply->teb;
info.ClientId.UniqueProcess = (HANDLE)reply->pid;
info.ClientId.UniqueThread = (HANDLE)reply->tid;
info.AffinityMask = reply->affinity;
info.Priority = reply->priority;
info.BasePriority = reply->priority; /* FIXME */
}
}
SERVER_END_REQ;
if (status == STATUS_SUCCESS)
{
if (data) memcpy( data, &info, min( length, sizeof(info) ));
if (ret_len) *ret_len = min( length, sizeof(info) );
}
}
return status;
case ThreadTimes:
case ThreadPriority:
case ThreadBasePriority:
case ThreadAffinityMask:
case ThreadImpersonationToken:
case ThreadDescriptorTableEntry:
case ThreadEnableAlignmentFaultFixup:
case ThreadEventPair_Reusable:
case ThreadQuerySetWin32StartAddress:
case ThreadZeroTlsCell:
case ThreadPerformanceCount:
case ThreadAmILastThread:
case ThreadIdealProcessor:
case ThreadPriorityBoost:
case ThreadSetTlsArrayAddress:
case ThreadIsIoPending:
default:
FIXME( "info class %d not supported yet\n", class );
return STATUS_NOT_IMPLEMENTED;
}
}
......@@ -398,10 +398,12 @@ struct get_thread_info_request
struct get_thread_info_reply
{
struct reply_header __header;
process_id_t pid;
thread_id_t tid;
void* teb;
int exit_code;
int priority;
int affinity;
time_t creation_time;
time_t exit_time;
};
......@@ -3618,6 +3620,6 @@ union generic_reply
struct set_clipboard_info_reply set_clipboard_info_reply;
};
#define SERVER_PROTOCOL_VERSION 113
#define SERVER_PROTOCOL_VERSION 114
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */
......@@ -389,6 +389,17 @@ typedef enum _THREADINFOCLASS {
MaxThreadInfoClass
} THREADINFOCLASS;
typedef struct _THREAD_BASIC_INFORMATION
{
NTSTATUS ExitStatus;
PVOID TebBaseAddress;
CLIENT_ID ClientId;
ULONG AffinityMask;
LONG Priority;
LONG BasePriority;
} THREAD_BASIC_INFORMATION, *PTHREAD_BASIC_INFORMATION;
typedef enum _WINSTATIONINFOCLASS {
WinStationInformation = 8
} WINSTATIONINFOCLASS;
......
......@@ -347,10 +347,12 @@ typedef struct
obj_handle_t handle; /* thread handle */
thread_id_t tid_in; /* thread id (optional) */
@REPLY
process_id_t pid; /* server process id */
thread_id_t tid; /* server thread id */
void* teb; /* thread teb pointer */
int exit_code; /* thread exit code */
int priority; /* thread priority level */
int affinity; /* thread affinity mask */
time_t creation_time; /* thread creation time */
time_t exit_time; /* thread exit time */
@END
......
......@@ -904,10 +904,12 @@ DECL_HANDLER(get_thread_info)
if (thread)
{
reply->pid = get_process_id( thread->process );
reply->tid = get_thread_id( thread );
reply->teb = thread->teb;
reply->exit_code = (thread->state == TERMINATED) ? thread->exit_code : STILL_ACTIVE;
reply->priority = thread->priority;
reply->affinity = thread->affinity;
reply->creation_time = thread->creation_time;
reply->exit_time = thread->exit_time;
......
......@@ -536,10 +536,12 @@ static void dump_get_thread_info_request( const struct get_thread_info_request *
static void dump_get_thread_info_reply( const struct get_thread_info_reply *req )
{
fprintf( stderr, " pid=%04x,", req->pid );
fprintf( stderr, " tid=%04x,", req->tid );
fprintf( stderr, " teb=%p,", req->teb );
fprintf( stderr, " exit_code=%d,", req->exit_code );
fprintf( stderr, " priority=%d,", req->priority );
fprintf( stderr, " affinity=%d,", req->affinity );
fprintf( stderr, " creation_time=%ld,", req->creation_time );
fprintf( stderr, " exit_time=%ld", req->exit_time );
}
......
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