From f445ba78abbf32bb6294d500ae4e015dc5227d52 Mon Sep 17 00:00:00 2001 From: Uwe Bonnes Date: Sat, 8 May 1999 18:21:05 +0000 Subject: [PATCH] Fixed extension handling in LoadLibrary16. --- loader/ne/module.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/loader/ne/module.c b/loader/ne/module.c index 10fc73c4404..8655e91b05d 100644 --- a/loader/ne/module.c +++ b/loader/ne/module.c @@ -1126,13 +1126,38 @@ BOOL NE_CreateProcess( HFILE hFile, OFSTRUCT *ofs, LPCSTR cmd_line, LPCSTR env, /*********************************************************************** * LoadLibrary16 (KERNEL.95) + * + * In Win95 LoadLibrary16("c:/junkname/user.foo") returns the HINSTANCE + * to user.exe. As GetModuleHandle as of 990425 explicitly asks _not_ + * to change its handling of extensions, we have to try a stripped down + * libname here too (bon 990425) */ HINSTANCE16 WINAPI LoadLibrary16( LPCSTR libname ) { - TRACE( module, "(%p) %s\n", libname, libname ); + char strippedname[256]; + char *dirsep1,*dirsep2; + HINSTANCE16 ret; + + dirsep1=strrchr(libname,'\\'); + dirsep2=strrchr(libname,'/'); + dirsep1=MAX(dirsep1,dirsep2); + if (!dirsep1) + dirsep1 =(LPSTR)libname; + else + dirsep1++; + lstrcpynA(strippedname,dirsep1,256); + dirsep1=strchr(strippedname,'.'); + if (dirsep1) + *dirsep1=0; + + TRACE( module, "looking for (%p) %s and %s \n", + libname, libname,strippedname ); /* Load library module */ - return LoadModule16( libname, (LPVOID)-1 ); + ret= LoadModule16( strippedname, (LPVOID)-1 ); + if (ret > HINSTANCE_ERROR) + return ret; + return LoadModule16(libname, (LPVOID)-1 ); }