--- wine/server/process.c 2004-06-15 07:41:59.000000000 +0200 +++ mywine/server/process.c 2004-12-09 17:34:45.000000000 +0100 @@ -45,6 +45,8 @@ #include "request.h" #include "console.h" #include "user.h" +#include "winreg.h" +#include "winternl.h" /* process structure */ @@ -210,7 +212,12 @@ static int set_process_console( struct p if (process->create_flags & CREATE_NEW_CONSOLE) { /* let the process init do the allocation */ - return 1; + /* unless the startup info specifies to use */ + /* the io handles in the startup info */ + if( !info || !info->data || + !((((RTL_USER_PROCESS_PARAMETERS *)info->data)->dwFlags) & + STARTF_USESTDHANDLES)) + return 1; } else if (info && !(process->create_flags & DETACHED_PROCESS)) { --- wine/dlls/kernel/console.c 2004-09-15 09:51:46.000000000 +0200 +++ mywine/dlls/kernel/console.c 2004-12-07 21:30:26.000000000 +0100 @@ -1142,22 +1142,28 @@ 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, &sa, OPEN_EXISTING, 0, 0 ); - if (handle_in == INVALID_HANDLE_VALUE) goto the_end; - - handle_out = CreateFileA( "CONOUT$", GENERIC_READ|GENERIC_WRITE, - 0, &sa, OPEN_EXISTING, 0, 0 ); - if (handle_out == INVALID_HANDLE_VALUE) goto the_end; - - if (!DuplicateHandle(GetCurrentProcess(), handle_out, GetCurrentProcess(), &handle_err, - 0, TRUE, DUPLICATE_SAME_ACCESS)) - goto the_end; + if( !(siCurrent.dwFlags & STARTF_USESTDHANDLES) ) { + /* 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, &sa, OPEN_EXISTING, 0, 0 ); + if (handle_in == INVALID_HANDLE_VALUE) goto the_end; + + handle_out = CreateFileA( "CONOUT$", GENERIC_READ|GENERIC_WRITE, + 0, &sa, OPEN_EXISTING, 0, 0 ); + if (handle_out == INVALID_HANDLE_VALUE) goto the_end; + + if (!DuplicateHandle(GetCurrentProcess(), handle_out, GetCurrentProcess(), + &handle_err, 0, TRUE, DUPLICATE_SAME_ACCESS)) + goto the_end; + } else { + handle_in = siCurrent.hStdInput; + handle_out = siCurrent.hStdOutput; + handle_err = siCurrent.hStdError; + } /* NT resets the STD_*_HANDLEs on console alloc */ SetStdHandle(STD_INPUT_HANDLE, handle_in);