diff --git a/dlls/kernel32/tests/loader.c b/dlls/kernel32/tests/loader.c index 01c7cfa8a91..23dfc93d740 100644 --- a/dlls/kernel32/tests/loader.c +++ b/dlls/kernel32/tests/loader.c @@ -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 diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index ecc09d33cf6..a47dfe0aa1a 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -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 */