Commit d743c1e6 authored by Alexandre Julliard's avatar Alexandre Julliard

server: Send TEB and PEB in the process_init_done request.

parent c2be6ecf
...@@ -1556,11 +1556,6 @@ size_t server_init_process(void) ...@@ -1556,11 +1556,6 @@ size_t server_init_process(void)
{ {
req->unix_pid = getpid(); req->unix_pid = getpid();
req->unix_tid = get_unix_tid(); req->unix_tid = get_unix_tid();
req->teb = wine_server_client_ptr( NtCurrentTeb() );
req->peb = wine_server_client_ptr( NtCurrentTeb()->Peb );
#ifdef __i386__
req->ldt_copy = wine_server_client_ptr( &__wine_ldt_copy );
#endif
req->reply_fd = reply_pipe; req->reply_fd = reply_pipe;
req->wait_fd = ntdll_get_thread_data()->wait_fd[1]; req->wait_fd = ntdll_get_thread_data()->wait_fd[1];
req->debug_level = (TRACE_ON(server) != 0); req->debug_level = (TRACE_ON(server) != 0);
...@@ -1640,6 +1635,11 @@ void server_init_process_done(void) ...@@ -1640,6 +1635,11 @@ void server_init_process_done(void)
/* Signal the parent process to continue */ /* Signal the parent process to continue */
SERVER_START_REQ( init_process_done ) SERVER_START_REQ( init_process_done )
{ {
req->teb = wine_server_client_ptr( NtCurrentTeb() );
req->peb = wine_server_client_ptr( NtCurrentTeb()->Peb );
#ifdef __i386__
req->ldt_copy = wine_server_client_ptr( &__wine_ldt_copy );
#endif
status = wine_server_call( req ); status = wine_server_call( req );
suspend = reply->suspend; suspend = reply->suspend;
entry = wine_server_get_ptr( reply->entry ); entry = wine_server_get_ptr( reply->entry );
......
...@@ -910,6 +910,9 @@ struct init_process_done_request ...@@ -910,6 +910,9 @@ struct init_process_done_request
{ {
struct request_header __header; struct request_header __header;
char __pad_12[4]; char __pad_12[4];
client_ptr_t teb;
client_ptr_t peb;
client_ptr_t ldt_copy;
}; };
struct init_process_done_reply struct init_process_done_reply
{ {
...@@ -927,9 +930,6 @@ struct init_first_thread_request ...@@ -927,9 +930,6 @@ struct init_first_thread_request
int unix_pid; int unix_pid;
int unix_tid; int unix_tid;
int debug_level; int debug_level;
client_ptr_t teb;
client_ptr_t peb;
client_ptr_t ldt_copy;
int reply_fd; int reply_fd;
int wait_fd; int wait_fd;
}; };
...@@ -6244,7 +6244,7 @@ union generic_reply ...@@ -6244,7 +6244,7 @@ union generic_reply
/* ### protocol_version begin ### */ /* ### protocol_version begin ### */
#define SERVER_PROTOCOL_VERSION 700 #define SERVER_PROTOCOL_VERSION 701
/* ### protocol_version end ### */ /* ### protocol_version end ### */
......
...@@ -1254,6 +1254,10 @@ DECL_HANDLER(init_process_done) ...@@ -1254,6 +1254,10 @@ DECL_HANDLER(init_process_done)
} }
if (!(image_info = get_view_image_info( view, &base ))) return; if (!(image_info = get_view_image_info( view, &base ))) return;
current->teb = req->teb;
process->peb = req->peb;
process->ldt_copy = req->ldt_copy;
process->start_time = current_time; process->start_time = current_time;
current->entry_point = image_info->entry_point; current->entry_point = image_info->entry_point;
......
...@@ -898,6 +898,9 @@ typedef struct ...@@ -898,6 +898,9 @@ typedef struct
/* Signal the end of the process initialization */ /* Signal the end of the process initialization */
@REQ(init_process_done) @REQ(init_process_done)
client_ptr_t teb; /* TEB of new thread (in process address space) */
client_ptr_t peb; /* PEB of new process (in process address space) */
client_ptr_t ldt_copy; /* address of LDT copy (in process address space) */
@REPLY @REPLY
client_ptr_t entry; /* process entry point */ client_ptr_t entry; /* process entry point */
int suspend; /* is process suspended? */ int suspend; /* is process suspended? */
...@@ -909,9 +912,6 @@ typedef struct ...@@ -909,9 +912,6 @@ typedef struct
int unix_pid; /* Unix pid of new process */ int unix_pid; /* Unix pid of new process */
int unix_tid; /* Unix tid of new thread */ int unix_tid; /* Unix tid of new thread */
int debug_level; /* new debug level */ int debug_level; /* new debug level */
client_ptr_t teb; /* TEB of new thread (in process address space) */
client_ptr_t peb; /* PEB of new process (in process address space) */
client_ptr_t ldt_copy; /* address of LDT copy (in process address space) */
int reply_fd; /* fd for reply pipe */ int reply_fd; /* fd for reply pipe */
int wait_fd; /* fd for blocking calls pipe */ int wait_fd; /* fd for blocking calls pipe */
@REPLY @REPLY
......
...@@ -735,19 +735,19 @@ C_ASSERT( sizeof(struct new_thread_reply) == 16 ); ...@@ -735,19 +735,19 @@ C_ASSERT( sizeof(struct new_thread_reply) == 16 );
C_ASSERT( sizeof(struct get_startup_info_request) == 16 ); C_ASSERT( sizeof(struct get_startup_info_request) == 16 );
C_ASSERT( FIELD_OFFSET(struct get_startup_info_reply, info_size) == 8 ); C_ASSERT( FIELD_OFFSET(struct get_startup_info_reply, info_size) == 8 );
C_ASSERT( sizeof(struct get_startup_info_reply) == 16 ); C_ASSERT( sizeof(struct get_startup_info_reply) == 16 );
C_ASSERT( sizeof(struct init_process_done_request) == 16 ); C_ASSERT( FIELD_OFFSET(struct init_process_done_request, teb) == 16 );
C_ASSERT( FIELD_OFFSET(struct init_process_done_request, peb) == 24 );
C_ASSERT( FIELD_OFFSET(struct init_process_done_request, ldt_copy) == 32 );
C_ASSERT( sizeof(struct init_process_done_request) == 40 );
C_ASSERT( FIELD_OFFSET(struct init_process_done_reply, entry) == 8 ); C_ASSERT( FIELD_OFFSET(struct init_process_done_reply, entry) == 8 );
C_ASSERT( FIELD_OFFSET(struct init_process_done_reply, suspend) == 16 ); C_ASSERT( FIELD_OFFSET(struct init_process_done_reply, suspend) == 16 );
C_ASSERT( sizeof(struct init_process_done_reply) == 24 ); C_ASSERT( sizeof(struct init_process_done_reply) == 24 );
C_ASSERT( FIELD_OFFSET(struct init_first_thread_request, unix_pid) == 12 ); C_ASSERT( FIELD_OFFSET(struct init_first_thread_request, unix_pid) == 12 );
C_ASSERT( FIELD_OFFSET(struct init_first_thread_request, unix_tid) == 16 ); C_ASSERT( FIELD_OFFSET(struct init_first_thread_request, unix_tid) == 16 );
C_ASSERT( FIELD_OFFSET(struct init_first_thread_request, debug_level) == 20 ); C_ASSERT( FIELD_OFFSET(struct init_first_thread_request, debug_level) == 20 );
C_ASSERT( FIELD_OFFSET(struct init_first_thread_request, teb) == 24 ); C_ASSERT( FIELD_OFFSET(struct init_first_thread_request, reply_fd) == 24 );
C_ASSERT( FIELD_OFFSET(struct init_first_thread_request, peb) == 32 ); C_ASSERT( FIELD_OFFSET(struct init_first_thread_request, wait_fd) == 28 );
C_ASSERT( FIELD_OFFSET(struct init_first_thread_request, ldt_copy) == 40 ); C_ASSERT( sizeof(struct init_first_thread_request) == 32 );
C_ASSERT( FIELD_OFFSET(struct init_first_thread_request, reply_fd) == 48 );
C_ASSERT( FIELD_OFFSET(struct init_first_thread_request, wait_fd) == 52 );
C_ASSERT( sizeof(struct init_first_thread_request) == 56 );
C_ASSERT( FIELD_OFFSET(struct init_first_thread_reply, pid) == 8 ); C_ASSERT( FIELD_OFFSET(struct init_first_thread_reply, pid) == 8 );
C_ASSERT( FIELD_OFFSET(struct init_first_thread_reply, tid) == 12 ); C_ASSERT( FIELD_OFFSET(struct init_first_thread_reply, tid) == 12 );
C_ASSERT( FIELD_OFFSET(struct init_first_thread_reply, server_start) == 16 ); C_ASSERT( FIELD_OFFSET(struct init_first_thread_reply, server_start) == 16 );
......
...@@ -1407,17 +1407,8 @@ DECL_HANDLER(init_first_thread) ...@@ -1407,17 +1407,8 @@ DECL_HANDLER(init_first_thread)
if (!init_thread( current, req->reply_fd, req->wait_fd )) return; if (!init_thread( current, req->reply_fd, req->wait_fd )) return;
if (!is_valid_address(req->teb) || !is_valid_address(req->peb))
{
set_error( STATUS_INVALID_PARAMETER );
return;
}
current->unix_pid = process->unix_pid = req->unix_pid; current->unix_pid = process->unix_pid = req->unix_pid;
current->unix_tid = req->unix_tid; current->unix_tid = req->unix_tid;
current->teb = req->teb;
process->peb = req->peb;
process->ldt_copy = req->ldt_copy;
if (!process->parent_id) if (!process->parent_id)
process->affinity = current->affinity = get_thread_affinity( current ); process->affinity = current->affinity = get_thread_affinity( current );
......
...@@ -1440,6 +1440,9 @@ static void dump_get_startup_info_reply( const struct get_startup_info_reply *re ...@@ -1440,6 +1440,9 @@ static void dump_get_startup_info_reply( const struct get_startup_info_reply *re
static void dump_init_process_done_request( const struct init_process_done_request *req ) static void dump_init_process_done_request( const struct init_process_done_request *req )
{ {
dump_uint64( " teb=", &req->teb );
dump_uint64( ", peb=", &req->peb );
dump_uint64( ", ldt_copy=", &req->ldt_copy );
} }
static void dump_init_process_done_reply( const struct init_process_done_reply *req ) static void dump_init_process_done_reply( const struct init_process_done_reply *req )
...@@ -1453,9 +1456,6 @@ static void dump_init_first_thread_request( const struct init_first_thread_reque ...@@ -1453,9 +1456,6 @@ static void dump_init_first_thread_request( const struct init_first_thread_reque
fprintf( stderr, " unix_pid=%d", req->unix_pid ); fprintf( stderr, " unix_pid=%d", req->unix_pid );
fprintf( stderr, ", unix_tid=%d", req->unix_tid ); fprintf( stderr, ", unix_tid=%d", req->unix_tid );
fprintf( stderr, ", debug_level=%d", req->debug_level ); fprintf( stderr, ", debug_level=%d", req->debug_level );
dump_uint64( ", teb=", &req->teb );
dump_uint64( ", peb=", &req->peb );
dump_uint64( ", ldt_copy=", &req->ldt_copy );
fprintf( stderr, ", reply_fd=%d", req->reply_fd ); fprintf( stderr, ", reply_fd=%d", req->reply_fd );
fprintf( stderr, ", wait_fd=%d", req->wait_fd ); fprintf( stderr, ", wait_fd=%d", req->wait_fd );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment