Alexandre Julliard : ntdll: Support loading old runtime versions of IL-only images.
Alexandre Julliard
julliard at winehq.org
Fri Jan 25 16:29:07 CST 2019
Module: wine
Branch: master
Commit: c87aa2b9fcfc0d824f819e81279948d14fdb8e8a
URL: https://source.winehq.org/git/wine.git/?a=commit;h=c87aa2b9fcfc0d824f819e81279948d14fdb8e8a
Author: Alexandre Julliard <julliard at winehq.org>
Date: Fri Jan 25 15:29:53 2019 +0100
ntdll: Support loading old runtime versions of IL-only images.
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/kernel32/tests/loader.c | 5 +++--
dlls/ntdll/loader.c | 9 ++++++++-
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/dlls/kernel32/tests/loader.c b/dlls/kernel32/tests/loader.c
index 01c7cfa..23dfc93 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 ecc09d3..a47dfe0 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 */
More information about the wine-cvs
mailing list