[Bug 46319] New: 32-bit IL-only executable launched as 32-bit subprocess on Wine and 64-bit subprocess on Windows
wine-bugs at winehq.org
wine-bugs at winehq.org
Mon Dec 17 17:23:51 CST 2018
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 at winehq.org
Reporter: brendan at 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
--
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.
More information about the wine-bugs
mailing list