[PATCH] ntdll: Fix overflow if running 32bit app w/ wine64

Brendan McGrath brendan at redmandi.com
Wed Oct 17 07:42:15 CDT 2018


It seems to be a problem with any 32-bit Mono app ran with 'wine64'. I 
think it converts the bytecode to 64-bit machine code (even though the 
header is PE32).

You can recreate by copy and pasting the following:
# create csharp code
cat << END > helloworld.cs
using Microsoft.Win32;
using System;

public class HelloWorld
{
     static public void Main ()
     {
         Console.WriteLine ("Hello World");
     }
}
END

# compile
mcs helloworld.cs
mcs -platform:x64 helloworld.cs -out:helloworld64.exe

# confirm headers
file helloworld.exe helloworld64.exe

# Output should be
# helloworld.exe:   PE32 executable (console) Intel 80386 Mono/.Net 
assembly, for MS Windows
# helloworld64.exe: PE32+ executable (console) x86-64 Mono/.Net 
assembly, for MS Windows

# run 64-bit version
wine64 helloworld64

# run 32-bit version (LdrInitializeThunk Main exe initialization failed, 
status c0000017)
wine64 helloworld



On 17/10/18 8:12 pm, Alexandre Julliard wrote:
> Brendan McGrath <brendan at redmandi.com> writes:
>
>> wine64 was using IMAGE_NT_HEADERS to access header information
>> regardless of the execution type; hence it would use
>> IMAGE_OPTIONAL_HEADER64 for a 32bit app.
> wine64 should not be used for a 32-bit binary, it should exec the 32-bit
> loader instead. Do you have a sample app to reproduce this?
>




More information about the wine-devel mailing list