From abd79ddda466f59c876351747b2262291470997e Mon Sep 17 00:00:00 2001 From: Eric Pouech Date: Mon, 26 Apr 1999 14:53:32 +0000 Subject: [PATCH] Fixed loading of native NE dlls. --- loader/ne/module.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/loader/ne/module.c b/loader/ne/module.c index 4a5a498f406..27baf9223b7 100644 --- a/loader/ne/module.c +++ b/loader/ne/module.c @@ -758,18 +758,6 @@ static BOOL NE_LoadDLLs( NE_MODULE *pModule ) HMODULE16 hDLL; if ((hDLL = MODULE_LoadModule16( buffer, TRUE )) < 32) - { - /* append ".dll" if no other extension */ - if (!strchr(buffer,'.')) - strcpy( buffer + *pstr, ".dll" ); - - /* Retry to get the handle to see whether it was loaded */ - if ((*pModRef = GetModuleHandle16( buffer ))) - goto was_loaded; - - hDLL = MODULE_LoadModule16( buffer, TRUE ); - } - if (hDLL < 32) { /* FIXME: cleanup what was done */ @@ -784,7 +772,7 @@ static BOOL NE_LoadDLLs( NE_MODULE *pModule ) else /* Increment the reference count of the DLL */ { NE_MODULE *pOldDLL; -was_loaded: + pOldDLL = NE_GetPtr( *pModRef ); if (pOldDLL) pOldDLL->count++; } @@ -859,7 +847,14 @@ HINSTANCE16 NE_LoadModule( LPCSTR name, BOOL implicit ) if ((hFile = OpenFile16( name, &ofs, OF_READ )) == HFILE_ERROR16) { - return 2; /* File not found */ + char buffer[260]; + + /* 4 == strlen(".dll") */ + strncpy(buffer, name, sizeof(buffer) - 1 - 4); + strcat(buffer, ".dll"); + if ((hFile = OpenFile16( buffer, &ofs, OF_READ )) == HFILE_ERROR16) { + return 2; /* File not found */ + } } hInstance = NE_LoadFileModule( hFile, &ofs, implicit );