Create new console only if the process is a console application.
diff --git a/scheduler/process.c b/scheduler/process.c
index d2b369c..11e95e4 100644
--- a/scheduler/process.c
+++ b/scheduler/process.c
@@ -112,6 +112,7 @@
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 @@
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 @@
{
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 @@
/* 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 @@
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 @@
ret = MAIN_MainInit();
- if (create_flags & CREATE_NEW_CONSOLE)
- AllocConsole();
return ret;
}
@@ -358,7 +356,11 @@
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 )