delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2013/07/26/12:56:11

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:message-id:date:from:mime-version:to:subject
:references:in-reply-to:content-type; q=dns; s=default; b=YpEDn8
fnghXy9mJtoQUnzlkDK7shKVG+2lEcWL7QQPI58+wLmbXCNw1yGeHFUTDwx7rzPN
MXkiKFvpL3h+s14NpK2+JiSeNxp7DFbwKvzE0AiRkbyBDrdHeCBPn68z12P321W4
rUD88zztBJlbp6NuDEB1JOH1qsK4my5Hdik1s=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:message-id:date:from:mime-version:to:subject
:references:in-reply-to:content-type; s=default; bh=UWwSNDbEt0KH
SF/un20CcD5fDpM=; b=GMrMkILNSox6F5EFz86sJwa6ikmApX3yqToXmLY1eDzX
01iOycUFV1obddua1str/wnci36qgCalUJHPKwKWicDbh5I7V+Hk2224hhmATbiF
f3wgTkxBzEsVd5eA4iLMtgeDZRqHsF7y1+CpL7lyRz5mMoy4ctPCW6NWakjT0dY=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.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
X-Spam-SWARE-Status: No, score=-5.7 required=5.0 tests=AWL,BAYES_50,KHOP_PGP_SIGNED,KHOP_THREADED,RDNS_NONE,SPF_HELO_PASS,SPF_PASS,TW_RX autolearn=no version=3.3.1
Message-ID: <51F2AA0C.4040903@dancol.org>
Date: Fri, 26 Jul 2013 09:55:40 -0700
From: Daniel Colascione <dancol AT dancol DOT org>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130620 Thunderbird/17.0.7
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: ptys - I give up
References: <20130726061334 DOT GA3780 AT ednor DOT casa DOT cgf DOT cx> <51F21AD0 DOT 5090107 AT dancol DOT org> <20130726152702 DOT GC4495 AT ednor DOT casa DOT cgf DOT cx> <51F2A21F DOT 60302 AT dancol DOT org> <20130726163508 DOT GA25789 AT calimero DOT vinschen DOT de>
In-Reply-To: <20130726163508.GA25789@calimero.vinschen.de>
X-Virus-Found: No

------enig2MWXTSFNBULXNRQOSBNTR
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On 7/26/2013 9:35 AM, Corinna Vinschen wrote:
> On Jul 26 09:21, Daniel Colascione wrote:
>> On 7/26/2013 8:27 AM, Christopher Faylor wrote:
>>> On Thu, Jul 25, 2013 at 11:44:32PM -0700, Daniel Colascione wrote:
>>>
>>>> Ugly, only half-implemented, but better: a hook-based pseudoconsole
>>>> system for Windows.
>>>
>>> This is what I was holding out for.  The last time it came up here,
>>> people seemed vehemently opposed to the idea since implementations that
>>> do this (like the Console app and a couple of libraries floating around)
>>> seem to have to poll the console looking for data and that could result
>>> in data loss.
>>>
>>> I have had code (not mine) sitting in my Cygwin directory for years
>>> which does this but I couldn't 100% convince myself that the detractors
>>> for this idea weren't right.  Does your code work around this?
>>
>> I'm also against screen scrapers. That's why I wrote this library: it do=
esn't
>> poll. It actually intercepts console APIs and implements console handles=
 as
>> pseudohandles, just like Windows <=3D 7 did, forwarding console API requ=
ests to a
>> server. Any console program that works with Windows 7 should work with t=
his
>> library.
>=20
> Out of curiosity, can you expand what you mean here?  I see a difference
> between Windows pre-7 and Windows 7 and later.=20

Conhost exists to solve the problem Raymond Chen described here:
http://blogs.msdn.com/b/oldnewthing/archive/2007/12/31/6909007.aspx. Conhost
exists so there's something running with lower privileges that can draw con=
sole
UI --- it's a broker. The actual console-ing still happens entirely in user=
 mode
though, with the functions in kernel32 conspiring to provide the illusion t=
hat
the system has something called a console handle.

In Windows 8, the implementation is completely different. There, console ha=
ndles
are real kernel objects.

Anyway, that pre-8 Windows used pseudo-handles for console handles is a good
thing now. It means that any library that tries to intercept all console
functions doesn't need to emulate all possible operations on console handle=
s:
instead, it just needs to emulate the operations Windows actually allowed on
console handles, which was actually a fairly limited subset of what's allow=
ed
for handles in general.

Another way of saying it is that it's easy to fake console handles because
Windows, too, was faking all along.

> Before Windows 7, the
> consoles seemed to be handled entirely by the csrss process.  If you
> started bash directly, there was no other visible process involved.
> Starting with Windows 7 there's  suddenly a "conhost" process for each
> console.

Sure --- just like you might have an rxvt for each login shell. Now imagine=
 if
an X server happened to provide an rxvt implementation in-process and that =
the
pty interface were entirely private to X and implemented by sending special=
 WM
hints to X. That's the Windows pre-7 architecture.

> Just as a side note, Windows 7's new conhost also broke the method to
> start an invisible console by creating it in a new, invisible WindowStati=
on,
> and that still hasn't been fixed in Windows 8, despite my bug report
> during the W7 beta...

I have no idea.


------enig2MWXTSFNBULXNRQOSBNTR
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.13 (Cygwin)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlHyqg4ACgkQ17c2LVA10VvxygCgqt49O8IFknUbsj0iue5wbHyB
7skAni9otf1nf8ZNo7UKMObNd0sAEomg
=oID8
-----END PGP SIGNATURE-----

------enig2MWXTSFNBULXNRQOSBNTR--

- Raw text -


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