From ed8a17fb1b119732f4fa46386ed956e7c6dbfaf0 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Thu, 25 Mar 2004 05:32:05 +0000 Subject: [PATCH] Changed LoadLibraryEx32W16 to use OpenFile16 to look for the file instead of DIR_SearchPath. --- dlls/kernel/wowthunk.c | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/dlls/kernel/wowthunk.c b/dlls/kernel/wowthunk.c index 00baa659cf1..4b0f25bdebd 100644 --- a/dlls/kernel/wowthunk.c +++ b/dlls/kernel/wowthunk.c @@ -32,7 +32,6 @@ #include "excpt.h" #include "winreg.h" #include "winternl.h" -#include "file.h" #include "miscemu.h" #include "module.h" #include "stackframe.h" @@ -756,11 +755,9 @@ DWORD WINAPI GetVDMPointer32W16( SEGPTR vp, UINT16 fMode ) DWORD WINAPI LoadLibraryEx32W16( LPCSTR lpszLibFile, DWORD hFile, DWORD dwFlags ) { HMODULE hModule; - DOS_FULL_NAME full_name; DWORD mutex_count; - UNICODE_STRING libfileW; - LPCWSTR filenameW; - static const WCHAR dllW[] = {'.','D','L','L',0}; + OFSTRUCT ofs; + const char *p; if (!lpszLibFile) { @@ -768,25 +765,27 @@ DWORD WINAPI LoadLibraryEx32W16( LPCSTR lpszLibFile, DWORD hFile, DWORD dwFlags return 0; } - if (!RtlCreateUnicodeStringFromAsciiz(&libfileW, lpszLibFile)) - { - SetLastError(ERROR_NOT_ENOUGH_MEMORY); - return 0; - } - /* if the file can not be found, call LoadLibraryExA anyway, since it might be - a buildin module. This case is handled in MODULE_LoadLibraryExA */ + a builtin module. This case is handled in MODULE_LoadLibraryExA */ - filenameW = libfileW.Buffer; - if ( DIR_SearchPath( NULL, filenameW, dllW, &full_name, FALSE ) ) - filenameW = full_name.short_name; + if ((p = strrchr( lpszLibFile, '.' )) && !strchr( p, '\\' )) /* got an extension */ + { + if (OpenFile16( lpszLibFile, &ofs, OF_EXIST ) != HFILE_ERROR16) + lpszLibFile = ofs.szPathName; + } + else + { + char buffer[MAX_PATH+4]; + strcpy( buffer, lpszLibFile ); + strcat( buffer, ".dll" ); + if (OpenFile16( buffer, &ofs, OF_EXIST ) != HFILE_ERROR16) + lpszLibFile = ofs.szPathName; + } ReleaseThunkLock( &mutex_count ); - hModule = LoadLibraryExW( filenameW, (HANDLE)hFile, dwFlags ); + hModule = LoadLibraryExA( lpszLibFile, (HANDLE)hFile, dwFlags ); RestoreThunkLock( mutex_count ); - RtlFreeUnicodeString(&libfileW); - return (DWORD)hModule; } -- 2.11.4.GIT