Create new console only if the process is a console application.

This commit is contained in:
Dmitry Timoshkov 2002-04-09 01:38:41 +00:00 committed by Alexandre Julliard
parent 5474aa941b
commit 1c2fa97e1b
1 changed files with 10 additions and 8 deletions

View File

@ -112,6 +112,7 @@ static WCHAR **app_wargv;
static char main_exe_name[MAX_PATH];
static char *main_exe_name_ptr = main_exe_name;
static HANDLE main_exe_file;
static int main_create_flags;
unsigned int server_startticks;
@ -243,7 +244,6 @@ void PROCESS_CallUserSignalProc( UINT uCode, HMODULE16 hModule )
static BOOL process_init( char *argv[] )
{
BOOL ret;
int create_flags = 0;
size_t info_size = 0;
handle_t info = 0;
@ -272,8 +272,8 @@ static BOOL process_init( char *argv[] )
{
size_t len = wine_server_reply_size( reply );
main_exe_name[len] = 0;
main_exe_file = reply->exe_file;
create_flags = reply->create_flags;
main_exe_file = reply->exe_file;
main_create_flags = reply->create_flags;
info_size = reply->info_size;
info = reply->info;
server_startticks = reply->server_start;
@ -288,7 +288,7 @@ static BOOL process_init( char *argv[] )
/* Create the process heap */
current_process.heap = HeapCreate( HEAP_GROWABLE, 0, 0 );
if (create_flags == 0 &&
if (main_create_flags == 0 &&
current_startupinfo.hStdInput == 0 &&
current_startupinfo.hStdOutput == 0 &&
current_startupinfo.hStdError == 0)
@ -300,7 +300,7 @@ static BOOL process_init( char *argv[] )
SetStdHandle( STD_OUTPUT_HANDLE, FILE_DupUnixHandle( 1, GENERIC_WRITE|SYNCHRONIZE, TRUE ));
SetStdHandle( STD_ERROR_HANDLE, FILE_DupUnixHandle( 1, GENERIC_WRITE|SYNCHRONIZE, TRUE ));
}
else if (!(create_flags & (DETACHED_PROCESS|CREATE_NEW_CONSOLE)))
else if (!(main_create_flags & (DETACHED_PROCESS|CREATE_NEW_CONSOLE)))
{
SetStdHandle( STD_INPUT_HANDLE, current_startupinfo.hStdInput );
SetStdHandle( STD_OUTPUT_HANDLE, current_startupinfo.hStdOutput );
@ -322,8 +322,6 @@ static BOOL process_init( char *argv[] )
ret = MAIN_MainInit();
if (create_flags & CREATE_NEW_CONSOLE)
AllocConsole();
return ret;
}
@ -358,7 +356,11 @@ static void start_process(void)
entry = (LPTHREAD_START_ROUTINE)((char*)current_process.module +
PE_HEADER(current_process.module)->OptionalHeader.AddressOfEntryPoint);
console_app = (PE_HEADER(current_process.module)->OptionalHeader.Subsystem == IMAGE_SUBSYSTEM_WINDOWS_CUI);
if (console_app) current_process.flags |= PDB32_CONSOLE_PROC;
if (console_app)
{
current_process.flags |= PDB32_CONSOLE_PROC;
if (main_create_flags & CREATE_NEW_CONSOLE) AllocConsole();
}
/* Signal the parent process to continue */
SERVER_START_REQ( init_process_done )