diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index aa7b58b7324..ab554438afc 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -3900,33 +3900,6 @@ BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved ) } -static NTSTATUS load_ntdll_so( HMODULE module, const IMAGE_NT_HEADERS *nt ) -{ - NTSTATUS (__cdecl *init_func)( HMODULE module, const void *ptr_in, void *ptr_out ); - Dl_info info; - char *name; - void *handle; - - if (!dladdr( load_ntdll_so, &info )) - { - fprintf( stderr, "cannot get path to ntdll.dll.so\n" ); - exit(1); - } - name = strdup( info.dli_fname ); - strcpy( name + strlen(name) - strlen(".dll.so"), ".so" ); - if (!(handle = dlopen( name, RTLD_NOW ))) - { - fprintf( stderr, "failed to load %s: %s\n", name, dlerror() ); - exit(1); - } - if (!(init_func = dlsym( handle, "__wine_init_unix_lib" ))) - { - fprintf( stderr, "init func not found in %s\n", name ); - exit(1); - } - return init_func( module, nt, &unix_funcs ); -} - /*********************************************************************** * __wine_process_init */ @@ -3948,13 +3921,9 @@ void __wine_process_init(void) HMODULE ntdll_module = (HMODULE)((__wine_spec_nt_header.OptionalHeader.ImageBase + 0xffff) & ~0xffff); INITIAL_TEB stack; SIZE_T info_size; - TEB *teb; - PEB *peb; + TEB *teb = thread_init( &info_size ); + PEB *peb = teb->Peb; - if (!unix_funcs) load_ntdll_so( ntdll_module, &__wine_spec_nt_header ); - - teb = thread_init( &info_size ); - peb = teb->Peb; peb->ProcessHeap = RtlCreateHeap( HEAP_GROWABLE, NULL, 0, 0, NULL, NULL ); peb->LoaderLock = &loader_section; diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index 10b483a95a6..6043367a8e4 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -105,10 +105,6 @@ static void (CDECL *p__wine_set_unix_funcs)( int version, const struct unix_func static void fatal_error( const char *err, ... ) __attribute__((noreturn, format(printf,1,2))); #endif -extern int __wine_main_argc; -extern char **__wine_main_argv; -extern char **__wine_main_environ; - #if defined(linux) || defined(__APPLE__) static const BOOL use_preloader = TRUE; #else @@ -1803,39 +1799,6 @@ void __wine_main( int argc, char *argv[], char *envp[] ) } -static int add_area( void *base, size_t size, void *arg ) -{ - mmap_add_reserved_area( base, size ); - return 0; -} - -/*********************************************************************** - * __wine_init_unix_lib - * - * Lib entry point called by ntdll.dll.so if not yet initialized. - */ -NTSTATUS __cdecl __wine_init_unix_lib( HMODULE module, const void *ptr_in, void *ptr_out ) -{ - const IMAGE_NT_HEADERS *nt = ptr_in; - -#ifdef __APPLE__ - extern char **__wine_get_main_environment(void); - char **envp = __wine_get_main_environment(); -#else - char **envp = __wine_main_environ; -#endif - init_paths( __wine_main_argc, __wine_main_argv, envp ); - - ntdll_module = module; - map_so_dll( nt, module ); - fixup_ntdll_imports( &__wine_spec_nt_header ); - init_environment( __wine_main_argc, __wine_main_argv, envp ); - wine_dll_set_callback( load_builtin_callback ); - *(struct unix_funcs **)ptr_out = &unix_funcs; - wine_mmap_enum_reserved_areas( add_area, NULL, 0 ); - return STATUS_SUCCESS; -} - BOOL WINAPI DECLSPEC_HIDDEN DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved ) { if (reason == DLL_PROCESS_ATTACH) LdrDisableThreadCalloutsForDll( inst );