Alexandre Julliard : server: Get the process entry point from the exe image info.
Alexandre Julliard
julliard at winehq.org
Mon Feb 8 15:46:41 CST 2021
Module: wine
Branch: master
Commit: a3c92a02cc7014cfdb1f90f1d070037868067097
URL: https://source.winehq.org/git/wine.git/?a=commit;h=a3c92a02cc7014cfdb1f90f1d070037868067097
Author: Alexandre Julliard <julliard at winehq.org>
Date: Mon Feb 8 12:10:49 2021 +0100
server: Get the process entry point from the exe image info.
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ntdll/unix/server.c | 6 ++----
include/wine/server_protocol.h | 9 ++++-----
server/process.c | 21 +++++++++++++++------
server/protocol.def | 4 +---
server/request.h | 10 ++++------
server/trace.c | 6 ++----
6 files changed, 28 insertions(+), 28 deletions(-)
diff --git a/dlls/ntdll/unix/server.c b/dlls/ntdll/unix/server.c
index 7b469959f66..6af8effe9e1 100644
--- a/dlls/ntdll/unix/server.c
+++ b/dlls/ntdll/unix/server.c
@@ -1587,7 +1587,7 @@ void server_init_process_done(void)
{
PEB *peb = NtCurrentTeb()->Peb;
IMAGE_NT_HEADERS *nt = get_exe_nt_header();
- void *entry = (char *)peb->ImageBaseAddress + nt->OptionalHeader.AddressOfEntryPoint;
+ void *entry;
NTSTATUS status;
int suspend, needs_close, unixdir;
@@ -1613,11 +1613,9 @@ void server_init_process_done(void)
/* Signal the parent process to continue */
SERVER_START_REQ( init_process_done )
{
- req->module = wine_server_client_ptr( peb->ImageBaseAddress );
- req->entry = wine_server_client_ptr( entry );
- req->gui = (nt->OptionalHeader.Subsystem != IMAGE_SUBSYSTEM_WINDOWS_CUI);
status = wine_server_call( req );
suspend = reply->suspend;
+ entry = wine_server_get_ptr( reply->entry );
}
SERVER_END_REQ;
diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h
index af9fa7a427f..c848b71423c 100644
--- a/include/wine/server_protocol.h
+++ b/include/wine/server_protocol.h
@@ -900,15 +900,14 @@ struct get_startup_info_reply
struct init_process_done_request
{
struct request_header __header;
- int gui;
- mod_handle_t module;
- client_ptr_t entry;
+ char __pad_12[4];
};
struct init_process_done_reply
{
struct reply_header __header;
+ client_ptr_t entry;
int suspend;
- char __pad_12[4];
+ char __pad_20[4];
};
@@ -6280,7 +6279,7 @@ union generic_reply
/* ### protocol_version begin ### */
-#define SERVER_PROTOCOL_VERSION 669
+#define SERVER_PROTOCOL_VERSION 670
/* ### protocol_version end ### */
diff --git a/server/process.c b/server/process.c
index ff3b47455d2..225a9e4f761 100644
--- a/server/process.c
+++ b/server/process.c
@@ -1349,31 +1349,40 @@ DECL_HANDLER(init_process_done)
{
struct process_dll *dll;
struct process *process = current->process;
+ struct memory_view *view;
+ client_ptr_t base;
+ const pe_image_info_t *image_info;
if (is_process_init_done(process))
{
set_error( STATUS_INVALID_PARAMETER );
return;
}
- if (!(dll = find_process_dll( process, req->module )))
+ if (!(view = get_exe_view( process )))
{
set_error( STATUS_DLL_NOT_FOUND );
return;
}
+ if (!(image_info = get_view_image_info( view, &base ))) return;
- /* main exe is the first in the dll list */
- list_remove( &dll->entry );
- list_add_head( &process->dlls, &dll->entry );
+ if ((dll = find_process_dll( process, base )))
+ {
+ /* main exe is the first in the dll list */
+ list_remove( &dll->entry );
+ list_add_head( &process->dlls, &dll->entry );
+ }
process->start_time = current_time;
- current->entry_point = req->entry;
+ current->entry_point = image_info->entry_point;
init_process_tracing( process );
generate_startup_debug_events( process );
set_process_startup_state( process, STARTUP_DONE );
- if (req->gui) process->idle_event = create_event( NULL, NULL, 0, 1, 0, NULL );
+ if (image_info->subsystem != IMAGE_SUBSYSTEM_WINDOWS_CUI)
+ process->idle_event = create_event( NULL, NULL, 0, 1, 0, NULL );
if (process->debug_obj) set_process_debug_flag( process, 1 );
+ reply->entry = image_info->entry_point;
reply->suspend = (current->suspend || process->suspend);
}
diff --git a/server/protocol.def b/server/protocol.def
index 76e7a5b941d..9fbe02f2f99 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -882,10 +882,8 @@ typedef struct
/* Signal the end of the process initialization */
@REQ(init_process_done)
- int gui; /* is it a GUI process? */
- mod_handle_t module; /* main module base address */
- client_ptr_t entry; /* process entry point */
@REPLY
+ client_ptr_t entry; /* process entry point */
int suspend; /* is process suspended? */
@END
diff --git a/server/request.h b/server/request.h
index 02c6121d291..39ba4377fd1 100644
--- a/server/request.h
+++ b/server/request.h
@@ -748,12 +748,10 @@ C_ASSERT( sizeof(struct new_thread_reply) == 16 );
C_ASSERT( sizeof(struct get_startup_info_request) == 16 );
C_ASSERT( FIELD_OFFSET(struct get_startup_info_reply, info_size) == 8 );
C_ASSERT( sizeof(struct get_startup_info_reply) == 16 );
-C_ASSERT( FIELD_OFFSET(struct init_process_done_request, gui) == 12 );
-C_ASSERT( FIELD_OFFSET(struct init_process_done_request, module) == 16 );
-C_ASSERT( FIELD_OFFSET(struct init_process_done_request, entry) == 24 );
-C_ASSERT( sizeof(struct init_process_done_request) == 32 );
-C_ASSERT( FIELD_OFFSET(struct init_process_done_reply, suspend) == 8 );
-C_ASSERT( sizeof(struct init_process_done_reply) == 16 );
+C_ASSERT( sizeof(struct init_process_done_request) == 16 );
+C_ASSERT( FIELD_OFFSET(struct init_process_done_reply, entry) == 8 );
+C_ASSERT( FIELD_OFFSET(struct init_process_done_reply, suspend) == 16 );
+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_tid) == 16 );
C_ASSERT( FIELD_OFFSET(struct init_first_thread_request, debug_level) == 20 );
diff --git a/server/trace.c b/server/trace.c
index 53c5836ef22..e8636013b0e 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -1420,14 +1420,12 @@ 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 )
{
- fprintf( stderr, " gui=%d", req->gui );
- dump_uint64( ", module=", &req->module );
- dump_uint64( ", entry=", &req->entry );
}
static void dump_init_process_done_reply( const struct init_process_done_reply *req )
{
- fprintf( stderr, " suspend=%d", req->suspend );
+ dump_uint64( " entry=", &req->entry );
+ fprintf( stderr, ", suspend=%d", req->suspend );
}
static void dump_init_first_thread_request( const struct init_first_thread_request *req )
More information about the wine-cvs
mailing list