[PATCH v2] kernel32: Launch 32-bit IL-only as 64-bit in WIN64

Brendan McGrath brendan at redmandi.com
Thu Feb 14 23:50:02 CST 2019


When using CreateProcessA to execute a 32-bit .NET/Mono application
(which is IL-only) the process is always launched as a 32-bit process
under Wine; but under Windows it is launched as a 64-bit process.

This patch changes Wine's behaviour to match Windows.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46319
Signed-off-by: Brendan McGrath <brendan at redmandi.com>
---
Changes since v1:
 - update info->cpu (and remove #ifdef statements)
 - handle ARM64

 dlls/kernel32/process.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c
index ad257a054e..0524a4b39a 100644
--- a/dlls/kernel32/process.c
+++ b/dlls/kernel32/process.c
@@ -254,7 +254,17 @@ static enum binary_type get_binary_info( HANDLE hfile, pe_image_info_t *info )
     switch (status)
     {
     case STATUS_SUCCESS:
+    {
+        if (is_win64 && info->image_flags & IMAGE_FLAGS_ComPlusNativeReady)
+        {
+            switch(info->cpu)
+            {
+            case CPU_x86: info->cpu = CPU_x86_64; break;
+            case CPU_ARM: info->cpu = CPU_ARM64; break;
+            }
+        }
         return BINARY_PE;
+    }
     case STATUS_INVALID_IMAGE_WIN_32:
         return BINARY_PE;
     case STATUS_INVALID_IMAGE_WIN_64:
-- 
2.17.1




More information about the wine-devel mailing list