delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/10/13/10:50:03

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
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 <cgf-no-personal-reply-please AT cygwin DOT com>
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: <Xns9580B6A784B22dancarddupercom AT 80 DOT 91 DOT 229 DOT 5> <NUTMEGiHQNEOafeJOu700000422 AT NUTMEG DOT CAM DOT ARTIMI DOT COM>
Mime-Version: 1.0
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019