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

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51539
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2021-07-30 12:14:30 +02:00
parent 10fb33026f
commit b08b4b8213
8 changed files with 16 additions and 18 deletions

View File

@ -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);
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->stack_size = nt->OptionalHeader.SizeOfStackReserve;
info->stack_commit = nt->OptionalHeader.SizeOfStackCommit;

View File

@ -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 )
{
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->MaximumStackSize = pe_info->stack_size;
info->CommittedStackSize = pe_info->stack_commit;

View File

@ -767,10 +767,10 @@ typedef union
typedef struct
{
client_ptr_t base;
client_ptr_t entry_point;
mem_size_t map_size;
mem_size_t stack_size;
mem_size_t stack_commit;
unsigned int entry_point;
unsigned int map_size;
unsigned int zerobits;
unsigned int subsystem;
unsigned short subsystem_minor;
@ -6252,7 +6252,7 @@ union generic_reply
/* ### protocol_version begin ### */
#define SERVER_PROTOCOL_VERSION 725
#define SERVER_PROTOCOL_VERSION 726
/* ### protocol_version end ### */

View File

@ -160,7 +160,7 @@ static void fill_create_process_event( struct debug_event *event, const void *ar
const struct memory_view *view = arg;
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_size = image_info->dbg_size;
/* the doc says write access too, but this doesn't seem a good idea */

View File

@ -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;
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.stack_size = nt.opt.hdr32.SizeOfStackReserve;
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
clr_size = nt.opt.hdr64.DataDirectory[IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR].Size;
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.stack_size = nt.opt.hdr64.SizeOfStackReserve;
mapping->image.stack_commit = nt.opt.hdr64.SizeOfStackCommit;

View File

@ -1399,7 +1399,7 @@ DECL_HANDLER(init_process_done)
process->ldt_copy = req->ldt_copy;
process->start_time = current_time;
current->entry_point = image_info->entry_point;
current->entry_point = base + image_info->entry_point;
init_process_tracing( process );
generate_startup_debug_events( process );
@ -1408,7 +1408,7 @@ DECL_HANDLER(init_process_done)
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->entry = current->entry_point;
reply->suspend = (current->suspend || process->suspend);
}

View File

@ -783,10 +783,10 @@ typedef union
typedef struct
{
client_ptr_t base;
client_ptr_t entry_point;
mem_size_t map_size;
mem_size_t stack_size;
mem_size_t stack_commit;
unsigned int entry_point;
unsigned int map_size;
unsigned int zerobits;
unsigned int subsystem;
unsigned short subsystem_minor;

View File

@ -1354,17 +1354,15 @@ static void dump_varargs_pe_image_info( const char *prefix, data_size_t size )
fprintf( stderr, "%s{", prefix );
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_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"
",contains_code=%u,image_flags=%02x"
",loader_flags=%08x,header_size=%08x,file_size=%08x,checksum=%08x}",
info.zerobits, info.subsystem, info.subsystem_minor, info.subsystem_major,
info.osversion_major, info.osversion_minor, info.image_charact, info.dll_charact,
info.machine, info.contains_code, info.image_flags, info.loader_flags,
info.entry_point, info.map_size, info.zerobits, info.subsystem, info.subsystem_minor,
info.subsystem_major, info.osversion_major, info.osversion_minor, info.image_charact,
info.dll_charact, info.machine, info.contains_code, info.image_flags, info.loader_flags,
info.header_size, info.file_size, info.checksum );
remove_data( min( size, sizeof(info) ));
}