From 845164004b4b6f2e0c64a588fe858d5a26664980 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Mon, 27 Jul 2015 18:31:33 +0200 Subject: [PATCH] ntdll: Implement ThreadQuerySetWin32StartAddress info class in NtQueryInformationThread. --- dlls/ntdll/thread.c | 18 +++++++++++++++++- include/wine/server_protocol.h | 5 +++-- server/protocol.def | 1 + server/request.h | 11 ++++++----- server/thread.c | 1 + server/trace.c | 1 + 6 files changed, 29 insertions(+), 8 deletions(-) diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c index 3e95fd41542..0a8a7b939eb 100644 --- a/dlls/ntdll/thread.c +++ b/dlls/ntdll/thread.c @@ -1086,12 +1086,28 @@ NTSTATUS WINAPI NtQueryInformationThread( HANDLE handle, THREADINFOCLASS class, SERVER_END_REQ; return status; } + case ThreadQuerySetWin32StartAddress: + { + SERVER_START_REQ( get_thread_info ) + { + req->handle = wine_server_obj_handle( handle ); + req->tid_in = 0; + status = wine_server_call( req ); + if (status == STATUS_SUCCESS) + { + PRTL_THREAD_START_ROUTINE entry = wine_server_get_ptr( reply->entry_point ); + if (data) memcpy( data, &entry, min( length, sizeof(entry) ) ); + if (ret_len) *ret_len = min( length, sizeof(entry) ); + } + } + SERVER_END_REQ; + return status; + } case ThreadPriority: case ThreadBasePriority: case ThreadImpersonationToken: case ThreadEnableAlignmentFaultFixup: case ThreadEventPair_Reusable: - case ThreadQuerySetWin32StartAddress: case ThreadZeroTlsCell: case ThreadPerformanceCount: case ThreadIdealProcessor: diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h index 200b27a5f80..36f63786b40 100644 --- a/include/wine/server_protocol.h +++ b/include/wine/server_protocol.h @@ -892,11 +892,12 @@ struct get_thread_info_reply process_id_t pid; thread_id_t tid; client_ptr_t teb; + client_ptr_t entry_point; affinity_t affinity; int exit_code; int priority; int last; - char __pad_44[4]; + char __pad_52[4]; }; @@ -6113,6 +6114,6 @@ union generic_reply struct terminate_job_reply terminate_job_reply; }; -#define SERVER_PROTOCOL_VERSION 483 +#define SERVER_PROTOCOL_VERSION 484 #endif /* __WINE_WINE_SERVER_PROTOCOL_H */ diff --git a/server/protocol.def b/server/protocol.def index 4279cb6d784..ffee0c002e4 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -841,6 +841,7 @@ struct rawinput_device process_id_t pid; /* server process id */ thread_id_t tid; /* server thread id */ client_ptr_t teb; /* thread teb pointer */ + client_ptr_t entry_point; /* thread entry point */ affinity_t affinity; /* thread affinity mask */ int exit_code; /* thread exit code */ int priority; /* thread priority level */ diff --git a/server/request.h b/server/request.h index 2ba8b457071..10e4c9b65e5 100644 --- a/server/request.h +++ b/server/request.h @@ -768,11 +768,12 @@ C_ASSERT( sizeof(struct get_thread_info_request) == 24 ); C_ASSERT( FIELD_OFFSET(struct get_thread_info_reply, pid) == 8 ); C_ASSERT( FIELD_OFFSET(struct get_thread_info_reply, tid) == 12 ); C_ASSERT( FIELD_OFFSET(struct get_thread_info_reply, teb) == 16 ); -C_ASSERT( FIELD_OFFSET(struct get_thread_info_reply, affinity) == 24 ); -C_ASSERT( FIELD_OFFSET(struct get_thread_info_reply, exit_code) == 32 ); -C_ASSERT( FIELD_OFFSET(struct get_thread_info_reply, priority) == 36 ); -C_ASSERT( FIELD_OFFSET(struct get_thread_info_reply, last) == 40 ); -C_ASSERT( sizeof(struct get_thread_info_reply) == 48 ); +C_ASSERT( FIELD_OFFSET(struct get_thread_info_reply, entry_point) == 24 ); +C_ASSERT( FIELD_OFFSET(struct get_thread_info_reply, affinity) == 32 ); +C_ASSERT( FIELD_OFFSET(struct get_thread_info_reply, exit_code) == 40 ); +C_ASSERT( FIELD_OFFSET(struct get_thread_info_reply, priority) == 44 ); +C_ASSERT( FIELD_OFFSET(struct get_thread_info_reply, last) == 48 ); +C_ASSERT( sizeof(struct get_thread_info_reply) == 56 ); C_ASSERT( FIELD_OFFSET(struct get_thread_times_request, handle) == 12 ); C_ASSERT( sizeof(struct get_thread_times_request) == 16 ); C_ASSERT( FIELD_OFFSET(struct get_thread_times_reply, creation_time) == 8 ); diff --git a/server/thread.c b/server/thread.c index f0209088b3f..981bcc1e74e 100644 --- a/server/thread.c +++ b/server/thread.c @@ -1375,6 +1375,7 @@ DECL_HANDLER(get_thread_info) reply->pid = get_process_id( thread->process ); reply->tid = get_thread_id( thread ); reply->teb = thread->teb; + reply->entry_point = thread->entry_point; reply->exit_code = (thread->state == TERMINATED) ? thread->exit_code : STATUS_PENDING; reply->priority = thread->priority; reply->affinity = thread->affinity; diff --git a/server/trace.c b/server/trace.c index da4f5b8c109..3eb8583db9b 100644 --- a/server/trace.c +++ b/server/trace.c @@ -1300,6 +1300,7 @@ 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 ); dump_uint64( ", teb=", &req->teb ); + dump_uint64( ", entry_point=", &req->entry_point ); dump_uint64( ", affinity=", &req->affinity ); fprintf( stderr, ", exit_code=%d", req->exit_code ); fprintf( stderr, ", priority=%d", req->priority );