Skip to content
Snippets Groups Projects
Commit 169adf5c authored by Josh DuBois's avatar Josh DuBois Committed by Alexandre Julliard
Browse files

More verbose error messages when application load fails.

parent 4570478a
No related branches found
No related tags found
No related merge requests found
......@@ -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 */
......
......@@ -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;
......
......@@ -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 );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment