Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Date: Wed, 13 Oct 2004 10:31:04 -0400 From: Christopher Faylor To: cygwin AT cygwin DOT com Subject: Re: Bash: when is WinXP not WinXP?? Message-ID: <20041013143104.GC9039@trixie.casa.cgf.cx> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.1i On Wed, Oct 13, 2004 at 10:49:55AM +0100, Dave Korn wrote: >> -----Original Message----- >> From: cygwin-owner On Behalf Of Daniel Miller >> Sent: 13 October 2004 01:57 > >> hStdOut = GetStdHandle(STD_OUTPUT_HANDLE); ^^^^^^^^^^^^^^^^^ >> PERR(hStdOut != INVALID_HANDLE_VALUE, "GetStdHandle"); >> bSuccess = GetConsoleScreenBufferInfo(hStdOut, &sinfo) ; >> if (bSuccess == false) { >> // this returned "The handle is invalid" >> fprintf(stderr, "gcsbi error: %s\n", get_system_message()) ; >> exit(1) ; >> redirected = 1 ; >> return ; >> } > > Hmm. That's the first time I've heard of GetConsoleScreenBufferInfo. >Let's see what MSDN says about it: > >------------------------------------------------------------ >The GetConsoleScreenBufferInfo function retrieves information about the >specified console screen buffer. >------------------------------------------------------------ >Parameters >hConsoleOutput >[in] Handle to a console screen buffer. The handle must have GENERIC_READ ^^^^^^^^^^^^ >access. >lpConsoleScreenBufferInfo >Right. So I would suggest that all you can reasonably infer from >bSuccess being false is that the function failed. You are going one >step beyond that in deducing that if the function fails, the handle >must not be a console screen buffer handle. There are of course other >reasons why the function might fail. You should have called >GetLastError, then you'd have more information about what was going on. Bingo. Like, maybe the STD_OUTPUT_HANDLE doesn't have GENERIC_READ access? cgf -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/