--- wine/server/process.c 2004-06-15 07:41:59.000000000 +0200 +++ mywine/server/process.c 2004-12-12 09:38:10.000000000 +0100 @@ -45,6 +45,8 @@ #include "request.h" #include "console.h" #include "user.h" +#include "winreg.h" +#include "winternl.h" /* process structure */ @@ -207,12 +209,7 @@ static void set_process_startup_state( s static int set_process_console( struct process *process, struct thread *parent_thread, struct startup_info *info, struct init_process_reply *reply ) { - if (process->create_flags & CREATE_NEW_CONSOLE) - { - /* let the process init do the allocation */ - return 1; - } - else if (info && !(process->create_flags & DETACHED_PROCESS)) + if (info && !(process->create_flags & (DETACHED_PROCESS | CREATE_NEW_CONSOLE))) { /* FIXME: some better error checking should be done... * like if hConOut and hConIn are console handles, then they should be on the same @@ -222,7 +219,7 @@ static int set_process_console( struct p } if (info) { - if (!info->inherit_all) + if (!info->inherit_all && !(process->create_flags & CREATE_NEW_CONSOLE)) { reply->hstdin = duplicate_handle( parent_thread->process, info->hstdin, process, 0, TRUE, DUPLICATE_SAME_ACCESS ); --- wine/dlls/kernel/console.c 2004-09-15 09:51:46.000000000 +0200 +++ mywine/dlls/kernel/console.c 2004-12-10 16:57:06.000000000 +0100 @@ -1142,22 +1142,29 @@ 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; + FIXME("handles %p %p %p\n", handle_in, handle_out, handle_err); + } /* NT resets the STD_*_HANDLEs on console alloc */ SetStdHandle(STD_INPUT_HANDLE, handle_in);