[PATCH] ntdll: Test ImageContainsCode before calling convert_to_pe64

David Koolhoven david at koolhoven-home.net
Tue Feb 9 23:24:49 CST 2021


6.0 would not call convert_to_pe64 if the image did not
have a pointer to ImageContainsCode, and would instead
return TRUE. This restores a similar outcome.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50647
Signed-off-by: David Koolhoven <david at koolhoven-home.net>
---
 dlls/ntdll/loader.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index 6b76c6f406e..7195f4f7af6 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -2324,7 +2324,10 @@ static NTSTATUS load_native_dll( LPCWSTR load_path, const UNICODE_STRING *nt_nam
 
     if (status == STATUS_IMAGE_NOT_AT_BASE) status = STATUS_SUCCESS;
 #ifdef _WIN64
-    if (!status && !convert_to_pe64( module, image_info )) status = STATUS_INVALID_IMAGE_FORMAT;
+    if (!status &&
+        image_info->ImageContainsCode &&
+        !convert_to_pe64( module, image_info ))
+	    status = STATUS_INVALID_IMAGE_FORMAT;
 #endif
     if (!status) status = build_module( load_path, nt_name, &module, image_info, id, flags, pwm );
     if (status && module) NtUnmapViewOfSection( NtCurrentProcess(), module );
-- 
2.19.1




More information about the wine-devel mailing list