Fix loading of modules: now search key is module's filename, not
module's name.
diff --git a/if1632/builtin.c b/if1632/builtin.c
index 7be0d67..e6766fc 100644
--- a/if1632/builtin.c
+++ b/if1632/builtin.c
@@ -233,11 +233,19 @@
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 );
diff --git a/relay32/builtin32.c b/relay32/builtin32.c
index 5d73107..450df45 100644
--- a/relay32/builtin32.c
+++ b/relay32/builtin32.c
@@ -418,19 +418,25 @@
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 );