[Bug 52761] mscoree:mscoree test fails without a display or console

WineHQ Bugzilla wine-bugs at winehq.org
Fri May 20 15:00:00 CDT 2022


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

--- Comment #39 from Esme Povirk <madewokherd at gmail.com> ---
(In reply to Esme Povirk from comment #30)
> So I need
> a way I can invoke mcs.exe that won't create a new console window regardless
> of how csc.exe was started, and also not lose mcs.exe's output in the
> process.

In case anyone in a similar situation finds this bug and, the answer appears to
be:

Check whether the process has a console attached (GetConsoleCP will return
non-zero if it does).
If no: Use the CREATE_NO_WINDOW flag with CreateProcess and
STARTF_USESTDHANDLES in STARTUPINFO. Set hStd* in STARTUPINFO to the
corresponding handle from GetStdHandle.
If yes: Call CreateProcess without DETACHED_PROCESS, CREATE_NEW_CONSOLE,
CREATE_NO_WINDOW, or STARTF_USESTDHANDLES.

This *might* work with DETACHED_PROCESS instead of CREATE_NO_WINDOW, since in
this case mcs.exe doesn't have to create any child processes. If there's a
possibility of further descendant console processes, and the immediate child
window doesn't call CreateProcess in the same way, those further descendants
would create a new console window when DETACHED_PROCESS is used.

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