ntdll: Implemented AmILastThread information class for NtQueryInformationThread.
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 @@
 #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 @@
     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 @@
     int          affinity;
     abs_time_t   creation_time;
     abs_time_t   exit_time;
+    int          last;
 };
 
 
@@ -4405,6 +4406,6 @@
     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 @@
     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 @@
         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 @@
     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 )