Module: wine Branch: master Commit: 1d1690782b167f3ea24990c260665f71a0e70d1c URL: https://gitlab.winehq.org/wine/wine/-/commit/1d1690782b167f3ea24990c260665f7...
Author: Alexandre Julliard julliard@winehq.org Date: Thu Nov 10 10:30:30 2022 +0100
ntdll: Use a proper Unix syscall for init_builtin_dll().
---
dlls/ntdll/loader.c | 9 ++------- dlls/ntdll/unix/loader.c | 11 +++++++---- dlls/ntdll/unixlib.h | 4 ++-- 3 files changed, 11 insertions(+), 13 deletions(-)
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index a301659ae82..1b541e79a99 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -1574,7 +1574,7 @@ static NTSTATUS MODULE_InitDLL( WINE_MODREF *wm, UINT reason, LPVOID lpReserved if (wm->ldr.Flags & LDR_DONT_RESOLVE_REFS) return STATUS_SUCCESS; if (wm->ldr.TlsIndex != -1) call_tls_callbacks( wm->ldr.DllBase, reason ); if (wm->ldr.Flags & LDR_WINE_INTERNAL && reason == DLL_PROCESS_ATTACH) - unix_funcs->init_builtin_dll( wm->ldr.DllBase ); + NTDLL_UNIX_CALL( init_builtin_dll, wm->ldr.DllBase ); if (!entry) return STATUS_SUCCESS;
if (TRACE_ON(relay)) @@ -4208,7 +4208,7 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, ULONG_PTR unknown2, ULONG_PTR } release_address_space(); if (wm->ldr.TlsIndex != -1) call_tls_callbacks( wm->ldr.DllBase, DLL_PROCESS_ATTACH ); - if (wm->ldr.Flags & LDR_WINE_INTERNAL) unix_funcs->init_builtin_dll( wm->ldr.DllBase ); + if (wm->ldr.Flags & LDR_WINE_INTERNAL) NTDLL_UNIX_CALL( init_builtin_dll, wm->ldr.DllBase ); if (wm->ldr.ActivationContext) RtlDeactivateActivationContext( 0, cookie ); process_breakpoint(); } @@ -4602,10 +4602,6 @@ BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved ) }
-static void CDECL init_builtin_dll_fallback( void *module ) -{ -} - static NTSTATUS CDECL unwind_builtin_dll_fallback( ULONG type, struct _DISPATCHER_CONTEXT *dispatch, CONTEXT *context ) { @@ -4621,7 +4617,6 @@ static LONGLONG WINAPI RtlGetSystemTimePrecise_fallback(void)
static const struct unix_funcs unix_fallbacks = { - init_builtin_dll_fallback, unwind_builtin_dll_fallback, RtlGetSystemTimePrecise_fallback, }; diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index 7d4b9f0ee0a..8c6febcbef4 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -1931,7 +1931,7 @@ static BOOL get_relocbase(caddr_t mapbase, caddr_t *relocbase) /************************************************************************* * init_builtin_dll */ -static void CDECL init_builtin_dll( void *module ) +static NTSTATUS init_builtin_dll( void *module ) { #ifdef HAVE_DLINFO void *handle = NULL; @@ -1945,10 +1945,10 @@ static void CDECL init_builtin_dll( void *module ) const Elf32_Dyn *dyn; #endif
- if (!(handle = get_builtin_so_handle( module ))) return; + if (!(handle = get_builtin_so_handle( module ))) return STATUS_SUCCESS; if (dlinfo( handle, RTLD_DI_LINKMAP, &map )) map = NULL; release_builtin_module( module ); - if (!map) return; + if (!map) return STATUS_SUCCESS;
for (dyn = map->l_ld; dyn->d_tag; dyn++) { @@ -1976,6 +1976,7 @@ static void CDECL init_builtin_dll( void *module ) for (i = 0; i < init_arraysz / sizeof(*init_array); i++) init_array[i]( main_argc, main_argv, main_envp ); #endif + return STATUS_SUCCESS; }
@@ -2154,7 +2155,6 @@ static ULONG_PTR get_image_address(void) */ static struct unix_funcs unix_funcs = { - init_builtin_dll, unwind_builtin_dll, RtlGetSystemTimePrecise, }; @@ -2166,10 +2166,12 @@ static struct unix_funcs unix_funcs = const unixlib_entry_t __wine_unix_call_funcs[] = { load_so_dll, + init_builtin_dll, };
static NTSTATUS wow64_load_so_dll( void *args ) { return STATUS_INVALID_IMAGE_FORMAT; } +static NTSTATUS wow64_init_builtin_dll( void *args ) { return STATUS_UNSUCCESSFUL; }
/*********************************************************************** * __wine_unix_call_wow64_funcs @@ -2177,6 +2179,7 @@ static NTSTATUS wow64_load_so_dll( void *args ) { return STATUS_INVALID_IMAGE_FO const unixlib_entry_t __wine_unix_call_wow64_funcs[] = { wow64_load_so_dll, + wow64_init_builtin_dll, };
diff --git a/dlls/ntdll/unixlib.h b/dlls/ntdll/unixlib.h index e41f7290bc2..fd23468ed80 100644 --- a/dlls/ntdll/unixlib.h +++ b/dlls/ntdll/unixlib.h @@ -34,6 +34,7 @@ struct load_so_dll_params enum ntdll_unix_funcs { unix_load_so_dll, + unix_init_builtin_dll, };
extern unixlib_handle_t ntdll_unix_handle; @@ -41,12 +42,11 @@ extern unixlib_handle_t ntdll_unix_handle; #define NTDLL_UNIX_CALL( func, params ) __wine_unix_call( ntdll_unix_handle, unix_ ## func, params )
/* increment this when you change the function table */ -#define NTDLL_UNIXLIB_VERSION 136 +#define NTDLL_UNIXLIB_VERSION 137
struct unix_funcs { /* loader functions */ - void (CDECL *init_builtin_dll)( void *module ); NTSTATUS (CDECL *unwind_builtin_dll)( ULONG type, struct _DISPATCHER_CONTEXT *dispatch, CONTEXT *context ); /* other Win32 API functions */