From: Rémi Bernon <rbernon@codeweavers.com> --- dlls/ntdll/unix/env.c | 4 ++++ dlls/ntdll/unix/server.c | 6 ------ server/process.c | 6 +++--- server/protocol.def | 4 ++-- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/dlls/ntdll/unix/env.c b/dlls/ntdll/unix/env.c index 48960d8890d..c8ba6cf4371 100644 --- a/dlls/ntdll/unix/env.c +++ b/dlls/ntdll/unix/env.c @@ -2004,6 +2004,7 @@ void init_startup_info( SIZE_T info_size ) unsigned int status; SIZE_T size, env_size, env_pos; RTL_USER_PROCESS_PARAMETERS *params = NULL; + const TEB64 *teb64 = NtCurrentTeb64(); struct startup_info_data *info; UNICODE_STRING nt_name; USHORT machine; @@ -2012,6 +2013,9 @@ void init_startup_info( SIZE_T info_size ) SERVER_START_REQ( get_startup_info ) { + /* always send the native PEB / TEB */ + req->peb = teb64 ? teb64->Peb : wine_server_client_ptr( peb ); + req->teb = wine_server_client_ptr( teb64 ? (void *)teb64 : NtCurrentTeb() ); if (info) wine_server_set_reply( req, info, info_size ); status = wine_server_call( req ); machine = reply->machine; diff --git a/dlls/ntdll/unix/server.c b/dlls/ntdll/unix/server.c index 10167d24215..469b2c8b130 100644 --- a/dlls/ntdll/unix/server.c +++ b/dlls/ntdll/unix/server.c @@ -1731,7 +1731,6 @@ size_t server_init_process(void) */ void server_init_process_done(void) { - void *teb; unsigned int status; int suspend; FILE_FS_DEVICE_INFORMATION info; @@ -1752,14 +1751,9 @@ void server_init_process_done(void) thread_data->syscall_table = KeServiceDescriptorTable; thread_data->syscall_trace = TRACE_ON(syscall); - /* always send the native TEB */ - if (!(teb = NtCurrentTeb64())) teb = NtCurrentTeb(); - /* Signal the parent process to continue */ SERVER_START_REQ( init_process_done ) { - req->teb = wine_server_client_ptr( teb ); - req->peb = NtCurrentTeb64() ? NtCurrentTeb64()->Peb : wine_server_client_ptr( peb ); status = wine_server_call( req ); suspend = reply->suspend; } diff --git a/server/process.c b/server/process.c index 4c778d800db..bda3223a573 100644 --- a/server/process.c +++ b/server/process.c @@ -1494,6 +1494,9 @@ DECL_HANDLER(get_startup_info) struct startup_info *info = process->startup_info; data_size_t size; + current->teb = req->teb; + process->peb = req->peb; + if (!info) return; /* we return the data directly without making a copy so this can only be called once */ @@ -1517,9 +1520,6 @@ DECL_HANDLER(init_process_done) return; } - current->teb = req->teb; - process->peb = req->peb; - process->start_time = current_time; init_process_tracing( process ); diff --git a/server/protocol.def b/server/protocol.def index 306031ea289..3d5c14bdc03 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -1137,6 +1137,8 @@ typedef volatile struct /* Retrieve the new process startup info */ @REQ(get_startup_info) + client_ptr_t teb; /* TEB of new thread (in process address space) */ + client_ptr_t peb; /* PEB of new process (in process address space) */ @REPLY data_size_t info_size; /* size of startup info */ unsigned short machine; /* architecture for the new process */ @@ -1147,8 +1149,6 @@ typedef volatile struct /* Signal the end of the process initialization */ @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) */ @REPLY int suspend; /* is process suspended? */ @END -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10058