From 0eec45a97b177b642fb7e0f89d4d6610a50eb598 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Fri, 16 Aug 2002 20:02:54 +0000 Subject: [PATCH] Force loadorder of 16-bit dlls to builtin if their 32-bit counterpart has already been loaded as builtin. --- if1632/builtin.c | 19 +++++++++++++++++++ include/builtin16.h | 2 -- include/module.h | 4 ++++ loader/loadorder.c | 13 ++++++++++++- 4 files changed, 35 insertions(+), 3 deletions(-) diff --git a/if1632/builtin.c b/if1632/builtin.c index f14dd510a58..d06b036424a 100644 --- a/if1632/builtin.c +++ b/if1632/builtin.c @@ -154,6 +154,25 @@ static const BUILTIN16_DESCRIPTOR *find_dll_descr( const char *dllname ) } +/*********************************************************************** + * BUILTIN_IsPresent + * + * Check if a builtin dll descriptor is present (because we loaded its 32-bit counterpart). + */ +BOOL BUILTIN_IsPresent( LPCSTR name ) +{ + char dllname[20], *p; + + if (strlen(name) >= sizeof(dllname)-4) return FALSE; + strcpy( dllname, name ); + p = strrchr( dllname, '.' ); + if (!p) strcat( dllname, ".dll" ); + for (p = dllname; *p; p++) *p = FILE_tolower(*p); + + return (find_dll_descr( dllname ) != NULL); +} + + /*********************************************************************** * BUILTIN_LoadModule * diff --git a/include/builtin16.h b/include/builtin16.h index 3b9bcc79fc7..a1ce7b86fa6 100644 --- a/include/builtin16.h +++ b/include/builtin16.h @@ -88,8 +88,6 @@ enum arg_types #define ARG_RET16 0x80000000 /* function returns 16-bit value */ #define ARG_REGISTER 0x40000000 /* function is register */ -extern HMODULE16 BUILTIN_LoadModule( LPCSTR name ); - extern WORD __wine_call_from_16_word(); extern LONG __wine_call_from_16_long(); extern void __wine_call_from_16_regs(); diff --git a/include/module.h b/include/module.h index c953a9fce77..3ba8b1a5538 100644 --- a/include/module.h +++ b/include/module.h @@ -272,6 +272,10 @@ extern HMODULE BUILTIN32_LoadExeModule( HMODULE main ); extern void *BUILTIN32_dlopen( const char *name ); extern int BUILTIN32_dlclose( void *handle ); +/* if1632/builtin.c */ +extern HMODULE16 BUILTIN_LoadModule( LPCSTR name ); +extern BOOL BUILTIN_IsPresent( LPCSTR name ); + /* USER signal proc flags and codes */ /* See PROCESS_CallUserSignalProc for comments */ #define USIG_FLAGS_WIN32 0x0001 diff --git a/loader/loadorder.c b/loader/loadorder.c index 2f1107ac0e8..ee9e02cb098 100644 --- a/loader/loadorder.c +++ b/loader/loadorder.c @@ -494,7 +494,18 @@ void MODULE_GetLoadOrder( enum loadorder_type loadorder[], const char *path, BOO /* Strip path information for 16 bit modules or if the module * resides in the system directory */ - if (!win32) path = get_basename( path ); + if (!win32) + { + path = get_basename( path ); + if (BUILTIN_IsPresent(path)) + { + TRACE( "forcing loadorder to builtin for %s\n", debugstr_a(path) ); + /* force builtin loadorder since the dll is already in memory */ + loadorder[0] = LOADORDER_BI; + loadorder[1] = LOADORDER_INVALID; + return; + } + } else { char sysdir[MAX_PATH+1];