Module: wine Branch: master Commit: 0d37cc1d0637551ceae42773f0e1f059b380fa12 URL: https://gitlab.winehq.org/wine/wine/-/commit/0d37cc1d0637551ceae42773f0e1f05...
Author: Alexandre Julliard julliard@winehq.org Date: Wed Feb 7 19:04:29 2024 +0100
ntdll: Update the image information when loading a builtin dll.
---
dlls/ntdll/unix/loader.c | 8 ++++---- dlls/ntdll/unix/unix_private.h | 3 ++- dlls/ntdll/unix/virtual.c | 12 ++++++++---- 3 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index 803d8079213..662ec5ef7a8 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -1277,11 +1277,11 @@ done: * Return STATUS_IMAGE_ALREADY_LOADED if we should keep the native one that we have found. */ NTSTATUS load_builtin( const pe_image_info_t *image_info, WCHAR *filename, USHORT machine, - void **module, SIZE_T *size, ULONG_PTR limit_low, ULONG_PTR limit_high ) + SECTION_IMAGE_INFORMATION *info, void **module, SIZE_T *size, + ULONG_PTR limit_low, ULONG_PTR limit_high ) { NTSTATUS status; UNICODE_STRING nt_name; - SECTION_IMAGE_INFORMATION info; enum loadorder loadorder;
init_unicode_string( &nt_name, filename ); @@ -1307,10 +1307,10 @@ NTSTATUS load_builtin( const pe_image_info_t *image_info, WCHAR *filename, USHOR case LO_NATIVE_BUILTIN: return STATUS_IMAGE_ALREADY_LOADED; case LO_BUILTIN: - return find_builtin_dll( &nt_name, module, size, &info, limit_low, limit_high, + return find_builtin_dll( &nt_name, module, size, info, limit_low, limit_high, image_info->machine, machine, FALSE ); default: - status = find_builtin_dll( &nt_name, module, size, &info, limit_low, limit_high, + status = find_builtin_dll( &nt_name, module, size, info, limit_low, limit_high, image_info->machine, machine, (loadorder == LO_DEFAULT) ); if (status == STATUS_DLL_NOT_FOUND || status == STATUS_NOT_SUPPORTED) return STATUS_IMAGE_ALREADY_LOADED; diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h index 07f2724eac7..af746b220e8 100644 --- a/dlls/ntdll/unix/unix_private.h +++ b/dlls/ntdll/unix/unix_private.h @@ -185,7 +185,8 @@ extern char **build_envp( const WCHAR *envW ); extern char *get_alternate_wineloader( WORD machine ); extern NTSTATUS exec_wineloader( char **argv, int socketfd, const pe_image_info_t *pe_info ); extern NTSTATUS load_builtin( const pe_image_info_t *image_info, WCHAR *filename, USHORT machine, - void **addr_ptr, SIZE_T *size_ptr, ULONG_PTR limit_low, ULONG_PTR limit_high ); + SECTION_IMAGE_INFORMATION *info, void **module, SIZE_T *size, + ULONG_PTR limit_low, ULONG_PTR limit_high ); extern BOOL is_builtin_path( const UNICODE_STRING *path, WORD *machine ); extern NTSTATUS load_main_exe( const WCHAR *name, const char *unix_name, const WCHAR *curdir, USHORT load_machine, WCHAR **image, void **module ); diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index 2a53f56879e..cfe19eae89d 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -3161,9 +3161,12 @@ static unsigned int virtual_map_section( HANDLE handle, PVOID *addr_ptr, ULONG_P
if (image_info) { + SECTION_IMAGE_INFORMATION info; + filename = (WCHAR *)(image_info + 1); /* check if we can replace that mapping with the builtin */ - res = load_builtin( image_info, filename, machine, addr_ptr, size_ptr, limit_low, limit_high ); + res = load_builtin( image_info, filename, machine, &info, + addr_ptr, size_ptr, limit_low, limit_high ); if (res == STATUS_IMAGE_ALREADY_LOADED) res = virtual_map_image( handle, addr_ptr, size_ptr, shared_file, limit_low, limit_high, alloc_type, machine, image_info, filename, FALSE ); @@ -3462,12 +3465,13 @@ NTSTATUS virtual_map_module( HANDLE mapping, void **module, SIZE_T *size, SECTIO filename = (WCHAR *)(image_info + 1);
/* check if we can replace that mapping with the builtin */ - status = load_builtin( image_info, filename, machine, module, size, limit_low, limit_high ); + status = load_builtin( image_info, filename, machine, info, module, size, limit_low, limit_high ); if (status == STATUS_IMAGE_ALREADY_LOADED) + { status = virtual_map_image( mapping, module, size, shared_file, limit_low, limit_high, 0, machine, image_info, filename, FALSE ); - - virtual_fill_image_information( image_info, info ); + virtual_fill_image_information( image_info, info ); + } if (shared_file) NtClose( shared_file ); free( image_info ); return status;