Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Date: Wed, 13 Oct 2004 10:31:04 -0400
From: Christopher Faylor <cgf-no-personal-reply-please@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: Bash: when is WinXP not WinXP??
Message-ID: <20041013143104.GC9039@trixie.casa.cgf.cx>
Reply-To: cygwin@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
References: <Xns9580B6A784B22dancarddupercom@80.91.229.5> <NUTMEGiHQNEOafeJOu700000422@NUTMEG.CAM.ARTIMI.COM>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <NUTMEGiHQNEOafeJOu700000422@NUTMEG.CAM.ARTIMI.COM>
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:
>
>------------------------------<fairuse>------------------------------
>The GetConsoleScreenBufferInfo function retrieves information about the
>specified console screen buffer. 
>------------------------------<fairuse>------------------------------
>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/

