Ok, here is a quick rundown of the problem...
all programs were being passed to open_winelib_app by PROCESS_InitWine. Once inside open_winelib_app, there was a sanity check for if argv[0] was equal to wine
which if it was and you were trying to run a winelib app, then it would bail out, and if it wasn't it would run the program
if it was wine and you weren't trying to run a winelib app then it would run it...
the problem was that with /mnt/cdrom/Setup.exe not being the real installer for Unreal Tournament (being just a caller for the real installer), argv[0] would equal wine on the first run though (/mnt/cdrom/Setup.exe), but it would equal /usr/local/bin/wine on the 2nd run through (/mnt/cdrom/System/Setup.exe), which doesn't equal "wine", so it would try to open the app as a winelib app. I moved that incorrect code from open_winelib_app to PROCESS_InitWine and modified it so that it would change "/usr/local/bin/wine" to "wine" but otherwise leave it alone... the code is ugly, but it works, if someone want's to clean it up, feel free to do so, just give me credit for the original submission...
-Dustin
__________________________________________________ Do You Yahoo!? LAUNCH - Your Yahoo! Music Experience http://launch.yahoo.com
Author: Dustin Navea ChangeLog: adds the necessary check to PROCESS_InitWine, so that we no longer pass _every_ application to open_winelib_app (saving some headaches with weird windows binaries) License: ALL Permissions: you may use this to teach yourself c, and may modify the code in this diff, only to clean it up. you must maintain this notice and give credit for the original submission in your cleaned up submission. ===================================================================================== --- scheduler/process.c Sat May 18 20:23:26 2002 +++ scheduler/process.c.new Sat May 18 20:18:55 2002 @@ -447,21 +447,12 @@ } else { - const char *argv0 = main_exe_name; - if (!*argv0) - { - /* if argv[0] is "wine", don't try to load anything */ - argv0 = argv[0]; - if (!(name = strrchr( argv0, '/' ))) name = argv0; - else name++; - if (!strcmp( name, "wine" )) return NULL; - } - /* now try argv[0] with ".so" appended */ if ((tmp = HeapAlloc( GetProcessHeap(), 0, strlen(argv0) + 4 ))) { strcpy( tmp, argv0 ); strcat( tmp, ".so" ); + name = argv0; /* search in PATH only if there was no '/' in argv[0] */ ret = wine_dll_load_main_exe( tmp, (name == argv0), errStr, sizeof(errStr) ); if (!ret && !argv[1]) @@ -485,11 +476,31 @@ void PROCESS_InitWine( int argc, char *argv[], LPSTR win16_exe_name, HANDLE *win16_exe_file ) { DWORD stack_size = 0; + const char *name;
/* Initialize everything */ if (!process_init( argv )) exit(1);
- if (open_winelib_app( app_argv )) goto found; /* try to open argv[0] as a winelib app */ + /* these next 2 if's check the name of the wine executable being run for + compatibility with weird apps */ + if (!(name = strrchr( argv[0], '/' ))) name = argv[0]; + else + { + name = strrchr( argv[0], '/' ); + name = strstr( name, "wine" ); + } + if (!(argv0 = strrchr( argv[0], '/' ))) argv0 = argv[0]; + else + { + argv0 = strrchr( argv[0], '/' ); + argv0 = strstr( argv0, "wine" ); + } + + if ((strcmp( argv0, "wine" )) && (strcmp( name, "wine" ))) + { + /* try to open argv[0] as a winelib app */ + if (open_winelib_app( app_argv )) goto found; + }
app_argv++; /* remove argv[0] (wine itself) */ app_argc--;