Commit 7aa6dcaf authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Handle LOAD_LIBRARY_AS_IMAGE_RESOURCE modules when loading resources.

parent 9566c50a
...@@ -3277,11 +3277,8 @@ PVOID WINAPI RtlImageDirectoryEntryToData( HMODULE module, BOOL image, WORD dir, ...@@ -3277,11 +3277,8 @@ PVOID WINAPI RtlImageDirectoryEntryToData( HMODULE module, BOOL image, WORD dir,
const IMAGE_NT_HEADERS *nt; const IMAGE_NT_HEADERS *nt;
DWORD addr; DWORD addr;
if ((ULONG_PTR)module & 1) /* mapped as data file */ if ((ULONG_PTR)module & 1) image = FALSE; /* mapped as data file */
{ module = (HMODULE)((ULONG_PTR)module & ~3);
module = (HMODULE)((ULONG_PTR)module & ~1);
image = FALSE;
}
if (!(nt = RtlImageNtHeader( module ))) return NULL; if (!(nt = RtlImageNtHeader( module ))) return NULL;
if (nt->OptionalHeader.Magic == IMAGE_NT_OPTIONAL_HDR64_MAGIC) if (nt->OptionalHeader.Magic == IMAGE_NT_OPTIONAL_HDR64_MAGIC)
{ {
......
...@@ -333,12 +333,12 @@ static inline NTSTATUS access_resource( HMODULE hmod, const IMAGE_RESOURCE_DATA_ ...@@ -333,12 +333,12 @@ static inline NTSTATUS access_resource( HMODULE hmod, const IMAGE_RESOURCE_DATA_
{ {
if (ptr) if (ptr)
{ {
if (is_data_file_module(hmod)) BOOL is_data_file = is_data_file_module(hmod);
{ hmod = (HMODULE)((ULONG_PTR)hmod & ~3);
HMODULE mod = (HMODULE)((ULONG_PTR)hmod & ~1); if (is_data_file)
*ptr = RtlImageRvaToVa( RtlImageNtHeader(mod), mod, entry->OffsetToData, NULL ); *ptr = RtlImageRvaToVa( RtlImageNtHeader(hmod), hmod, entry->OffsetToData, NULL );
} else
else *ptr = (char *)hmod + entry->OffsetToData; *ptr = (char *)hmod + entry->OffsetToData;
} }
if (size) *size = entry->Size; if (size) *size = entry->Size;
status = STATUS_SUCCESS; status = STATUS_SUCCESS;
......
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