Commit 69910d38 authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Stop loading libwine.so.

parent 7582ebcd
......@@ -380,9 +380,6 @@ static const char *dll_dir;
static const char *ntdll_dir;
static const char *wineloader;
static SIZE_T dll_path_maxlen;
static int *p___wine_main_argc;
static char ***p___wine_main_argv;
static WCHAR ***p___wine_main_wargv;
const char *home_dir = NULL;
const char *data_dir = NULL;
......@@ -1185,54 +1182,6 @@ static void relocate_ntdll( void *module )
}
static void *callback_module;
/***********************************************************************
* load_builtin_callback
*
* Load a library in memory; callback function for wine_dll_register
*/
static void load_builtin_callback( void *module, const char *filename )
{
callback_module = module;
}
/***********************************************************************
* load_libwine
*/
static void load_libwine(void)
{
#ifdef __APPLE__
#define LIBWINE "libwine.1.dylib"
#else
#define LIBWINE "libwine.so.1"
#endif
typedef void (*load_dll_callback_t)( void *, const char * );
void (*p_wine_dll_set_callback)( load_dll_callback_t load );
char ***p___wine_main_environ;
char *path;
void *handle;
if (build_dir) path = build_path( build_dir, "libs/wine/" LIBWINE );
else path = build_path( ntdll_dir, LIBWINE );
handle = dlopen( path, RTLD_NOW );
free( path );
if (!handle && !(handle = dlopen( LIBWINE, RTLD_NOW ))) return;
p_wine_dll_set_callback = dlsym( handle, "wine_dll_set_callback" );
p___wine_main_argc = dlsym( handle, "__wine_main_argc" );
p___wine_main_argv = dlsym( handle, "__wine_main_argv" );
p___wine_main_wargv = dlsym( handle, "__wine_main_wargv" );
p___wine_main_environ = dlsym( handle, "__wine_main_environ" );
if (p_wine_dll_set_callback) p_wine_dll_set_callback( load_builtin_callback );
if (p___wine_main_environ) *p___wine_main_environ = main_envp;
}
/***********************************************************************
* fill_builtin_image_info
*/
......@@ -1275,34 +1224,32 @@ static NTSTATUS dlopen_dll( const char *so_name, UNICODE_STRING *nt_name, void *
void *module, *handle;
const IMAGE_NT_HEADERS *nt;
callback_module = (void *)1;
handle = dlopen( so_name, RTLD_NOW );
if (!handle)
{
WARN( "failed to load .so lib %s: %s\n", debugstr_a(so_name), dlerror() );
return STATUS_INVALID_IMAGE_FORMAT;
}
if (callback_module != (void *)1) /* callback was called */
if (!(nt = dlsym( handle, "__wine_spec_nt_header" )))
{
if (!callback_module) return STATUS_NO_MEMORY;
WARN( "got old-style builtin library %s, constructors won't work\n", debugstr_a(so_name) );
module = callback_module;
if (get_builtin_so_handle( module )) goto already_loaded;
ERR( "invalid .so library %s, too old?\n", debugstr_a(so_name));
return STATUS_INVALID_IMAGE_FORMAT;
}
else if ((nt = dlsym( handle, "__wine_spec_nt_header" )))
module = (HMODULE)((nt->OptionalHeader.ImageBase + 0xffff) & ~0xffff);
if (get_builtin_so_handle( module )) /* already loaded */
{
module = (HMODULE)((nt->OptionalHeader.ImageBase + 0xffff) & ~0xffff);
if (get_builtin_so_handle( module )) goto already_loaded;
if (map_so_dll( nt, module ))
{
dlclose( handle );
return STATUS_NO_MEMORY;
}
fill_builtin_image_info( module, image_info );
*ret_module = module;
dlclose( handle );
return STATUS_SUCCESS;
}
else /* already loaded .so */
if (map_so_dll( nt, module ))
{
WARN( "%s already loaded?\n", debugstr_a(so_name));
return STATUS_INVALID_IMAGE_FORMAT;
dlclose( handle );
return STATUS_NO_MEMORY;
}
fill_builtin_image_info( module, image_info );
......@@ -1320,12 +1267,6 @@ static NTSTATUS dlopen_dll( const char *so_name, UNICODE_STRING *nt_name, void *
}
*ret_module = module;
return STATUS_SUCCESS;
already_loaded:
fill_builtin_image_info( module, image_info );
*ret_module = module;
dlclose( handle );
return STATUS_SUCCESS;
}
......@@ -2102,11 +2043,7 @@ static void start_main_thread(void)
virtual_map_user_shared_data();
init_cpu_info();
init_files();
load_libwine();
init_startup_info();
if (p___wine_main_argc) *p___wine_main_argc = main_argc;
if (p___wine_main_argv) *p___wine_main_argv = main_argv;
if (p___wine_main_wargv) *p___wine_main_wargv = main_wargv;
*(ULONG_PTR *)&peb->CloudFileFlags = get_image_address();
set_load_order_app_name( main_wargv[0] );
init_thread_stack( teb, 0, 0, 0 );
......
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