Module: wine Branch: refs/heads/master Commit: 1269f43c5a68e03b526098fb18dd0edd42858ceb URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=1269f43c5a68e03b526098fb...
Author: Alexandre Julliard julliard@winehq.org Date: Fri Feb 17 17:39:44 2006 +0100
libwine: Add the runtime library path to the front of the dll paths list.
---
libs/wine/config.c | 5 +++-- libs/wine/loader.c | 18 ++++++++++++------ 2 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/libs/wine/config.c b/libs/wine/config.c index 65f2857..ca1080a 100644 --- a/libs/wine/config.c +++ b/libs/wine/config.c @@ -162,9 +162,10 @@ static void init_server_dir( dev_t dev, }
/* retrieve the default dll dir */ -const char *get_default_dlldir(void) +const char *get_dlldir( const char **default_dlldir ) { - return dlldir ? dlldir : DLLDIR; + *default_dlldir = DLLDIR; + return dlldir; }
/* initialize all the paths values */ diff --git a/libs/wine/loader.c b/libs/wine/loader.c index 9b1eaf2..b659694 100644 --- a/libs/wine/loader.c +++ b/libs/wine/loader.c @@ -81,13 +81,14 @@ static int dll_path_maxlen;
extern void mmap_init(void); extern void debug_init(void); -extern const char *get_default_dlldir(void); +extern const char *get_dlldir( const char **default_dlldir );
/* build the dll load path from the WINEDLLPATH variable */ static void build_dll_path(void) { int len, count = 0; char *p, *path = getenv( "WINEDLLPATH" ); + const char *dlldir = get_dlldir( &default_dlldir );
if (path) { @@ -103,12 +104,18 @@ static void build_dll_path(void) } }
- dll_paths = malloc( (count+1) * sizeof(*dll_paths) ); + dll_paths = malloc( (count+2) * sizeof(*dll_paths) ); + nb_dll_paths = 0; + + if (dlldir) + { + dll_path_maxlen = strlen(dlldir); + dll_paths[nb_dll_paths++] = dlldir; + }
if (count) { p = path; - nb_dll_paths = 0; while (*p) { while (*p == ':') *p++ = 0; @@ -122,7 +129,6 @@ static void build_dll_path(void) }
/* append default dll dir (if not empty) to path */ - default_dlldir = get_default_dlldir(); if ((len = strlen(default_dlldir)) > 0) { if (len > dll_path_maxlen) dll_path_maxlen = len; @@ -570,8 +576,8 @@ void wine_init( int argc, char *argv[], void *ntdll = NULL; void (*init_func)(void);
- build_dll_path(); wine_init_argv0_path( argv[0] ); + build_dll_path(); __wine_main_argc = argc; __wine_main_argv = argv; __wine_main_environ = environ; @@ -583,7 +589,7 @@ void wine_init( int argc, char *argv[], if ((ntdll = wine_dlopen( path, RTLD_NOW, error, error_size ))) { /* if we didn't use the default dll dir, remove it from the search path */ - if (sizeof(default_dlldir) > 1 && context.index < nb_dll_paths) nb_dll_paths--; + if (default_dlldir[0] && context.index < nb_dll_paths) nb_dll_paths--; break; } }