Module: wine Branch: master Commit: bd703632fd82cc2414e78f5f68b71dd587ed278c URL: https://gitlab.winehq.org/wine/wine/-/commit/bd703632fd82cc2414e78f5f68b71dd...
Author: Alexandre Julliard julliard@winehq.org Date: Thu Feb 8 12:17:23 2024 +0100
server: Don't update the machine in the image information for ARM64EC modules.
---
server/mapping.c | 31 +++++++++++++------------------ server/object.h | 1 + server/process.c | 1 + 3 files changed, 15 insertions(+), 18 deletions(-)
diff --git a/server/mapping.c b/server/mapping.c index f754078acf7..69d8f71e23b 100644 --- a/server/mapping.c +++ b/server/mapping.c @@ -404,14 +404,6 @@ struct memory_view *get_exe_view( struct process *process ) return LIST_ENTRY( list_head( &process->views ), struct memory_view, entry ); }
-static void set_process_machine( struct process *process, struct memory_view *view ) -{ - if (view->image.image_flags & IMAGE_FLAGS_ComPlusNativeReady) - process->machine = native_machine; - else - process->machine = view->image.machine; -} - static int generate_dll_event( struct thread *thread, int code, struct memory_view *view ) { if (!(view->flags & SEC_IMAGE)) return 0; @@ -420,7 +412,8 @@ static int generate_dll_event( struct thread *thread, int code, struct memory_vi }
/* add a view to the process list */ -static void add_process_view( struct thread *thread, struct memory_view *view ) +/* return 1 if this is the main exe view */ +static int add_process_view( struct thread *thread, struct memory_view *view ) { struct process *process = thread->process; struct unicode_str name; @@ -434,18 +427,17 @@ static void add_process_view( struct thread *thread, struct memory_view *view ) else if (!(view->image.image_charact & IMAGE_FILE_DLL)) { /* main exe */ - set_process_machine( process, view ); - list_add_head( &process->views, &view->entry ); - free( process->image ); process->image = NULL; if (get_view_nt_name( view, &name ) && (process->image = memdup( name.str, name.len ))) process->imagelen = name.len; process->image_info = view->image; - return; + list_add_head( &process->views, &view->entry ); + return 1; } } list_add_tail( &process->views, &view->entry ); + return 0; }
static void free_memory_view( struct memory_view *view ) @@ -1401,16 +1393,19 @@ DECL_HANDLER(map_image_view) view->committed = NULL; view->shared = mapping->shared ? (struct shared_map *)grab_object( mapping->shared ) : NULL; view->image = mapping->image; - view->image.machine = req->machine; view->image.entry_point = req->entry; - add_process_view( current, view ); + if (add_process_view( current, view )) + { + current->process->machine = (view->image.image_flags & IMAGE_FLAGS_ComPlusNativeReady) ? + native_machine : req->machine; + }
if (view->base != (mapping->image.map_addr ? mapping->image.map_addr : mapping->image.base)) set_error( STATUS_IMAGE_NOT_AT_BASE ); - if (view->image.machine != current->process->machine) + if (req->machine != current->process->machine) { /* on 32-bit, the native 64-bit machine is allowed */ - if (is_machine_64bit( current->process->machine ) || view->image.machine != native_machine) + if (is_machine_64bit( current->process->machine ) || req->machine != native_machine) set_error( STATUS_IMAGE_MACHINE_TYPE_MISMATCH ); } } @@ -1443,7 +1438,7 @@ DECL_HANDLER(map_builtin_view) view->image = *image; view->namelen = namelen; memcpy( view->name, image + 1, namelen ); - add_process_view( current, view ); + if (add_process_view( current, view )) current->process->machine = image->machine; } }
diff --git a/server/object.h b/server/object.h index dfdd691601f..d4d66536b81 100644 --- a/server/object.h +++ b/server/object.h @@ -253,6 +253,7 @@ static inline int is_machine_supported( unsigned short machine ) { unsigned int i; for (i = 0; i < supported_machines_count; i++) if (supported_machines[i] == machine) return 1; + if (native_machine == IMAGE_FILE_MACHINE_ARM64) return machine == IMAGE_FILE_MACHINE_AMD64; return 0; }
diff --git a/server/process.c b/server/process.c index e166aeae64e..39076351cea 100644 --- a/server/process.c +++ b/server/process.c @@ -656,6 +656,7 @@ struct process *create_process( int fd, struct process *parent, unsigned int fla process->msg_fd = NULL; process->sigkill_timeout = NULL; process->sigkill_delay = TICKS_PER_SEC / 64; + process->machine = native_machine; process->unix_pid = -1; process->exit_code = STILL_ACTIVE; process->running_threads = 0;