Eric Pouech : ntdll: Implemented AmILastThread information class for NtQueryInformationThread.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Oct 3 13:37:35 CDT 2006


Module: wine
Branch: master
Commit: 8cb932ea894a664b9347ec6860d0c065cb481453
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=8cb932ea894a664b9347ec6860d0c065cb481453

Author: Eric Pouech <eric.pouech at wanadoo.fr>
Date:   Sun Oct  1 08:17:27 2006 +0200

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 364c86d..151ff1e 100644
--- a/dlls/ntdll/thread.c
+++ b/dlls/ntdll/thread.c
@@ -1167,6 +1167,23 @@ #else
 #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 @@ #endif
     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 b8c8a7c..0801c82 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 0d014dd..80a4af4 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -347,6 +347,7 @@ #define SET_PROCESS_INFO_AFFINITY 0x02
     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 56cdbd2..6644e59 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 7f0538b..8cf7306 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -772,6 +772,8 @@ static void dump_get_thread_info_reply( 
     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 )




More information about the wine-cvs mailing list