https://bugs.winehq.org/show_bug.cgi?id=51264
Bug ID: 51264 Summary: GUI exe receives invalid StdOutput HANDLE if launched via ShellExecuteEx Product: Wine Version: 6.3 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: -unknown Assignee: wine-bugs@winehq.org Reporter: brendan@redmandi.com Distribution: ---
Created attachment 70142 --> https://bugs.winehq.org/attachment.cgi?id=70142 Source code for the primary exe to recreate the issue
It is possible for a child process to inherit an invalid hStdOutput HANDLE if the PE header has the subsystem value of IMAGE_SUBSYSTEM_WINDOWS_GUI and it is launched via ShellExecuteEx.
It also requires the primary process to be launched via: - 'wine' if it is a PE32+ executable; or - 'wine64' if it is a PE32 executable
Attached are two source files that can be used to recreate the issue: 1. main.c (the primary process); and 2. child.c (the child process)
Compile with: x86_64-w64-mingw32-gcc -o main.exe main.c x86_64-w64-mingw32-gcc -o child.exe child.c -mwindows
and run with: wine main.exe
The child.exe creates a file called 'stdout.log' that dumps the STD_OUTPUT_HANDLE value and its FileType. Under wine, this is: StdOutput: 14, Type: 1 and under Windows, it is: StdOutput: 0, Type: 0
I first ran in this this issue when running Elite Dangerous from Proton 6.3 (i.e. wine version 6.3) - but my investigations show this still occurs with git commit 6b277dc89d55.