From 8cb932ea894a664b9347ec6860d0c065cb481453 Mon Sep 17 00:00:00 2001 From: Eric Pouech Date: Sun, 1 Oct 2006 08:17:27 +0200 Subject: [PATCH] ntdll: Implemented AmILastThread information class for NtQueryInformationThread. --- dlls/ntdll/thread.c | 18 +++++++++++++++++- include/wine/server_protocol.h | 3 ++- server/protocol.def | 1 + server/thread.c | 5 +++-- server/trace.c | 2 ++ 5 files changed, 25 insertions(+), 4 deletions(-) diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c index 364c86dc0b7..151ff1ee852 100644 --- a/dlls/ntdll/thread.c +++ b/dlls/ntdll/thread.c @@ -1167,6 +1167,23 @@ NTSTATUS WINAPI NtQueryInformationThread( HANDLE handle, THREADINFOCLASS class, #endif return status; } + case ThreadAmILastThread: + { + SERVER_START_REQ(get_thread_info) + { + req->handle = handle; + req->tid_in = 0; + status = wine_server_call( req ); + if (status == STATUS_SUCCESS) + { + BOOLEAN last = reply->last; + if (data) memcpy( data, &last, min( length, sizeof(last) )); + if (ret_len) *ret_len = min( length, sizeof(last) ); + } + } + SERVER_END_REQ; + return status; + } case ThreadPriority: case ThreadBasePriority: case ThreadAffinityMask: @@ -1176,7 +1193,6 @@ NTSTATUS WINAPI NtQueryInformationThread( HANDLE handle, THREADINFOCLASS class, case ThreadQuerySetWin32StartAddress: case ThreadZeroTlsCell: case ThreadPerformanceCount: - case ThreadAmILastThread: case ThreadIdealProcessor: case ThreadPriorityBoost: case ThreadSetTlsArrayAddress: diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h index b8c8a7c8439..0801c82212f 100644 --- a/include/wine/server_protocol.h +++ b/include/wine/server_protocol.h @@ -388,6 +388,7 @@ struct get_thread_info_reply int affinity; abs_time_t creation_time; abs_time_t exit_time; + int last; }; @@ -4405,6 +4406,6 @@ union generic_reply struct query_symlink_reply query_symlink_reply; }; -#define SERVER_PROTOCOL_VERSION 246 +#define SERVER_PROTOCOL_VERSION 247 #endif /* __WINE_WINE_SERVER_PROTOCOL_H */ diff --git a/server/protocol.def b/server/protocol.def index 0d014dd8956..80a4af4afd1 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -347,6 +347,7 @@ struct token_groups int affinity; /* thread affinity mask */ abs_time_t creation_time; /* thread creation time */ abs_time_t exit_time; /* thread exit time */ + int last; /* last thread in process */ @END diff --git a/server/thread.c b/server/thread.c index 56cdbd20692..6644e594b65 100644 --- a/server/thread.c +++ b/server/thread.c @@ -950,8 +950,9 @@ DECL_HANDLER(get_thread_info) reply->affinity = thread->affinity; reply->creation_time.sec = thread->creation_time.tv_sec; reply->creation_time.usec = thread->creation_time.tv_usec; - reply->exit_time.sec = thread->exit_time.tv_sec; - reply->exit_time.usec = thread->exit_time.tv_usec; + reply->exit_time.sec = thread->exit_time.tv_sec; + reply->exit_time.usec = thread->exit_time.tv_usec; + reply->last = thread->process->running_threads == 1; release_object( thread ); } diff --git a/server/trace.c b/server/trace.c index 7f0538b01a6..8cf730629a6 100644 --- a/server/trace.c +++ b/server/trace.c @@ -772,6 +772,8 @@ static void dump_get_thread_info_reply( const struct get_thread_info_reply *req fprintf( stderr, "," ); fprintf( stderr, " exit_time=" ); dump_abs_time( &req->exit_time ); + fprintf( stderr, "," ); + fprintf( stderr, " last=%d", req->last ); } static void dump_set_thread_info_request( const struct set_thread_info_request *req )