[Bug 51264] GUI exe receives invalid StdOutput HANDLE if launched via ShellExecuteEx

WineHQ Bugzilla wine-bugs at winehq.org
Wed Jun 23 22:00:37 CDT 2021


https://bugs.winehq.org/show_bug.cgi?id=51264

--- Comment #6 from Brendan McGrath <brendan at redmandi.com> ---
I've created new tests that will check both GUI and CUI exes, and also check
what happens when inherit is TRUE and when it is FALSE.

All tests use the CREATE_NEW_CONSOLE flag.

Compile with:
x86_64-w64-mingw32-gcc -o main.exe main.c
x86_64-w64-mingw32-gcc -o child.exe child.c
x86_64-w64-mingw32-gcc -o child_gui.exe child.c -mwindows

Run with:
wine main.exe

This will output a testx.log file for each test (where the 'x' represents the
test number). The contents of each testx.log file is:
1. StdOutput = GetStdHandle(STD_OUTPUT_HANDLE);
2. params->hStdOutput =
NtCurrentTeb()->ProcessEnvironmentBlock->ProcessParameters->hStdOutput
3. hStdOutput from GetStartupInfoA
4. hStdOutput from GetStartupInfoW

Running under Wine, I get the following results:
*** Primary process***
StdOutput: 14, Type: 2

*** Child process ***
**inherit true**
*CUI*
StdOutput: 50, Type: 2
params->hStdOutput: 50, Type: 2
siA.hStdOutput: 50, Type: 2
siW.hStdOutput: 14, Type: 2

*GUI*
StdOutput: 14, Type: 2
params->hStdOutput: 14, Type: 2
siA.hStdOutput: 14, Type: 2
siW.hStdOutput: 14, Type: 2

**inherit false**
*CUI*
StdOutput: 44, Type: 2
params->hStdOutput: 44, Type: 2
siA.hStdOutput: 44, Type: 2
siW.hStdOutput: 14, Type: 1

*GUI*
StdOutput: 14, Type: 1
params->hStdOutput: 14, Type: 1
siA.hStdOutput: 14, Type: 1
siW.hStdOutput: 14, Type: 1


And running under Windows I get:
*** Primary process***
StdOutput: 60, Type: 2

*** Child process ***
**inherit true**
*CUI*
StdOutput: 6c, Type: 2
params->hStdOutput: 6c, Type: 2
siA.hStdOutput: ffffffff, Type: 0
siW.hStdOutput: 0, Type: 0

*GUI*
StdOutput: 0, Type: 0
params->hStdOutput: 0, Type: 0
siA.hStdOutput: ffffffff, Type: 0
siW.hStdOutput: 0, Type: 0

**inherit false**
*CUI*
StdOutput: 58, Type: 2
params->hStdOutput: 58, Type: 2
siA.hStdOutput: ffffffff, Type: 0
siW.hStdOutput: 0, Type: 0

*GUI*
StdOutput: 0, Type: 0
params->hStdOutput: 0, Type: 0
siA.hStdOutput: ffffffff, Type: 0
siW.hStdOutput: 0, Type: 0



So it looks like the StdHandles are never inherited on Windows when the
CREATE_NEW_CONSOLE flag is used.

I'll also need to check if the CREATE_UNICODE_ENVIRONMENT flag is impacting the
different values between siA and siW.

-- 
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