Alexandre Julliard : kernel: Use a magic ConsoleHandle value instead of create flag to pass

Alexandre Julliard julliard at wine.codeweavers.com
Sun Feb 5 06:52:44 CST 2006


Module: wine
Branch: refs/heads/master
Commit: 626669e1e3838b6ac40d22b0d61a73d5d953199e
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=626669e1e3838b6ac40d22b0d61a73d5d953199e

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Sun Feb  5 12:24:43 2006 +0100

kernel: Use a magic ConsoleHandle value instead of create flag to pass
the CREATE_NEW_CONSOLE flag to the child.

---

 dlls/kernel/kernel_main.c |   16 ++++++----------
 dlls/kernel/process.c     |    1 +
 2 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/dlls/kernel/kernel_main.c b/dlls/kernel/kernel_main.c
index f5bf27c..a78439e 100644
--- a/dlls/kernel/kernel_main.c
+++ b/dlls/kernel/kernel_main.c
@@ -50,8 +50,6 @@
 
 extern  int __wine_set_signal_handler(unsigned, int (*)(unsigned));
 
-extern int main_create_flags;
-
 static CRITICAL_SECTION ldt_section;
 static CRITICAL_SECTION_DEBUG critsect_debug =
 {
@@ -142,19 +140,17 @@ static BOOL process_attach(void)
     /* finish the process initialisation for console bits, if needed */
     __wine_set_signal_handler(SIGINT, CONSOLE_HandleCtrlC);
 
-    if (main_create_flags & CREATE_NEW_CONSOLE)
+    if (NtCurrentTeb()->Peb->ProcessParameters->ConsoleHandle == (HANDLE)1)  /* FIXME */
     {
         HMODULE mod = GetModuleHandleA(0);
         if (RtlImageNtHeader(mod)->OptionalHeader.Subsystem == IMAGE_SUBSYSTEM_WINDOWS_CUI)
             AllocConsole();
     }
-    else if (!(main_create_flags & DETACHED_PROCESS))
-    {
-        /* 1/ shall inherit console + handles
-         * 2/ shall create std handles, if handles are not inherited
-         * TBD when not using wineserver handles for console handles
-         */
-    }
+    /* else TODO for DETACHED_PROCESS:
+     * 1/ inherit console + handles
+     * 2/ create std handles, if handles are not inherited
+     * TBD when not using wineserver handles for console handles
+     */
 
     /* Create 16-bit task */
     LoadLibrary16( "krnl386.exe" );
diff --git a/dlls/kernel/process.c b/dlls/kernel/process.c
index 1aa29a4..491ee6c 100644
--- a/dlls/kernel/process.c
+++ b/dlls/kernel/process.c
@@ -1426,6 +1426,7 @@ static RTL_USER_PROCESS_PARAMETERS *crea
     }
 
     if (flags & CREATE_NEW_PROCESS_GROUP) params->ConsoleFlags = 1;
+    if (flags & CREATE_NEW_CONSOLE) params->ConsoleHandle = (HANDLE)1;  /* FIXME: cf. kernel_main.c */
 
     params->hStdInput       = startup->hStdInput;
     params->hStdOutput      = startup->hStdOutput;




More information about the wine-cvs mailing list