Commit 1cf04bd7 authored by Mike McCormack's avatar Mike McCormack Committed by Alexandre Julliard

Fix builtin NE module refcounting of 32bit parent.

parent 114c9077
......@@ -1167,42 +1167,39 @@ static HINSTANCE16 MODULE_LoadModule16( LPCSTR libname, BOOL implicit, BOOL lib_
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;
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment