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