delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/07/03/09:44:55

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS
X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
In-Reply-To: <20090703104423.GA18746@calimero.vinschen.de>
References: <20090626121215 DOT GJ30864 AT calimero DOT vinschen DOT de> <20090626133618 DOT GA14187 AT calimero DOT vinschen DOT de> <af075b00906260708h674121f3s63fdc79af5675a44 AT mail DOT gmail DOT com> <20090626145213 DOT GK30864 AT calimero DOT vinschen DOT de> <416096c60906270139y33e2888cq148430eebb744b71 AT mail DOT gmail DOT com> <20090628103010 DOT GT30864 AT calimero DOT vinschen DOT de> <af075b00907020941i666bed61vc450315c662b757a AT mail DOT gmail DOT com> <20090702174425 DOT GC9839 AT ednor DOT casa DOT cgf DOT cx> <af075b00907030218p54b606ds813e824422de04fa AT mail DOT gmail DOT com> <20090703104423 DOT GA18746 AT calimero DOT vinschen DOT de>
From: Julio Costa <costaju AT gmail DOT com>
Date: Fri, 3 Jul 2009 14:44:13 +0100
Message-ID: <af075b00907030644k385e0d92t4c6a3d0f1a9ea90a@mail.gmail.com>
Subject: Re: popup consoles on Windows 7
To: cygwin AT cygwin DOT com
X-IsSubscribed: yes
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 Fri, Jul 3, 2009 at 11:44, Corinna Vinschen wrote:
> On Jul =C2=A03 10:18, Julio Costa wrote:
>> Let me rephrase that in three questions:
>> "What happens if we launch commands without a console created?"
>
> That's actually the same question as the next one, isn't it?
>

It is now, that I seen the answer to the next one :)

>> "What are the type of programs that really need that console?"
>
> Cygwin processes don't worry about the console. =C2=A0They use what they
> get as file descriptors and live with that.
>
> Native processes exist in two variations. =C2=A0Some of them just use
> the stdio handles like Cygwin processes. =C2=A0Some of them require to
> be run in a console becasue they use Console I/O functions directly.

Ahhh! That's the core problem... I didn't realize that there could be
applications wanting to do that... Duh!

> These applications will fail miserably in a Cygwin environment not
> attached to a console. =C2=A0Unfortunately there are quite a lot of them
> used for Windows system administration.

Rats!

>
> At least that's as far as I rememeber this whole issue. =C2=A0I may have
> forgotten some aspect, but I'm fairly sure that we can drop the
> hidden console business as far as only Cygwin processes are affected.
>
>> "Is it possible to identify them prior to launch them?"
>
> Cygwin checks for a Cygwin application prior to execv it.
> Not a Cygwin application =3D=3D may need a console.
>
> I have some testing code which only tries to create an invisible console
> if the application to execv is not a Cygwin application. =C2=A0It seems to
> work nicely. =C2=A0I'm just not sure if it's really *that* simple...
>

Thanks for the clarification!

Besides that, is it possible to distinguish if, being *not* a Cygwin
application, it would *need* direct console IO?
If I understand it correctly, knowing if an application is for
subsystem windows or console does *not* give us a foolproof answer to
if it would need the direct console IO.
That's bad. This identification could be very handy to only try
"risky" and "costly" things only when really needed...

As for the action itself, to hide the console, I've been looking in
the MS documentation and I saw some potential insteresting info about
the STARTUPINFO passed to the CreateProcess:
1) Use STARTF_USEPOSITION, with dwX =3D dwY =3D 0x8000 (similar to the
registry hack?);
2) OR, use STARTF_USESHOWWINDOW, with wShowWindow =3D SW_HIDE;
3) OR (far fetched) use lpDesktop with something 'WinStaHIDE\Default'

I've not tested it (I've no access to a proper build system to do
this, neither to a Win7).
Probable drawbacks:
1) I'm guessing that NO window will show after even the created by
child processess...
Is it possible to change the dwFlags field on the child process, after
it starts? That would solve it;
2) ditto;
3) It force us to do a SetProcessWindowStation and SetThreadDesktop to
something that must be stored and passed to the child, after the
AllocConsole is done ; AND, there is also the probability of Win7 just
plain ignores the lpDesktop setting.

Well, this is all I can see for now. Hope it helps somehow.

--=20
___________
Julio Costa

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


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