Commit ed8a17fb authored by Alexandre Julliard's avatar Alexandre Julliard

Changed LoadLibraryEx32W16 to use OpenFile16 to look for the file

instead of DIR_SearchPath.
parent 09d2d477
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
#include "excpt.h" #include "excpt.h"
#include "winreg.h" #include "winreg.h"
#include "winternl.h" #include "winternl.h"
#include "file.h"
#include "miscemu.h" #include "miscemu.h"
#include "module.h" #include "module.h"
#include "stackframe.h" #include "stackframe.h"
...@@ -756,11 +755,9 @@ DWORD WINAPI GetVDMPointer32W16( SEGPTR vp, UINT16 fMode ) ...@@ -756,11 +755,9 @@ DWORD WINAPI GetVDMPointer32W16( SEGPTR vp, UINT16 fMode )
DWORD WINAPI LoadLibraryEx32W16( LPCSTR lpszLibFile, DWORD hFile, DWORD dwFlags ) DWORD WINAPI LoadLibraryEx32W16( LPCSTR lpszLibFile, DWORD hFile, DWORD dwFlags )
{ {
HMODULE hModule; HMODULE hModule;
DOS_FULL_NAME full_name;
DWORD mutex_count; DWORD mutex_count;
UNICODE_STRING libfileW; OFSTRUCT ofs;
LPCWSTR filenameW; const char *p;
static const WCHAR dllW[] = {'.','D','L','L',0};
if (!lpszLibFile) if (!lpszLibFile)
{ {
...@@ -768,25 +765,27 @@ DWORD WINAPI LoadLibraryEx32W16( LPCSTR lpszLibFile, DWORD hFile, DWORD dwFlags ...@@ -768,25 +765,27 @@ DWORD WINAPI LoadLibraryEx32W16( LPCSTR lpszLibFile, DWORD hFile, DWORD dwFlags
return 0; 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 /* 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 ((p = strrchr( lpszLibFile, '.' )) && !strchr( p, '\\' )) /* got an extension */
if ( DIR_SearchPath( NULL, filenameW, dllW, &full_name, FALSE ) ) {
filenameW = full_name.short_name; 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 ); ReleaseThunkLock( &mutex_count );
hModule = LoadLibraryExW( filenameW, (HANDLE)hFile, dwFlags ); hModule = LoadLibraryExA( lpszLibFile, (HANDLE)hFile, dwFlags );
RestoreThunkLock( mutex_count ); RestoreThunkLock( mutex_count );
RtlFreeUnicodeString(&libfileW);
return (DWORD)hModule; return (DWORD)hModule;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment