Uwe Bonnes wrote:
> 
> Hallo,
> 
> our ../dlls/Makefile results in libw32sys.so to become a symlink to
> win32s/libw32skrnl.so. I don't know if that is right. However this
> results in a crash when an application tries to do
> 
> Call KERNEL32.495: LoadLibraryA(0072e188 "W32SYS.DLL") ret=0065007e fs=0247
well, W32SYS is a 16 bit DLL, so it's strange it tries to get loaded from a 32
bit func. can you look from where this call to LoadLibraryA comes from ?

> as in BUILTIN32_LoadLibraryExA libw32skrnl.so gets loaded, but the
> name "w32sys" doesn't appear in the list of loaded dlls. 
(it's not in the list coz it's a 16 bit module. this list is for 32 bit)

> nb_dlls got
> incremented, but after the BUILTIN32_dlclose builtin_dlls[nb_dlls -1]
> is invalid and to a later reference results in a crash.
this is a generic issue. you're right nb_dlls must be brought back to
its initial value (before dlopen). but more than a descriptor can be
found inside the same .so file, so it's not just a matter of decrementing
(attached, a tentative patch)

> I can work around that problem by decrementing nb_dlls after the
> BUILTIN32_dlclose call. This might be needed anyhow to cope for dlls
> with invalid names.
if name is invalid, no .so file will be loaded, so nb_dlls is gonna
be unchanged. but this still need to be fixed

A+
-- 
---------------
Eric Pouech (http://perso.wanadoo.fr/eric.pouech/)
"The future will be better tomorrow", Vice President Dan Quayle
Index: relay32/builtin32.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/relay32/builtin32.c,v
retrieving revision 1.47
diff -u -r1.47 builtin32.c
--- relay32/builtin32.c 2000/04/24 17:17:53     1.47
+++ relay32/builtin32.c 2000/04/30 16:45:01
@@ -398,7 +398,7 @@
     WINE_MODREF   *wm;
     char           dllname[MAX_PATH], *p;
     void *handle;
-    int i;
+    int i, j;
 
     /* Fix the name in case we have a full path and extension */
     if ((p = strrchr( path, '\\' ))) path = p + 1;
@@ -413,10 +413,14 @@
 
     if ((handle = BUILTIN32_dlopen( dllname )))
     {
-        for (i = 0; i < nb_dlls; i++)
-            if (!strcasecmp( builtin_dlls[i]->filename, dllname )) goto found;
+       /* i contains old nb_dlls value, so new DLL descriptors will be
+       * stored in [i, nb_dlls[ 
+       */
+        for (j = i; j < nb_dlls; j++)
+            if (!strcasecmp( builtin_dlls[j]->filename, dllname )) goto found;
         ERR( "loaded .so but dll %s still not found\n", dllname );
         BUILTIN32_dlclose( handle );
+       nb_dlls = i; /* remove now invalid descriptors */
     }
 
     SetLastError( ERROR_FILE_NOT_FOUND );

Reply via email to