Commit c87aa2b9 authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Support loading old runtime versions of IL-only images.

parent 96eebec9
......@@ -522,13 +522,14 @@ static NTSTATUS map_image_section( const IMAGE_NT_HEADERS *nt_header, const IMAG
mod = LoadLibraryExA( dll_name, 0, DONT_RESOLVE_DLL_REFERENCES );
if (!has_code && nt_header->OptionalHeader.Magic == IMAGE_NT_OPTIONAL_HDR32_MAGIC)
{
BOOL il_only = FALSE;
BOOL il_only = FALSE, want_32bit = FALSE;
if (((const IMAGE_NT_HEADERS32 *)nt_header)->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR].VirtualAddress)
{
const IMAGE_COR20_HEADER *cor_header = section_data;
il_only = (cor_header->Flags & COMIMAGE_FLAGS_ILONLY) != 0;
if (il_only) want_32bit = (cor_header->Flags & COMIMAGE_FLAGS_32BITREQUIRED) != 0;
}
ok( mod != NULL || broken(il_only), /* <= win7 */
ok( mod != NULL || want_32bit || broken(il_only), /* <= win7 */
"%u: loading failed err %u\n", line, GetLastError() );
}
else
......
......@@ -1989,7 +1989,14 @@ static BOOL is_valid_binary( HMODULE module, const pe_image_info_t *info )
if (info->machine == IMAGE_FILE_MACHINE_ARM64) return TRUE;
#endif
if (!info->contains_code) return TRUE;
if (!(info->image_flags & IMAGE_FLAGS_ComPlusNativeReady)) return FALSE;
if (!(info->image_flags & IMAGE_FLAGS_ComPlusNativeReady))
{
/* check COM header directly, ignoring runtime version */
DWORD size;
const IMAGE_COR20_HEADER *cor_header = RtlImageDirectoryEntryToData( module, TRUE,
IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR, &size );
if (!cor_header || !(cor_header->Flags & COMIMAGE_FLAGS_ILONLY)) return FALSE;
}
return convert_to_pe64( module, info );
#else
return FALSE; /* no wow64 support on other platforms */
......
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