console handles are inheritable

Eric Pouech pouech-eric at wanadoo.fr
Thu Sep 18 14:22:48 CDT 2003


A+
-- 
Eric Pouech
-------------- next part --------------
Name:          coninh
ChangeLog:     by default, console handles are inheritable
License:       X11
GenDate:       2003/09/18 19:21:33 UTC
ModifiedFiles: dlls/kernel/console.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/dlls/kernel/console.c,v
retrieving revision 1.20
diff -u -u -r1.20 console.c
--- dlls/kernel/console.c	5 Sep 2003 23:08:37 -0000	1.20
+++ dlls/kernel/console.c	11 Sep 2003 18:58:17 -0000
@@ -950,6 +950,7 @@
     STARTUPINFOA        siCurrent;
     STARTUPINFOA	siConsole;
     char                buffer[1024];
+    SECURITY_ATTRIBUTES sa;
 
     TRACE("()\n");
 
@@ -982,18 +983,23 @@
     /* FIXME (should pass the unicode form) */
     if (siCurrent.lpTitle)
         siConsole.lpTitle = siCurrent.lpTitle;
     else if (GetModuleFileNameA(0, buffer, sizeof(buffer)))
         siConsole.lpTitle = buffer;
 
     if (!start_console_renderer(&siConsole))
 	goto the_end;
 
+    /* all std I/O handles are inheritable by default */
+    sa.nLength = sizeof(sa);
+    sa.lpSecurityDescriptor = NULL;
+    sa.bInheritHandle = TRUE;
+
     handle_in = CreateFileA( "CONIN$", GENERIC_READ|GENERIC_WRITE|SYNCHRONIZE,
-			     0, NULL, OPEN_EXISTING, 0, 0 );
+			     0, &sa, OPEN_EXISTING, 0, 0 );
     if (handle_in == INVALID_HANDLE_VALUE) goto the_end;
 
     handle_out = CreateFileA( "CONOUT$", GENERIC_READ|GENERIC_WRITE,
-			     0, NULL, OPEN_EXISTING, 0, 0 );
+			     0, &sa, OPEN_EXISTING, 0, 0 );
     if (handle_out == INVALID_HANDLE_VALUE) goto the_end;
 
     if (!DuplicateHandle(GetCurrentProcess(), handle_out, GetCurrentProcess(), &handle_err,


More information about the wine-patches mailing list