Commit a3c92a02 authored by Alexandre Julliard's avatar Alexandre Julliard

server: Get the process entry point from the exe image info.

parent 52d733b5
......@@ -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;
......
......@@ -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 ### */
......
......@@ -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);
}
......
......@@ -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
......
......@@ -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 );
......
......@@ -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 )
......
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