More verbose error messages when application load fails.

This commit is contained in:
Josh DuBois 2001-02-13 20:23:45 +00:00 committed by Alexandre Julliard
parent 4570478a6e
commit 169adf5c64
3 changed files with 12 additions and 10 deletions

View file

@ -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 */

View file

@ -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;

View file

@ -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 );