Eric Pouech : server: Use negative values for console pseudo handles.

Alexandre Julliard julliard at winehq.org
Tue Apr 12 15:35:17 CDT 2022


Module: wine
Branch: master
Commit: 95202ea4da95f724a6d98320cacd04b41b4f234e
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=95202ea4da95f724a6d98320cacd04b41b4f234e

Author: Eric Pouech <eric.pouech at gmail.com>
Date:   Mon Apr 11 15:05:03 2022 +0200

server: Use negative values for console pseudo handles.

Signed-off-by: Eric Pouech <eric.pouech at gmail.com>
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 include/wine/condrv.h | 6 +++---
 server/process.c      | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/include/wine/condrv.h b/include/wine/condrv.h
index 452ce552da1..2d763d0b821 100644
--- a/include/wine/condrv.h
+++ b/include/wine/condrv.h
@@ -188,8 +188,8 @@ struct condrv_ctrl_event
 };
 
 /* Wine specific values for console inheritance (params->ConsoleHandle) */
-#define CONSOLE_HANDLE_ALLOC            UlongToHandle(1)
-#define CONSOLE_HANDLE_ALLOC_NO_WINDOW  UlongToHandle(2)
-#define CONSOLE_HANDLE_SHELL            UlongToHandle(3)
+#define CONSOLE_HANDLE_ALLOC            LongToHandle(-1)
+#define CONSOLE_HANDLE_ALLOC_NO_WINDOW  LongToHandle(-2)
+#define CONSOLE_HANDLE_SHELL            LongToHandle(-3)
 
 #endif /* _INC_CONDRV */
diff --git a/server/process.c b/server/process.c
index 65e2aa70de2..d1407204718 100644
--- a/server/process.c
+++ b/server/process.c
@@ -1333,8 +1333,8 @@ DECL_HANDLER(new_process)
     /* connect to the window station */
     connect_process_winstation( process, parent_thread, parent );
 
-    /* set the process console */
-    if (info->data->console > 3)
+    /* inherit the process console, but keep pseudo handles (< 0), and 0 (= not attached to a console) as is */
+    if ((int)info->data->console > 0)
         info->data->console = duplicate_handle( parent, info->data->console, process,
                                                 0, 0, DUPLICATE_SAME_ACCESS );
 




More information about the wine-cvs mailing list