Module: wine Branch: master Commit: 4b63e888945b8ada2ddc043e435b9358a0be811c URL: https://gitlab.winehq.org/wine/wine/-/commit/4b63e888945b8ada2ddc043e435b935...
Author: Eric Pouech epouech@codeweavers.com Date: Fri Nov 17 11:54:18 2023 +0100
ntdll: Don't create Unix console for GUI apps.
Note: GUI apps using std I/O (this is not common) will no longer print on unix console. If such a behavior is needed, for an app started from Unix shell, one can either redirect output to a file, or pipe output: ./wine app | cat
Signed-off-by: Eric Pouech epouech@codeweavers.com
---
dlls/ntdll/unix/env.c | 5 ++++- programs/start/start.c | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/unix/env.c b/dlls/ntdll/unix/env.c index 14a321e34dd..ad9ab0dc220 100644 --- a/dlls/ntdll/unix/env.c +++ b/dlls/ntdll/unix/env.c @@ -1396,6 +1396,9 @@ static void get_initial_console( RTL_USER_PROCESS_PARAMETERS *params ) wine_server_fd_to_handle( 1, GENERIC_WRITE|SYNCHRONIZE, OBJ_INHERIT, ¶ms->hStdOutput ); wine_server_fd_to_handle( 2, GENERIC_WRITE|SYNCHRONIZE, OBJ_INHERIT, ¶ms->hStdError );
+ if (main_image_info.SubSystemType != IMAGE_SUBSYSTEM_WINDOWS_CUI) + return; + /* mark tty handles for kernelbase, see init_console */ if (params->hStdInput && isatty(0)) { @@ -1414,7 +1417,7 @@ static void get_initial_console( RTL_USER_PROCESS_PARAMETERS *params ) params->hStdOutput = (HANDLE)((UINT_PTR)params->hStdOutput | 1); output_fd = 1; } - if (!params->ConsoleHandle && main_image_info.SubSystemType == IMAGE_SUBSYSTEM_WINDOWS_CUI) + if (!params->ConsoleHandle) params->ConsoleHandle = CONSOLE_HANDLE_SHELL_NO_WINDOW;
if (output_fd != -1) diff --git a/programs/start/start.c b/programs/start/start.c index 59fd72e07a4..c2e5850c291 100644 --- a/programs/start/start.c +++ b/programs/start/start.c @@ -401,6 +401,7 @@ static struct WCHAR *title; DWORD creation_flags; USHORT machine; + BOOL cp_inherit; } opts;
static void parse_command_line( int argc, WCHAR *argv[] ) @@ -416,6 +417,7 @@ static void parse_command_line( int argc, WCHAR *argv[] ) /* Dunno what these mean, but it looks like winMe's start uses them */ opts.sei.fMask = SEE_MASK_FLAG_DDEWAIT | SEE_MASK_FLAG_NO_UI; opts.creation_flags = CREATE_NEW_CONSOLE; + opts.cp_inherit = FALSE;
/* Canonical Microsoft commandline flag processing: * flags start with / and are case insensitive. @@ -490,6 +492,7 @@ static void parse_command_line( int argc, WCHAR *argv[] ) else if (is_option(argv[i], L"/exec")) { opts.creation_flags = 0; opts.sei.fMask = SEE_MASK_NOCLOSEPROCESS | SEE_MASK_NO_CONSOLE | SEE_MASK_FLAG_NO_UI; + opts.cp_inherit = TRUE; i++; break; } @@ -581,7 +584,7 @@ int __cdecl wmain (int argc, WCHAR *argv[]) si.StartupInfo.dwFlags |= STARTF_USESHOWWINDOW; si.StartupInfo.lpTitle = opts.title;
- if (!CreateProcessW( opts.sei.lpFile, commandline, NULL, NULL, FALSE, + if (!CreateProcessW( opts.sei.lpFile, commandline, NULL, NULL, opts.cp_inherit, opts.creation_flags, NULL, opts.sei.lpDirectory, &si.StartupInfo, &process_information )) {