Fix loading of modules: now search key is module's filename, not

module's name.
This commit is contained in:
Eric Pouech 1999-10-13 15:59:26 +00:00 committed by Alexandre Julliard
parent 89ab9f08ab
commit d2344fbbcd
2 changed files with 20 additions and 6 deletions

View File

@ -233,11 +233,19 @@ HMODULE16 BUILTIN_LoadModule( LPCSTR name, BOOL force )
if ((p = strrchr( name, '\\' ))) name = p + 1;
lstrcpynA( dllname, name, sizeof(dllname) );
if ((p = strrchr( dllname, '.' ))) *p = '\0';
p = strrchr( dllname, '.' );
if (!p) strcat( dllname, ".dll" );
for (table = BuiltinDLLs; table->descr; table++)
if (!lstrcmpiA( table->descr->name, dllname )) break;
{
NE_MODULE *pModule = (NE_MODULE *)table->descr->module_start;
OFSTRUCT *pOfs = (OFSTRUCT *)((LPBYTE)pModule + pModule->fileinfo);
if (!lstrcmpiA( pOfs->szPathName, dllname )) break;
}
if (!table->descr) return (HMODULE16)2;
if ((table->flags & DLL_FLAG_NOT_USED) && !force) return (HMODULE16)2;
return BUILTIN_DoLoadModule16( table->descr );

View File

@ -418,19 +418,25 @@ HMODULE BUILTIN32_LoadImage( LPCSTR name, OFSTRUCT *ofs)
if ((p = strrchr( name, '\\' ))) name = p + 1;
lstrcpynA( dllname, name, sizeof(dllname) );
if ((p = strrchr( dllname, '.' ))) *p = '\0';
p = strrchr( dllname, '.' );
if (!p) strcat( dllname, ".dll" );
for (table = BuiltinDLLs; table->descr; table++)
if (!lstrcmpiA( table->descr->name, dllname )) break;
{
if (!lstrcmpiA( table->descr->filename, dllname )) break;
}
if (!table->descr) return 0;
if ( (table->flags & BI32_INSTANTIATED) && (table->flags & BI32_DANGER) )
{
ERR_(module)("Attemp to instantiate built-in dll '%s' twice in the same address-space. Expect trouble!\n",
table->descr->name);
table->descr->name);
}
sprintf( ofs->szPathName, "%s.DLL", table->descr->name );
strcpy( ofs->szPathName, table->descr->filename );
if ( !table->hModule )
table->hModule = BUILTIN32_DoLoadImage( table );