- _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
This commit is contained in:
Stefan Ginsberg 2008-12-21 08:30:41 +00:00
parent 9ebb5e3555
commit 0fe3a6fdff

View file

@ -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,