LOAD_LIBRARY_AS_DATAFILE modules must be mapped like normal files, not
like PE images. Fixed resource loading to handle that.
diff --git a/loader/module.c b/loader/module.c
index c8f716d..08efd21 100644
--- a/loader/module.c
+++ b/loader/module.c
@@ -1284,7 +1284,18 @@
NULL, OPEN_EXISTING, 0, 0 );
if (hFile != INVALID_HANDLE_VALUE)
{
- hmod = PE_LoadImage( hFile, filename, flags );
+ DWORD type;
+ MODULE_GetBinaryType( hFile, filename, &type );
+ if (type == SCS_32BIT_BINARY)
+ {
+ HANDLE mapping = CreateFileMappingA( hFile, NULL, PAGE_READONLY,
+ 0, 0, NULL );
+ if (mapping)
+ {
+ hmod = (HMODULE)MapViewOfFile( mapping, FILE_MAP_READ, 0, 0, 0 );
+ CloseHandle( mapping );
+ }
+ }
CloseHandle( hFile );
}
if (hmod) return (HMODULE)((ULONG_PTR)hmod + 1);