delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/04/15/11:36:15

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Wed, 15 Apr 2009 17:35:49 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: popup consoles on Windows 7
Message-ID: <20090415153549.GA8722@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <416096c60904051420h66325080j3b059f3fbb857bde AT mail DOT gmail DOT com> <416096c60904150814y45976747qa7878d1ed256fc9 AT mail DOT gmail DOT com>
MIME-Version: 1.0
In-Reply-To: <416096c60904150814y45976747qa7878d1ed256fc9@mail.gmail.com>
User-Agent: Mutt/1.5.19 (2009-02-20)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
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

On Apr 15 16:14, Andy Koppe wrote:
> I think I found the reason why consoles pop up for mintty and XWin on
> Windows 7. Cygwin's fhandler_console.cc uses a clever trick where it
> allocates a console on an invisible custom "window station". I tried
> to do the same in the mintty child process, but found that
> AllocConsole() no longer cares whether a custom window station has
> been selected with SetProcessWindowStation(): the console window is
> opened on the default window station anyway.
> 
> Here's what I did, between forkpty() and exec():
> 
>     DWORD version = GetVersion();
>     version = ((version & 0xff) << 8) | ((version >> 8) & 0xff);
>     if (version >= 0x0601) {
>       HWINSTA wst0 = GetProcessWindowStation();
>       HWINSTA wst = CreateWindowStation (NULL, 1, WINSTA_ALL_ACCESS, &sa);
>       SetProcessWindowStation(wst);
>       AllocConsole();
>       SetProcessWindowStation(wst0);
>       CloseWindowStation(wst);
>     }
> 
> Debug output showed that the function calls all succeeded, and that
> CreateWindowStation() did create a station separate from the default
> one.
> 
> No idea what to do about it ...

Treat it as a bug in Windows 7, probably.  Do you get the console window
as soon as you call AllocConsole, or does it open later?  If so, it
could also be the Cygwin code which allocates another console for some
reason.

If the above code also allocs a console window when run from a non-cygwin
(mingw) application, then this should be reported as a bug to Microsoft.
As long as W7 is beta, there's a good chance it gets fixed before it
will be released.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

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