Alexandre Julliard : kernel32: Moved initialisation of the console handles to DllMain.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Jul 13 10:12:24 CDT 2006


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Thu Jul 13 14:04:40 2006 +0200

kernel32: Moved initialisation of the console handles to DllMain.

---

 dlls/kernel/kernel_main.c |   22 +++++++++++++++++++++-
 dlls/kernel/process.c     |   19 -------------------
 2 files changed, 21 insertions(+), 20 deletions(-)

diff --git a/dlls/kernel/kernel_main.c b/dlls/kernel/kernel_main.c
index dea83b2..f6eeba9 100644
--- a/dlls/kernel/kernel_main.c
+++ b/dlls/kernel/kernel_main.c
@@ -97,6 +97,7 @@ static void thread_detach(void)
 static BOOL process_attach(void)
 {
     SYSTEM_INFO si;
+    RTL_USER_PROCESS_PARAMETERS *params = NtCurrentTeb()->Peb->ProcessParameters;
 
     /* FIXME: should probably be done in ntdll */
     GetSystemInfo( &si );
@@ -108,6 +109,25 @@ static BOOL process_attach(void)
     /* Setup computer name */
     COMPUTERNAME_Init();
 
+    /* convert value from server:
+     * + 0 => INVALID_HANDLE_VALUE
+     * + console handle needs to be mapped
+     */
+    if (!params->hStdInput)
+        params->hStdInput = INVALID_HANDLE_VALUE;
+    else if (VerifyConsoleIoHandle(console_handle_map(params->hStdInput)))
+        params->hStdInput = console_handle_map(params->hStdInput);
+
+    if (!params->hStdOutput)
+        params->hStdOutput = INVALID_HANDLE_VALUE;
+    else if (VerifyConsoleIoHandle(console_handle_map(params->hStdOutput)))
+        params->hStdOutput = console_handle_map(params->hStdOutput);
+
+    if (!params->hStdError)
+        params->hStdError = INVALID_HANDLE_VALUE;
+    else if (VerifyConsoleIoHandle(console_handle_map(params->hStdError)))
+        params->hStdError = console_handle_map(params->hStdError);
+
     /* copy process information from ntdll */
     ENV_CopyStartupInformation();
 
@@ -127,7 +147,7 @@ #endif
     /* finish the process initialisation for console bits, if needed */
     __wine_set_signal_handler(SIGINT, CONSOLE_HandleCtrlC);
 
-    if (NtCurrentTeb()->Peb->ProcessParameters->ConsoleHandle == (HANDLE)1)  /* FIXME */
+    if (params->ConsoleHandle == (HANDLE)1)  /* FIXME */
     {
         HMODULE mod = GetModuleHandleA(0);
         if (RtlImageNtHeader(mod)->OptionalHeader.Subsystem == IMAGE_SUBSYSTEM_WINDOWS_CUI)
diff --git a/dlls/kernel/process.c b/dlls/kernel/process.c
index 4a9d01e..389899c 100644
--- a/dlls/kernel/process.c
+++ b/dlls/kernel/process.c
@@ -743,25 +743,6 @@ static BOOL process_init(void)
     init_windows_dirs();
     init_current_directory( &params->CurrentDirectory );
 
-    /* convert value from server:
-     * + 0 => INVALID_HANDLE_VALUE
-     * + console handle needs to be mapped
-     */
-    if (!params->hStdInput)
-        params->hStdInput = INVALID_HANDLE_VALUE;
-    else if (VerifyConsoleIoHandle(console_handle_map(params->hStdInput)))
-        params->hStdInput = console_handle_map(params->hStdInput);
-
-    if (!params->hStdOutput)
-        params->hStdOutput = INVALID_HANDLE_VALUE;
-    else if (VerifyConsoleIoHandle(console_handle_map(params->hStdOutput)))
-        params->hStdOutput = console_handle_map(params->hStdOutput);
-
-    if (!params->hStdError)
-        params->hStdError = INVALID_HANDLE_VALUE;
-    else if (VerifyConsoleIoHandle(console_handle_map(params->hStdError)))
-        params->hStdError = console_handle_map(params->hStdError);
-
     return TRUE;
 }
 




More information about the wine-cvs mailing list