ntdll: Handle LOAD_LIBRARY_AS_IMAGE_RESOURCE modules when loading resources.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
9566c50a1e
commit
7aa6dcafbb
|
@ -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_
|
||||||
{
|
{
|
||||||
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;
|
||||||
|
|
Loading…
Reference in New Issue