From 169adf5c64643bbe32c956ae07bc53a4d6b5367f Mon Sep 17 00:00:00 2001 From: Josh DuBois Date: Tue, 13 Feb 2001 20:23:45 +0000 Subject: [PATCH] More verbose error messages when application load fails. --- include/wine/library.h | 3 ++- library/loader.c | 6 +++--- scheduler/process.c | 13 +++++++------ 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/include/wine/library.h b/include/wine/library.h index 7f4e62cfdb5..9bcc6750b04 100644 --- a/include/wine/library.h +++ b/include/wine/library.h @@ -16,7 +16,8 @@ typedef void (*load_dll_callback_t)( void *, const char * ); extern void wine_dll_set_callback( load_dll_callback_t load ); extern void *wine_dll_load( const char *filename, char *error, int errorsize ); -extern void *wine_dll_load_main_exe( const char *name, int search_path ); +extern void *wine_dll_load_main_exe( const char *name, int search_path, + char *error, int errorsize ); extern void wine_dll_unload( void *handle ); /* debugging */ diff --git a/library/loader.c b/library/loader.c index dd258b15cb9..1b3341157ce 100644 --- a/library/loader.c +++ b/library/loader.c @@ -349,7 +349,7 @@ void wine_dll_unload( void *handle ) * * Try to load the .so for the main exe, optionally searching for it in PATH. */ -void *wine_dll_load_main_exe( const char *name, int search_path ) +void *wine_dll_load_main_exe( const char *name, int search_path, char *error, int errorsize ) { void *ret = NULL; const char *path = NULL; @@ -358,7 +358,7 @@ void *wine_dll_load_main_exe( const char *name, int search_path ) if (!path) { /* no path, try only the specified name */ - ret = wine_dlopen( name, RTLD_NOW, NULL, 0 ); + ret = wine_dlopen( name, RTLD_NOW, error, errorsize ); } else { @@ -380,7 +380,7 @@ void *wine_dll_load_main_exe( const char *name, int search_path ) if ((len = p - path) > 0) { memcpy( basename - len, path, len ); - if ((ret = wine_dlopen( basename - len, RTLD_NOW, NULL, 0 ))) break; + if ((ret = wine_dlopen( basename - len, RTLD_NOW, error, errorsize ))) break; } if (!*p) break; path = p + 1; diff --git a/scheduler/process.c b/scheduler/process.c index 091bb86ee21..efb9848bdb5 100644 --- a/scheduler/process.c +++ b/scheduler/process.c @@ -389,13 +389,14 @@ void *open_winelib_app( char *argv[] ) void *ret = NULL; char *tmp; const char *name; + char errStr[100]; if ((name = getenv( "WINEPRELOAD" ))) { - if (!(ret = wine_dll_load_main_exe( name, 0 ))) + if (!(ret = wine_dll_load_main_exe( name, 0, errStr, sizeof(errStr) ))) { - MESSAGE( "%s: could not load '%s' as specified in the WINEPRELOAD environment variable\n", - argv[0], name ); + MESSAGE( "%s: could not load '%s' as specified in the WINEPRELOAD environment variable: %s\n", + argv[0], name, errStr ); ExitProcess(1); } } @@ -417,12 +418,12 @@ void *open_winelib_app( char *argv[] ) strcpy( tmp, argv0 ); strcat( tmp, ".so" ); /* search in PATH only if there was no '/' in argv[0] */ - ret = wine_dll_load_main_exe( tmp, (name == argv0) ); + ret = wine_dll_load_main_exe( tmp, (name == argv0), errStr, sizeof(errStr) ); if (!ret && !argv[1]) { /* if no argv[1], this will be better than displaying usage */ - MESSAGE( "%s: could not load library '%s' as Winelib application\n", - argv[0], tmp ); + MESSAGE( "%s: could not load library '%s' as Winelib application: %s\n", + argv[0], tmp, errStr ); ExitProcess(1); } HeapFree( GetProcessHeap(), 0, tmp );