From 4df100cda6cb751073a44167d5f3d7d39323c9ef Mon Sep 17 00:00:00 2001 From: Eric Pouech Date: Fri, 19 Sep 2003 00:05:18 +0000 Subject: [PATCH] By default, console handles are inheritable. --- dlls/kernel/console.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/dlls/kernel/console.c b/dlls/kernel/console.c index ef5d799377e..fa7286d94ff 100644 --- a/dlls/kernel/console.c +++ b/dlls/kernel/console.c @@ -950,6 +950,7 @@ BOOL WINAPI AllocConsole(void) STARTUPINFOA siCurrent; STARTUPINFOA siConsole; char buffer[1024]; + SECURITY_ATTRIBUTES sa; TRACE("()\n"); @@ -988,12 +989,17 @@ BOOL WINAPI AllocConsole(void) if (!start_console_renderer(&siConsole)) goto the_end; + /* all std I/O handles are inheritable by default */ + sa.nLength = sizeof(sa); + sa.lpSecurityDescriptor = NULL; + sa.bInheritHandle = TRUE; + handle_in = CreateFileA( "CONIN$", GENERIC_READ|GENERIC_WRITE|SYNCHRONIZE, - 0, NULL, OPEN_EXISTING, 0, 0 ); + 0, &sa, OPEN_EXISTING, 0, 0 ); if (handle_in == INVALID_HANDLE_VALUE) goto the_end; handle_out = CreateFileA( "CONOUT$", GENERIC_READ|GENERIC_WRITE, - 0, NULL, OPEN_EXISTING, 0, 0 ); + 0, &sa, OPEN_EXISTING, 0, 0 ); if (handle_out == INVALID_HANDLE_VALUE) goto the_end; if (!DuplicateHandle(GetCurrentProcess(), handle_out, GetCurrentProcess(), &handle_err, -- 2.11.4.GIT