Moved initial AllocConsole call to kernel init (based on a patch by

Eric Pouech).
This commit is contained in:
Alexandre Julliard 2002-07-31 19:19:36 +00:00
parent 7fcae15632
commit 99d8b7f755
2 changed files with 14 additions and 7 deletions

View file

@ -27,6 +27,8 @@
#include <signal.h>
#include "winbase.h"
#include "wincon.h"
#include "ntddk.h"
#include "wine/winbase16.h"
#include "wine/library.h"
@ -42,6 +44,8 @@ extern BOOL RELAY_Init(void);
extern int __wine_set_signal_handler(unsigned, int (*)(unsigned));
extern int CONSOLE_HandleCtrlC(unsigned);
extern int main_create_flags;
/***********************************************************************
* KERNEL process initialisation routine
*/
@ -106,6 +110,13 @@ static BOOL process_attach(void)
/* finish the process initialisation, if needed */
__wine_set_signal_handler(SIGINT, CONSOLE_HandleCtrlC);
if (main_create_flags & CREATE_NEW_CONSOLE)
{
HMODULE mod = GetModuleHandleA(0);
if (RtlImageNtHeader(mod)->OptionalHeader.Subsystem == IMAGE_SUBSYSTEM_WINDOWS_CUI)
AllocConsole();
}
return TRUE;
}

View file

@ -115,10 +115,10 @@ PDB current_process;
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;
static unsigned int server_startticks;
int main_create_flags = 0;
/* memory/environ.c */
extern struct _ENVDB *ENV_InitStartupInfo( size_t info_size, char *main_exe_name,
size_t main_exe_size );
@ -469,11 +469,7 @@ 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 (main_create_flags & CREATE_NEW_CONSOLE) AllocConsole();
}
if (console_app) current_process.flags |= PDB32_CONSOLE_PROC;
/* Signal the parent process to continue */
SERVER_START_REQ( init_process_done )