Commit b08b4b82 authored by Alexandre Julliard's avatar Alexandre Julliard

server: Store the entry point as image-relative in pe_image_info_t.

parent 10fb3302
...@@ -1017,7 +1017,7 @@ static void fill_builtin_image_info( void *module, pe_image_info_t *info ) ...@@ -1017,7 +1017,7 @@ static void fill_builtin_image_info( void *module, pe_image_info_t *info )
const IMAGE_NT_HEADERS *nt = (IMAGE_NT_HEADERS *)((const BYTE *)dos + dos->e_lfanew); const IMAGE_NT_HEADERS *nt = (IMAGE_NT_HEADERS *)((const BYTE *)dos + dos->e_lfanew);
info->base = nt->OptionalHeader.ImageBase; info->base = nt->OptionalHeader.ImageBase;
info->entry_point = info->base + nt->OptionalHeader.AddressOfEntryPoint; info->entry_point = nt->OptionalHeader.AddressOfEntryPoint;
info->map_size = nt->OptionalHeader.SizeOfImage; info->map_size = nt->OptionalHeader.SizeOfImage;
info->stack_size = nt->OptionalHeader.SizeOfStackReserve; info->stack_size = nt->OptionalHeader.SizeOfStackReserve;
info->stack_commit = nt->OptionalHeader.SizeOfStackCommit; info->stack_commit = nt->OptionalHeader.SizeOfStackCommit;
......
...@@ -4512,7 +4512,7 @@ NTSTATUS WINAPI NtUnmapViewOfSection( HANDLE process, PVOID addr ) ...@@ -4512,7 +4512,7 @@ NTSTATUS WINAPI NtUnmapViewOfSection( HANDLE process, PVOID addr )
*/ */
void virtual_fill_image_information( const pe_image_info_t *pe_info, SECTION_IMAGE_INFORMATION *info ) void virtual_fill_image_information( const pe_image_info_t *pe_info, SECTION_IMAGE_INFORMATION *info )
{ {
info->TransferAddress = wine_server_get_ptr( pe_info->entry_point ); info->TransferAddress = wine_server_get_ptr( pe_info->base + pe_info->entry_point );
info->ZeroBits = pe_info->zerobits; info->ZeroBits = pe_info->zerobits;
info->MaximumStackSize = pe_info->stack_size; info->MaximumStackSize = pe_info->stack_size;
info->CommittedStackSize = pe_info->stack_commit; info->CommittedStackSize = pe_info->stack_commit;
......
...@@ -767,10 +767,10 @@ typedef union ...@@ -767,10 +767,10 @@ typedef union
typedef struct typedef struct
{ {
client_ptr_t base; client_ptr_t base;
client_ptr_t entry_point;
mem_size_t map_size;
mem_size_t stack_size; mem_size_t stack_size;
mem_size_t stack_commit; mem_size_t stack_commit;
unsigned int entry_point;
unsigned int map_size;
unsigned int zerobits; unsigned int zerobits;
unsigned int subsystem; unsigned int subsystem;
unsigned short subsystem_minor; unsigned short subsystem_minor;
...@@ -6252,7 +6252,7 @@ union generic_reply ...@@ -6252,7 +6252,7 @@ union generic_reply
/* ### protocol_version begin ### */ /* ### protocol_version begin ### */
#define SERVER_PROTOCOL_VERSION 725 #define SERVER_PROTOCOL_VERSION 726
/* ### protocol_version end ### */ /* ### protocol_version end ### */
......
...@@ -160,7 +160,7 @@ static void fill_create_process_event( struct debug_event *event, const void *ar ...@@ -160,7 +160,7 @@ static void fill_create_process_event( struct debug_event *event, const void *ar
const struct memory_view *view = arg; const struct memory_view *view = arg;
const pe_image_info_t *image_info = get_view_image_info( view, &event->data.create_process.base ); const pe_image_info_t *image_info = get_view_image_info( view, &event->data.create_process.base );
event->data.create_process.start = image_info->entry_point; event->data.create_process.start = event->data.create_process.base + image_info->entry_point;
event->data.create_process.dbg_offset = image_info->dbg_offset; event->data.create_process.dbg_offset = image_info->dbg_offset;
event->data.create_process.dbg_size = image_info->dbg_size; event->data.create_process.dbg_size = image_info->dbg_size;
/* the doc says write access too, but this doesn't seem a good idea */ /* the doc says write access too, but this doesn't seem a good idea */
......
...@@ -705,7 +705,7 @@ static unsigned int get_image_params( struct mapping *mapping, file_pos_t file_s ...@@ -705,7 +705,7 @@ static unsigned int get_image_params( struct mapping *mapping, file_pos_t file_s
clr_size = nt.opt.hdr32.DataDirectory[IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR].Size; clr_size = nt.opt.hdr32.DataDirectory[IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR].Size;
mapping->image.base = nt.opt.hdr32.ImageBase; mapping->image.base = nt.opt.hdr32.ImageBase;
mapping->image.entry_point = nt.opt.hdr32.ImageBase + nt.opt.hdr32.AddressOfEntryPoint; mapping->image.entry_point = nt.opt.hdr32.AddressOfEntryPoint;
mapping->image.map_size = ROUND_SIZE( nt.opt.hdr32.SizeOfImage ); mapping->image.map_size = ROUND_SIZE( nt.opt.hdr32.SizeOfImage );
mapping->image.stack_size = nt.opt.hdr32.SizeOfStackReserve; mapping->image.stack_size = nt.opt.hdr32.SizeOfStackReserve;
mapping->image.stack_commit = nt.opt.hdr32.SizeOfStackCommit; mapping->image.stack_commit = nt.opt.hdr32.SizeOfStackCommit;
...@@ -737,7 +737,7 @@ static unsigned int get_image_params( struct mapping *mapping, file_pos_t file_s ...@@ -737,7 +737,7 @@ static unsigned int get_image_params( struct mapping *mapping, file_pos_t file_s
clr_size = nt.opt.hdr64.DataDirectory[IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR].Size; clr_size = nt.opt.hdr64.DataDirectory[IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR].Size;
mapping->image.base = nt.opt.hdr64.ImageBase; mapping->image.base = nt.opt.hdr64.ImageBase;
mapping->image.entry_point = nt.opt.hdr64.ImageBase + nt.opt.hdr64.AddressOfEntryPoint; mapping->image.entry_point = nt.opt.hdr64.AddressOfEntryPoint;
mapping->image.map_size = ROUND_SIZE( nt.opt.hdr64.SizeOfImage ); mapping->image.map_size = ROUND_SIZE( nt.opt.hdr64.SizeOfImage );
mapping->image.stack_size = nt.opt.hdr64.SizeOfStackReserve; mapping->image.stack_size = nt.opt.hdr64.SizeOfStackReserve;
mapping->image.stack_commit = nt.opt.hdr64.SizeOfStackCommit; mapping->image.stack_commit = nt.opt.hdr64.SizeOfStackCommit;
......
...@@ -1399,7 +1399,7 @@ DECL_HANDLER(init_process_done) ...@@ -1399,7 +1399,7 @@ DECL_HANDLER(init_process_done)
process->ldt_copy = req->ldt_copy; 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 = base + image_info->entry_point;
init_process_tracing( process ); init_process_tracing( process );
generate_startup_debug_events( process ); generate_startup_debug_events( process );
...@@ -1408,7 +1408,7 @@ DECL_HANDLER(init_process_done) ...@@ -1408,7 +1408,7 @@ DECL_HANDLER(init_process_done)
if (image_info->subsystem != IMAGE_SUBSYSTEM_WINDOWS_CUI) if (image_info->subsystem != IMAGE_SUBSYSTEM_WINDOWS_CUI)
process->idle_event = create_event( NULL, NULL, 0, 1, 0, NULL ); process->idle_event = create_event( NULL, NULL, 0, 1, 0, NULL );
if (process->debug_obj) set_process_debug_flag( process, 1 ); if (process->debug_obj) set_process_debug_flag( process, 1 );
reply->entry = image_info->entry_point; reply->entry = current->entry_point;
reply->suspend = (current->suspend || process->suspend); reply->suspend = (current->suspend || process->suspend);
} }
......
...@@ -783,10 +783,10 @@ typedef union ...@@ -783,10 +783,10 @@ typedef union
typedef struct typedef struct
{ {
client_ptr_t base; client_ptr_t base;
client_ptr_t entry_point;
mem_size_t map_size;
mem_size_t stack_size; mem_size_t stack_size;
mem_size_t stack_commit; mem_size_t stack_commit;
unsigned int entry_point;
unsigned int map_size;
unsigned int zerobits; unsigned int zerobits;
unsigned int subsystem; unsigned int subsystem;
unsigned short subsystem_minor; unsigned short subsystem_minor;
......
...@@ -1354,17 +1354,15 @@ static void dump_varargs_pe_image_info( const char *prefix, data_size_t size ) ...@@ -1354,17 +1354,15 @@ static void dump_varargs_pe_image_info( const char *prefix, data_size_t size )
fprintf( stderr, "%s{", prefix ); fprintf( stderr, "%s{", prefix );
dump_uint64( "base=", &info.base ); dump_uint64( "base=", &info.base );
dump_uint64( ",entry_point=", &info.entry_point );
dump_uint64( ",map_size=", &info.map_size );
dump_uint64( ",stack_size=", &info.stack_size ); dump_uint64( ",stack_size=", &info.stack_size );
dump_uint64( ",stack_commit=", &info.stack_commit ); dump_uint64( ",stack_commit=", &info.stack_commit );
fprintf( stderr, ",zerobits=%08x,subsystem=%08x,subsystem_minor=%04x,subsystem_major=%04x" fprintf( stderr, ",entry_point=%08x,map_size=%08x,zerobits=%08x,subsystem=%08x,subsystem_minor=%04x,subsystem_major=%04x"
",osversion_major=%04x,osversion_minor=%04x,image_charact=%04x,dll_charact=%04x,machine=%04x" ",osversion_major=%04x,osversion_minor=%04x,image_charact=%04x,dll_charact=%04x,machine=%04x"
",contains_code=%u,image_flags=%02x" ",contains_code=%u,image_flags=%02x"
",loader_flags=%08x,header_size=%08x,file_size=%08x,checksum=%08x}", ",loader_flags=%08x,header_size=%08x,file_size=%08x,checksum=%08x}",
info.zerobits, info.subsystem, info.subsystem_minor, info.subsystem_major, info.entry_point, info.map_size, info.zerobits, info.subsystem, info.subsystem_minor,
info.osversion_major, info.osversion_minor, info.image_charact, info.dll_charact, info.subsystem_major, info.osversion_major, info.osversion_minor, info.image_charact,
info.machine, info.contains_code, info.image_flags, info.loader_flags, info.dll_charact, info.machine, info.contains_code, info.image_flags, info.loader_flags,
info.header_size, info.file_size, info.checksum ); info.header_size, info.file_size, info.checksum );
remove_data( min( size, sizeof(info) )); remove_data( min( size, sizeof(info) ));
} }
......
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