From bdad3bfa9719b996c9bc4ca596991a9fbf405fce Mon Sep 17 00:00:00 2001 From: gigaherz Date: Sat, 17 Oct 2009 16:19:13 +0000 Subject: [PATCH] It seems trying to second-guess win32api plays against you, so it's best to assume it worked when the functions say it did. (Fixes the stdout redirection for me.) git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2020 96395faa-99c1-11dd-bbfe-3dabce05a288 --- pcsx2/windows/WinConsolePipe.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/pcsx2/windows/WinConsolePipe.cpp b/pcsx2/windows/WinConsolePipe.cpp index c9e0df2412..537fedaa9e 100644 --- a/pcsx2/windows/WinConsolePipe.cpp +++ b/pcsx2/windows/WinConsolePipe.cpp @@ -208,14 +208,9 @@ WinPipeRedirection::WinPipeRedirection( FILE* stdstream ) : throw Exception::Win32Error( "SetStdHandle failed." ); // In some cases GetStdHandle can fail, even when the one we just assigned above is valid. - HANDLE newhandle = GetStdHandle(stdhandle); - if( newhandle == INVALID_HANDLE_VALUE ) - throw Exception::Win32Error( "GetStdHandle failed." ); + // Regardless, it seems to work right so if SetStdHandle was successful, assume it worked. - if( newhandle == NULL ) - throw Exception::RuntimeError( "GetStdHandle returned NULL." ); // not a Win32error (no error code) - - m_crtFile = _open_osfhandle( (intptr_t)newhandle, _O_TEXT ); + m_crtFile = _open_osfhandle( (intptr_t)m_writepipe, _O_TEXT ); if( m_crtFile == -1 ) throw Exception::RuntimeError( "_open_osfhandle returned -1." );