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

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2019-01-25 15:29:53 +01:00
parent 96eebec967
commit c87aa2b9fc
2 changed files with 11 additions and 3 deletions

View File

@ -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

View File

@ -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 */