Commit 4b63e888 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

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: 's avatarEric Pouech <epouech@codeweavers.com>
parent 1f478ea3
...@@ -1396,6 +1396,9 @@ static void get_initial_console( RTL_USER_PROCESS_PARAMETERS *params ) ...@@ -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, &params->hStdOutput ); wine_server_fd_to_handle( 1, GENERIC_WRITE|SYNCHRONIZE, OBJ_INHERIT, &params->hStdOutput );
wine_server_fd_to_handle( 2, GENERIC_WRITE|SYNCHRONIZE, OBJ_INHERIT, &params->hStdError ); wine_server_fd_to_handle( 2, GENERIC_WRITE|SYNCHRONIZE, OBJ_INHERIT, &params->hStdError );
if (main_image_info.SubSystemType != IMAGE_SUBSYSTEM_WINDOWS_CUI)
return;
/* mark tty handles for kernelbase, see init_console */ /* mark tty handles for kernelbase, see init_console */
if (params->hStdInput && isatty(0)) if (params->hStdInput && isatty(0))
{ {
...@@ -1414,7 +1417,7 @@ static void get_initial_console( RTL_USER_PROCESS_PARAMETERS *params ) ...@@ -1414,7 +1417,7 @@ static void get_initial_console( RTL_USER_PROCESS_PARAMETERS *params )
params->hStdOutput = (HANDLE)((UINT_PTR)params->hStdOutput | 1); params->hStdOutput = (HANDLE)((UINT_PTR)params->hStdOutput | 1);
output_fd = 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; params->ConsoleHandle = CONSOLE_HANDLE_SHELL_NO_WINDOW;
if (output_fd != -1) if (output_fd != -1)
......
...@@ -401,6 +401,7 @@ static struct ...@@ -401,6 +401,7 @@ static struct
WCHAR *title; WCHAR *title;
DWORD creation_flags; DWORD creation_flags;
USHORT machine; USHORT machine;
BOOL cp_inherit;
} opts; } opts;
static void parse_command_line( int argc, WCHAR *argv[] ) static void parse_command_line( int argc, WCHAR *argv[] )
...@@ -416,6 +417,7 @@ 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 */ /* 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.sei.fMask = SEE_MASK_FLAG_DDEWAIT | SEE_MASK_FLAG_NO_UI;
opts.creation_flags = CREATE_NEW_CONSOLE; opts.creation_flags = CREATE_NEW_CONSOLE;
opts.cp_inherit = FALSE;
/* Canonical Microsoft commandline flag processing: /* Canonical Microsoft commandline flag processing:
* flags start with / and are case insensitive. * flags start with / and are case insensitive.
...@@ -490,6 +492,7 @@ static void parse_command_line( int argc, WCHAR *argv[] ) ...@@ -490,6 +492,7 @@ static void parse_command_line( int argc, WCHAR *argv[] )
else if (is_option(argv[i], L"/exec")) { else if (is_option(argv[i], L"/exec")) {
opts.creation_flags = 0; opts.creation_flags = 0;
opts.sei.fMask = SEE_MASK_NOCLOSEPROCESS | SEE_MASK_NO_CONSOLE | SEE_MASK_FLAG_NO_UI; opts.sei.fMask = SEE_MASK_NOCLOSEPROCESS | SEE_MASK_NO_CONSOLE | SEE_MASK_FLAG_NO_UI;
opts.cp_inherit = TRUE;
i++; i++;
break; break;
} }
...@@ -581,7 +584,7 @@ int __cdecl wmain (int argc, WCHAR *argv[]) ...@@ -581,7 +584,7 @@ int __cdecl wmain (int argc, WCHAR *argv[])
si.StartupInfo.dwFlags |= STARTF_USESHOWWINDOW; si.StartupInfo.dwFlags |= STARTF_USESHOWWINDOW;
si.StartupInfo.lpTitle = opts.title; 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, opts.creation_flags, NULL, opts.sei.lpDirectory,
&si.StartupInfo, &process_information )) &si.StartupInfo, &process_information ))
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment