Alexandre Julliard : server: Use the thread entry point field to pass the PEB in the initial thread.

Alexandre Julliard julliard at winehq.org
Fri Apr 3 10:28:42 CDT 2009


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Fri Apr  3 14:30:34 2009 +0200

server: Use the thread entry point field to pass the PEB in the initial thread.

---

 dlls/ntdll/server.c            |    1 -
 dlls/ntdll/thread.c            |    2 +-
 include/wine/server_protocol.h |    3 +--
 server/protocol.def            |    3 +--
 server/request.h               |    1 -
 server/thread.c                |    4 ++--
 server/trace.c                 |    4 +---
 7 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/dlls/ntdll/server.c b/dlls/ntdll/server.c
index d16a248..46dfc1d 100644
--- a/dlls/ntdll/server.c
+++ b/dlls/ntdll/server.c
@@ -1026,7 +1026,6 @@ size_t server_init_thread( void *entry_point )
         req->unix_pid    = getpid();
         req->unix_tid    = get_unix_tid();
         req->teb         = wine_server_client_ptr( NtCurrentTeb() );
-        req->peb         = wine_server_client_ptr( NtCurrentTeb()->Peb );
         req->entry       = wine_server_client_ptr( entry_point );
         req->reply_fd    = reply_pipe[1];
         req->wait_fd     = ntdll_get_thread_data()->wait_fd[1];
diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c
index 8c6d72c..190dfdc 100644
--- a/dlls/ntdll/thread.c
+++ b/dlls/ntdll/thread.c
@@ -294,7 +294,7 @@ HANDLE thread_init(void)
 
     /* setup the server connection */
     server_init_process();
-    info_size = server_init_thread( NULL );
+    info_size = server_init_thread( peb );
 
     /* create the process heap */
     if (!(peb->ProcessHeap = RtlCreateHeap( HEAP_GROWABLE, NULL, 0, 0, NULL, NULL )))
diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h
index fcf062b..a8865e6 100644
--- a/include/wine/server_protocol.h
+++ b/include/wine/server_protocol.h
@@ -567,7 +567,6 @@ struct init_thread_request
     client_ptr_t entry;
     int          reply_fd;
     int          wait_fd;
-    client_ptr_t peb;
 };
 struct init_thread_reply
 {
@@ -5215,6 +5214,6 @@ union generic_reply
     struct set_window_layered_info_reply set_window_layered_info_reply;
 };
 
-#define SERVER_PROTOCOL_VERSION 381
+#define SERVER_PROTOCOL_VERSION 382
 
 #endif /* __WINE_WINE_SERVER_PROTOCOL_H */
diff --git a/server/protocol.def b/server/protocol.def
index a8f3569..5cc93da 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -551,10 +551,9 @@ typedef union
     int          unix_tid;     /* Unix tid of new thread */
     int          debug_level;  /* new debug level */
     client_ptr_t teb;          /* TEB of new thread (in thread address space) */
-    client_ptr_t entry;        /* thread entry point (in thread address space) */
+    client_ptr_t entry;        /* entry point or PEB if initial thread (in thread address space) */
     int          reply_fd;     /* fd for reply pipe */
     int          wait_fd;      /* fd for blocking calls pipe */
-    client_ptr_t peb;          /* address of PEB (in thread address space) */
 @REPLY
     process_id_t pid;          /* process id of the new thread's process */
     thread_id_t  tid;          /* thread id of the new thread */
diff --git a/server/request.h b/server/request.h
index b8d78f3..1adc03b 100644
--- a/server/request.h
+++ b/server/request.h
@@ -663,7 +663,6 @@ C_ASSERT( FIELD_OFFSET(struct init_thread_request, teb) == 24 );
 C_ASSERT( FIELD_OFFSET(struct init_thread_request, entry) == 32 );
 C_ASSERT( FIELD_OFFSET(struct init_thread_request, reply_fd) == 40 );
 C_ASSERT( FIELD_OFFSET(struct init_thread_request, wait_fd) == 44 );
-C_ASSERT( FIELD_OFFSET(struct init_thread_request, peb) == 48 );
 C_ASSERT( FIELD_OFFSET(struct init_thread_reply, pid) == 8 );
 C_ASSERT( FIELD_OFFSET(struct init_thread_reply, tid) == 12 );
 C_ASSERT( FIELD_OFFSET(struct init_thread_reply, server_start) == 16 );
diff --git a/server/thread.c b/server/thread.c
index 397ad9b..6c68a9e 100644
--- a/server/thread.c
+++ b/server/thread.c
@@ -1031,7 +1031,7 @@ DECL_HANDLER(init_thread)
     if (!(current->wait_fd  = create_anonymous_fd( &thread_fd_ops, wait_fd, &current->obj, 0 )))
         return;
 
-    if (!is_valid_address(req->teb) || !is_valid_address(req->peb))
+    if (!is_valid_address(req->teb))
     {
         set_error( STATUS_INVALID_PARAMETER );
         return;
@@ -1044,7 +1044,7 @@ DECL_HANDLER(init_thread)
     if (!process->peb)  /* first thread, initialize the process too */
     {
         process->unix_pid = current->unix_pid;
-        process->peb      = req->peb;
+        process->peb      = req->entry;
         reply->info_size  = init_process( current );
     }
     else
diff --git a/server/trace.c b/server/trace.c
index 9643feb..13a3ddc 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -991,9 +991,7 @@ static void dump_init_thread_request( const struct init_thread_request *req )
     dump_uint64( &req->entry );
     fprintf( stderr, "," );
     fprintf( stderr, " reply_fd=%d,", req->reply_fd );
-    fprintf( stderr, " wait_fd=%d,", req->wait_fd );
-    fprintf( stderr, " peb=" );
-    dump_uint64( &req->peb );
+    fprintf( stderr, " wait_fd=%d", req->wait_fd );
 }
 
 static void dump_init_thread_reply( const struct init_thread_reply *req )




More information about the wine-cvs mailing list