RealPlayer has the following issue:
1/ it adds a dir to PATH environment var (lets call that dir c:/foo)
2/ it loads a bunch of DLLs. One of the DLL is bar. bar is located in c:/foo
so gets loaded (because of PATH containing c:/foo)
3/ it resets PATH to its initial value
4/ then loads another bunch of DLLs, and from import fixups, needs to get
a ref to bar. But since, the SearchPath fails (c:/foo is no longer in PATH),
loader assumes DLL in system directory, and fails to find it.
5/ since one import fixup fails, program is stopped

the attached patch solves the problem...
but I'm not 100% certain of the absence of side effects. any comments ?

A+
--
---------------
Eric Pouech (http://perso.wanadoo.fr/eric.pouech/)
"The future will be better tomorrow", Vice President Dan Quayle
Index: loader/module.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/loader/module.c,v
retrieving revision 1.101
diff -u -r1.101 module.c
--- loader/module.c     2000/08/30 00:00:49     1.101
+++ loader/module.c     2000/09/02 19:54:17
@@ -1293,13 +1293,29 @@
       
            /* if the filename doesn't have an extension append .DLL */
            if (!(p = strrchr( filename, '.')) || strchr( p, '/' ) || strchr( p, '\\'))
-            strcat( filename, ".DLL" );
+               strcat( filename, ".DLL" );
        }
 
        EnterCriticalSection(&PROCESS_Current()->crit_section);
 
        /* Check for already loaded module */
-       if((pwm = MODULE_FindModule(filename))) 
+       if (!(pwm = MODULE_FindModule(filename)) && 
+           /* no path in libpath */
+           !strchr( libname, '\\' ) && !strchr( libname, ':') && !strchr( libname, 
+'/' )) 
+        {
+           /* since the default loading mechanism uses a more detailed algorithm than
+            * SearchPath (like using PATH, which can even be modified between two
+            * attempts of loading the same DLL), the look-up above can have put the 
+file
+            * in system directory, whereas it has already been loaded but with a 
+different
+            * path. So do a specific look-up with filename (without any path)
+            */
+           strcpy ( filename, libname );
+           /* if the filename doesn't have an extension append .DLL */
+           if (!(p = strrchr( filename, '.')) || strchr( p, '/' ) || strchr( p, '\\'))
+               strcat( filename, ".DLL" );
+           pwm = MODULE_FindModule(filename);
+       }
+       if (pwm)
        {
                if(!(pwm->flags & WINE_MODREF_MARKER))
                        pwm->refCount++;

Reply via email to