[PATCH 2/2] kernel32/tests: Don't load 32BITREQUIRED when 64bit

Brendan McGrath brendan at redmandi.com
Thu Nov 29 03:09:13 CST 2018


If the 32BITREQUIRED flag is present in the COM image header, then the
image should not be loaded under a 64bit process.

This patch makes changes to an existing (failing) test to reflect that (it
now passes).

Signed-off-by: Brendan McGrath <brendan at redmandi.com>
---
 dlls/kernel32/tests/loader.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/dlls/kernel32/tests/loader.c b/dlls/kernel32/tests/loader.c
index aaaa39f601d4..44e1ef1cac6f 100644
--- a/dlls/kernel32/tests/loader.c
+++ b/dlls/kernel32/tests/loader.c
@@ -522,13 +522,15 @@ 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, il_32bit_only = 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;
+                    il_32bit_only = (cor_header->Flags & COMIMAGE_FLAGS_32BITREQUIRED) != 0;
                 }
-                ok( mod != NULL || broken(il_only), /* <= win7 */
+                ok( mod != NULL || broken(il_only) /* <= win7 */
+                                || (is_win64 && il_32bit_only && mod == NULL),
                     "%u: loading failed err %u\n", line, GetLastError() );
             }
             else
-- 
2.17.1




More information about the wine-devel mailing list