diff --git a/dlls/kernelbase/console.c b/dlls/kernelbase/console.c index 046eee6147c..1a8d1e822b8 100644 --- a/dlls/kernelbase/console.c +++ b/dlls/kernelbase/console.c @@ -2303,5 +2303,6 @@ void init_console( void ) if (RtlImageNtHeader( mod )->OptionalHeader.Subsystem == IMAGE_SUBSYSTEM_WINDOWS_CUI) alloc_console( no_window ); } - else if (params->ConsoleHandle) create_console_connection( params->ConsoleHandle ); + else if (params->ConsoleHandle && params->ConsoleHandle != CONSOLE_HANDLE_SHELL_NO_WINDOW) + create_console_connection( params->ConsoleHandle ); } diff --git a/dlls/ntdll/unix/env.c b/dlls/ntdll/unix/env.c index 64117e70abe..2ead6c1fcc3 100644 --- a/dlls/ntdll/unix/env.c +++ b/dlls/ntdll/unix/env.c @@ -1684,6 +1684,8 @@ 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) + params->ConsoleHandle = CONSOLE_HANDLE_SHELL_NO_WINDOW; if (output_fd != -1) { diff --git a/include/wine/condrv.h b/include/wine/condrv.h index 452ce552da1..94afb1d49c4 100644 --- a/include/wine/condrv.h +++ b/include/wine/condrv.h @@ -191,5 +191,6 @@ struct condrv_ctrl_event #define CONSOLE_HANDLE_ALLOC UlongToHandle(1) #define CONSOLE_HANDLE_ALLOC_NO_WINDOW UlongToHandle(2) #define CONSOLE_HANDLE_SHELL UlongToHandle(3) +#define CONSOLE_HANDLE_SHELL_NO_WINDOW UlongToHandle(5) #endif /* _INC_CONDRV */