https://bugs.winehq.org/show_bug.cgi?id=46319
Bug ID: 46319 Summary: 32-bit IL-only executable launched as 32-bit subprocess on Wine and 64-bit subprocess on Windows Product: Wine Version: 4.0-rc1 Hardware: x86 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: kernel32 Assignee: wine-bugs@winehq.org Reporter: brendan@redmandi.com Distribution: ---
Created attachment 63052 --> https://bugs.winehq.org/attachment.cgi?id=63052 Allow 32-bit IL-only application to launch as 64-bit process in WIN64
As stated in the summary - 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.
Attached is a proposed patch.
The issue can be recreated by running the following: # create mono source cat << 'END' > mono32.cs using Microsoft.Win32; using System.Diagnostics; using System.Reflection; using System.IO; using System;
public class Launcher { static public void Main () { RegistryKey rk = Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Cryptography");
if (rk != null) { object guid = rk.GetValue("MachineGuid"); if (guid != null) { Console.WriteLine ("it works!"); } else { Console.WriteLine ("guid not found - run as 64-bit process"); } } else { Console.WriteLine("Couldn't find 'HKLM\SOFTWARE\Microsoft\Cryptography'"); } } } END
# create 'C' source cat << 'END' > c64.c #include <windows.h> #include <stdio.h>
int main(int argc, const char *argv[]) { PROCESS_INFORMATION processInfo;
STARTUPINFO startupInfo; memset(&startupInfo, 0, sizeof startupInfo); startupInfo.cb = sizeof startupInfo;
// Create the process in suspended state if (!CreateProcessA( NULL, "mono32.exe", // only modified by CreateProcessW 0, // process attributes 0, // thread attributes TRUE, // inherit handles 0, // CREATE_SUSPENDED, NULL, // environment NULL, // current directory &startupInfo, &processInfo)) { DWORD dwLastError = GetLastError(); fprintf(stderr, "failed to execute mono32.exe (%lu)\n", dwLastError); return 1; }
return 0;
} END
# compile mono mcs mono32.cs
# compile 'C' x86_64-w64-mingw32-gcc c64.c -o c64.exe
# try wine64 (fails under wine without patch) wine64 c64.exe