Commit 1d169078 authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Use a proper Unix syscall for init_builtin_dll().

parent f7332ab4
...@@ -1574,7 +1574,7 @@ static NTSTATUS MODULE_InitDLL( WINE_MODREF *wm, UINT reason, LPVOID lpReserved ...@@ -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.Flags & LDR_DONT_RESOLVE_REFS) return STATUS_SUCCESS;
if (wm->ldr.TlsIndex != -1) call_tls_callbacks( wm->ldr.DllBase, reason ); if (wm->ldr.TlsIndex != -1) call_tls_callbacks( wm->ldr.DllBase, reason );
if (wm->ldr.Flags & LDR_WINE_INTERNAL && reason == DLL_PROCESS_ATTACH) 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 (!entry) return STATUS_SUCCESS;
if (TRACE_ON(relay)) if (TRACE_ON(relay))
...@@ -4208,7 +4208,7 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, ULONG_PTR unknown2, ULONG_PTR ...@@ -4208,7 +4208,7 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, ULONG_PTR unknown2, ULONG_PTR
} }
release_address_space(); release_address_space();
if (wm->ldr.TlsIndex != -1) call_tls_callbacks( wm->ldr.DllBase, DLL_PROCESS_ATTACH ); 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 ); if (wm->ldr.ActivationContext) RtlDeactivateActivationContext( 0, cookie );
process_breakpoint(); process_breakpoint();
} }
...@@ -4602,10 +4602,6 @@ BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved ) ...@@ -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, static NTSTATUS CDECL unwind_builtin_dll_fallback( ULONG type, struct _DISPATCHER_CONTEXT *dispatch,
CONTEXT *context ) CONTEXT *context )
{ {
...@@ -4621,7 +4617,6 @@ static LONGLONG WINAPI RtlGetSystemTimePrecise_fallback(void) ...@@ -4621,7 +4617,6 @@ static LONGLONG WINAPI RtlGetSystemTimePrecise_fallback(void)
static const struct unix_funcs unix_fallbacks = static const struct unix_funcs unix_fallbacks =
{ {
init_builtin_dll_fallback,
unwind_builtin_dll_fallback, unwind_builtin_dll_fallback,
RtlGetSystemTimePrecise_fallback, RtlGetSystemTimePrecise_fallback,
}; };
......
...@@ -1931,7 +1931,7 @@ static BOOL get_relocbase(caddr_t mapbase, caddr_t *relocbase) ...@@ -1931,7 +1931,7 @@ static BOOL get_relocbase(caddr_t mapbase, caddr_t *relocbase)
/************************************************************************* /*************************************************************************
* init_builtin_dll * init_builtin_dll
*/ */
static void CDECL init_builtin_dll( void *module ) static NTSTATUS init_builtin_dll( void *module )
{ {
#ifdef HAVE_DLINFO #ifdef HAVE_DLINFO
void *handle = NULL; void *handle = NULL;
...@@ -1945,10 +1945,10 @@ static void CDECL init_builtin_dll( void *module ) ...@@ -1945,10 +1945,10 @@ static void CDECL init_builtin_dll( void *module )
const Elf32_Dyn *dyn; const Elf32_Dyn *dyn;
#endif #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; if (dlinfo( handle, RTLD_DI_LINKMAP, &map )) map = NULL;
release_builtin_module( module ); release_builtin_module( module );
if (!map) return; if (!map) return STATUS_SUCCESS;
for (dyn = map->l_ld; dyn->d_tag; dyn++) for (dyn = map->l_ld; dyn->d_tag; dyn++)
{ {
...@@ -1976,6 +1976,7 @@ static void CDECL init_builtin_dll( void *module ) ...@@ -1976,6 +1976,7 @@ static void CDECL init_builtin_dll( void *module )
for (i = 0; i < init_arraysz / sizeof(*init_array); i++) for (i = 0; i < init_arraysz / sizeof(*init_array); i++)
init_array[i]( main_argc, main_argv, main_envp ); init_array[i]( main_argc, main_argv, main_envp );
#endif #endif
return STATUS_SUCCESS;
} }
...@@ -2154,7 +2155,6 @@ static ULONG_PTR get_image_address(void) ...@@ -2154,7 +2155,6 @@ static ULONG_PTR get_image_address(void)
*/ */
static struct unix_funcs unix_funcs = static struct unix_funcs unix_funcs =
{ {
init_builtin_dll,
unwind_builtin_dll, unwind_builtin_dll,
RtlGetSystemTimePrecise, RtlGetSystemTimePrecise,
}; };
...@@ -2166,10 +2166,12 @@ static struct unix_funcs unix_funcs = ...@@ -2166,10 +2166,12 @@ static struct unix_funcs unix_funcs =
const unixlib_entry_t __wine_unix_call_funcs[] = const unixlib_entry_t __wine_unix_call_funcs[] =
{ {
load_so_dll, load_so_dll,
init_builtin_dll,
}; };
static NTSTATUS wow64_load_so_dll( void *args ) { return STATUS_INVALID_IMAGE_FORMAT; } 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 * __wine_unix_call_wow64_funcs
...@@ -2177,6 +2179,7 @@ static NTSTATUS wow64_load_so_dll( void *args ) { return STATUS_INVALID_IMAGE_FO ...@@ -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[] = const unixlib_entry_t __wine_unix_call_wow64_funcs[] =
{ {
wow64_load_so_dll, wow64_load_so_dll,
wow64_init_builtin_dll,
}; };
......
...@@ -34,6 +34,7 @@ struct load_so_dll_params ...@@ -34,6 +34,7 @@ struct load_so_dll_params
enum ntdll_unix_funcs enum ntdll_unix_funcs
{ {
unix_load_so_dll, unix_load_so_dll,
unix_init_builtin_dll,
}; };
extern unixlib_handle_t ntdll_unix_handle; extern unixlib_handle_t ntdll_unix_handle;
...@@ -41,12 +42,11 @@ 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 ) #define NTDLL_UNIX_CALL( func, params ) __wine_unix_call( ntdll_unix_handle, unix_ ## func, params )
/* increment this when you change the function table */ /* increment this when you change the function table */
#define NTDLL_UNIXLIB_VERSION 136 #define NTDLL_UNIXLIB_VERSION 137
struct unix_funcs struct unix_funcs
{ {
/* loader functions */ /* loader functions */
void (CDECL *init_builtin_dll)( void *module );
NTSTATUS (CDECL *unwind_builtin_dll)( ULONG type, struct _DISPATCHER_CONTEXT *dispatch, NTSTATUS (CDECL *unwind_builtin_dll)( ULONG type, struct _DISPATCHER_CONTEXT *dispatch,
CONTEXT *context ); CONTEXT *context );
/* other Win32 API functions */ /* other Win32 API functions */
......
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