Use the second bit of ConsoleFlags to pass this flag to the child.
Signed-off-by: Torge Matthies openglfreak@googlemail.com --- dlls/kernel32/tests/console.c | 4 ++-- dlls/kernelbase/console.c | 3 +++ dlls/kernelbase/process.c | 11 +++++++---- 3 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/dlls/kernel32/tests/console.c b/dlls/kernel32/tests/console.c index 8a995ca36db..0de96f416bf 100644 --- a/dlls/kernel32/tests/console.c +++ b/dlls/kernel32/tests/console.c @@ -4750,7 +4750,7 @@ static void test_CreateProcessCUI(void) res = check_same_console(cuiexec, DETACHED_PROCESS); ok(!res, "Expected child to be attached to a different console\n"); res = check_same_console(cuiexec, CREATE_NO_WINDOW); - todo_wine ok(!res, "Expected child to be attached to a different console\n"); + ok(!res, "Expected child to be attached to a different console\n"); res = check_same_console(cuiexec, CREATE_NO_WINDOW|DETACHED_PROCESS); ok(!res, "Expected child to be attached to a different console\n"); res = check_same_console(cuiexec, CREATE_NO_WINDOW|CREATE_NEW_CONSOLE); @@ -4761,7 +4761,7 @@ static void test_CreateProcessCUI(void) res = check_has_window(cuiexec, DETACHED_PROCESS); ok(!res, "Expected child to not have a console window\n"); res = check_has_window(cuiexec, CREATE_NO_WINDOW); - todo_wine ok(!res, "Expected child to not have a console window\n"); + ok(!res, "Expected child to not have a console window\n"); res = check_has_window(cuiexec, CREATE_NO_WINDOW|DETACHED_PROCESS); ok(!res, "Expected child to not have a console window\n"); res = check_has_window(cuiexec, CREATE_NO_WINDOW|CREATE_NEW_CONSOLE); diff --git a/dlls/kernelbase/console.c b/dlls/kernelbase/console.c index b2bb6c53fd9..aa6a7681800 100644 --- a/dlls/kernelbase/console.c +++ b/dlls/kernelbase/console.c @@ -419,6 +419,8 @@ BOOL WINAPI AllocConsole(void)
swprintf( conhost_path, ARRAY_SIZE(conhost_path), L"%s\conhost.exe", system_dir ); swprintf( cmd, ARRAY_SIZE(cmd), L""%s" --server 0x%x", conhost_path, condrv_handle( server )); + if (NtCurrentTeb()->Peb->ProcessParameters->ConsoleFlags & 2) + wcsncat( cmd, L" --no-window", ARRAY_SIZE(cmd) ); Wow64DisableWow64FsRedirection( &redir ); ret = CreateProcessW( conhost_path, cmd, NULL, NULL, TRUE, DETACHED_PROCESS, NULL, NULL, &console_si, &pi ); Wow64RevertWow64FsRedirection( redir ); @@ -2293,6 +2295,7 @@ void init_console( void ) params->ConsoleHandle = NULL; if (RtlImageNtHeader( mod )->OptionalHeader.Subsystem == IMAGE_SUBSYSTEM_WINDOWS_CUI) AllocConsole(); + params->ConsoleFlags &= ~2; } else if (params->ConsoleHandle) create_console_connection( params->ConsoleHandle ); } diff --git a/dlls/kernelbase/process.c b/dlls/kernelbase/process.c index 1cecbce9321..c219f3d149c 100644 --- a/dlls/kernelbase/process.c +++ b/dlls/kernelbase/process.c @@ -148,6 +148,7 @@ static RTL_USER_PROCESS_PARAMETERS *create_process_params( const WCHAR *filename UNICODE_STRING imageW, curdirW, cmdlineW, titleW, desktopW, runtimeW, newdirW; WCHAR imagepath[MAX_PATH]; WCHAR *envW = env; + BOOL no_window = (flags & CREATE_NO_WINDOW) && !(flags & (DETACHED_PROCESS|CREATE_NEW_CONSOLE));
if (!GetLongPathNameW( filename, imagepath, MAX_PATH )) lstrcpynW( imagepath, filename, MAX_PATH ); if (!GetFullPathNameW( imagepath, MAX_PATH, imagepath, NULL )) lstrcpynW( imagepath, filename, MAX_PATH ); @@ -189,8 +190,10 @@ static RTL_USER_PROCESS_PARAMETERS *create_process_params( const WCHAR *filename } RtlFreeUnicodeString( &newdirW );
- if (flags & CREATE_NEW_PROCESS_GROUP) params->ConsoleFlags = 1; - if (flags & CREATE_NEW_CONSOLE) params->ConsoleHandle = CONSOLE_HANDLE_ALLOC; + params->ConsoleFlags = 0; + if (flags & CREATE_NEW_PROCESS_GROUP) params->ConsoleFlags |= 1; + if (no_window) params->ConsoleFlags |= 2; + if ((flags & CREATE_NEW_CONSOLE) || no_window) params->ConsoleHandle = CONSOLE_HANDLE_ALLOC; else if (!(flags & DETACHED_PROCESS)) { params->ConsoleHandle = NtCurrentTeb()->Peb->ProcessParameters->ConsoleHandle; @@ -532,8 +535,8 @@ BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessInternalW( HANDLE token, const WCHAR /* Warn if unsupported features are used */
if (flags & (IDLE_PRIORITY_CLASS | HIGH_PRIORITY_CLASS | REALTIME_PRIORITY_CLASS | - CREATE_DEFAULT_ERROR_MODE | CREATE_NO_WINDOW | - PROFILE_USER | PROFILE_KERNEL | PROFILE_SERVER)) + CREATE_DEFAULT_ERROR_MODE | PROFILE_USER | PROFILE_KERNEL | + PROFILE_SERVER)) WARN( "(%s,...): ignoring some flags in %lx\n", debugstr_w(app_name), flags );
if (cur_dir)