From 0fe3a6fdffb63465771b4176fc80811d4fd87f67 Mon Sep 17 00:00:00 2001 From: Stefan Ginsberg Date: Sun, 21 Dec 2008 08:30:41 +0000 Subject: [PATCH] - _popen/_wpopen: When overriding the default standard input/output handles, don't set 2/3 to 0 -- use the standard handles instead (fix by kjk). Fixes the 'CsrGetObject returning invalid handle' errors svn path=/trunk/; revision=38228 --- reactos/lib/sdk/crt/stdio/popen.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/reactos/lib/sdk/crt/stdio/popen.c b/reactos/lib/sdk/crt/stdio/popen.c index 199c3d9cb72..a9624796add 100644 --- a/reactos/lib/sdk/crt/stdio/popen.c +++ b/reactos/lib/sdk/crt/stdio/popen.c @@ -77,14 +77,19 @@ FILE *_tpopen (const _TCHAR *cm, const _TCHAR *md) /* program name, pipe mode */ StartupInfo.cb = sizeof(STARTUPINFO); if (*md == 'r' ) { + StartupInfo.hStdInput = GetStdHandle(STD_INPUT_HANDLE); StartupInfo.hStdOutput = hWritePipe; StartupInfo.dwFlags |= STARTF_USESTDHANDLES; } else if ( *md == 'w' ) { StartupInfo.hStdInput = hReadPipe; + StartupInfo.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE); StartupInfo.dwFlags |= STARTF_USESTDHANDLES; } + if (StartupInfo.dwFlags & STARTF_USESTDHANDLES) + StartupInfo.hStdError = GetStdHandle(STD_ERROR_HANDLE); + result = CreateProcess(szComSpec, szCmdLine, NULL,