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

By default, console handles are inheritable.

parent 52f692fb
...@@ -950,6 +950,7 @@ BOOL WINAPI AllocConsole(void) ...@@ -950,6 +950,7 @@ BOOL WINAPI AllocConsole(void)
STARTUPINFOA siCurrent; STARTUPINFOA siCurrent;
STARTUPINFOA siConsole; STARTUPINFOA siConsole;
char buffer[1024]; char buffer[1024];
SECURITY_ATTRIBUTES sa;
TRACE("()\n"); TRACE("()\n");
...@@ -988,12 +989,17 @@ BOOL WINAPI AllocConsole(void) ...@@ -988,12 +989,17 @@ BOOL WINAPI AllocConsole(void)
if (!start_console_renderer(&siConsole)) if (!start_console_renderer(&siConsole))
goto the_end; 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, 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; if (handle_in == INVALID_HANDLE_VALUE) goto the_end;
handle_out = CreateFileA( "CONOUT$", GENERIC_READ|GENERIC_WRITE, 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 (handle_out == INVALID_HANDLE_VALUE) goto the_end;
if (!DuplicateHandle(GetCurrentProcess(), handle_out, GetCurrentProcess(), &handle_err, if (!DuplicateHandle(GetCurrentProcess(), handle_out, GetCurrentProcess(), &handle_err,
......
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