KERNEL32: fix builtin NE module refcounting of 32bit parent

Mike McCormack mike at codeweavers.com
Mon Mar 29 22:55:55 CST 2004


ChangeLog:
* fix builtin NE module refcounting of 32bit parent
-------------- next part --------------
Index: dlls/kernel/ne_module.c
===================================================================
RCS file: /home/wine/wine/dlls/kernel/ne_module.c,v
retrieving revision 1.21
diff -u -r1.21 ne_module.c
--- dlls/kernel/ne_module.c	9 Mar 2004 23:51:03 -0000	1.21
+++ dlls/kernel/ne_module.c	30 Mar 2004 04:03:42 -0000
@@ -1167,41 +1167,38 @@
 
     if (strlen(basename) < sizeof(dllname)-4)
     {
+        int file_exists;
+
         strcpy( dllname, basename );
         p = strrchr( dllname, '.' );
         if (!p) strcat( dllname, ".dll" );
         for (p = dllname; *p; p++) if (*p >= 'A' && *p <= 'Z') *p += 32;
 
-        if (!(descr = find_dll_descr( dllname )))
+        if (wine_dll_get_owner( dllname, owner, sizeof(owner), &file_exists ) == -1)
         {
-            int file_exists;
-
-            if (wine_dll_get_owner( dllname, owner, sizeof(owner), &file_exists ) == -1)
-            {
-                if (file_exists) return 21;  /* it may be a Win32 module then */
-            }
-            else  /* found 32-bit owner, try to load it */
+            if (file_exists) return 21;  /* it may be a Win32 module then */
+        }
+        else  /* found 32-bit owner, try to load it */
+        {
+            HMODULE mod32 = LoadLibraryA( owner );
+            if (mod32)
             {
-                HMODULE mod32 = LoadLibraryA( owner );
-                if (mod32)
+                if (!(descr = find_dll_descr( dllname ))) FreeLibrary( mod32 );
+                /* loading the 32-bit library can have the side effect of loading the module */
+                /* if so, simply incr the ref count and return the module */
+                if ((hModule = GetModuleHandle16( libname )))
                 {
-                    if (!(descr = find_dll_descr( dllname ))) FreeLibrary( mod32 );
-                    /* loading the 32-bit library can have the side effect of loading the module */
-                    /* if so, simply incr the ref count and return the module */
-                    if ((hModule = GetModuleHandle16( libname )))
-                    {
-                        TRACE( "module %s already loaded by owner\n", libname );
-                        pModule = NE_GetPtr( hModule );
-                        if (pModule) pModule->count++;
-                        return hModule;
-                    }
-                }
-                else
-                {
-                    /* it's probably disabled by the load order config */
-                    WARN( "couldn't load owner %s for 16-bit dll %s\n", owner, dllname );
-                    return ERROR_FILE_NOT_FOUND;
+                    TRACE( "module %s already loaded by owner\n", libname );
+                    pModule = NE_GetPtr( hModule );
+                    if (pModule) pModule->count++;
+                    return hModule;
                 }
+            }
+            else
+            {
+                /* it's probably disabled by the load order config */
+                WARN( "couldn't load owner %s for 16-bit dll %s\n", owner, dllname );
+                return ERROR_FILE_NOT_FOUND;
             }
         }
     }


More information about the wine-patches mailing list