delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2013/07/26/13:24:36

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=Egsi6S
dEMGqs/M+vctogCNCP58PSi85TE0tYasGS1xZuYCgpCfmAnYkC+lhLg/BpkhZW90
Vrxa2zaQDtF+kDBUQfpR06graPTXCf52/rh8gk6d830nx8PFI0hqxTlTQ8Bsla7T
vJ2gWfmAgOfBWiEc+H+z5fnFc7rH2Jz+K0TDY=
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=h5PY0PaeY0Yl
eeyPwv+iS8SGlTQ=; b=VXcHq3ppYcVSCIiVWZ0MexervYsjwTglANRNFFc/JUiK
EHI66K+7sPTNU54ASWTcQQNMw9xlPO9i3hodXaiyec2kx+cYQTTn0GPgYri0L8os
H0jKFqsVNxfsK4jglOVts0D8ICYpyYcAyswJNTJq3I00XeG6UO4KtnvhYtZ+ATU=
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=-7.0 required=5.0 tests=AWL,BAYES_00,KHOP_PGP_SIGNED,KHOP_THREADED,RDNS_NONE,SPF_HELO_PASS,SPF_PASS autolearn=no version=3.3.1
Message-ID: <51F2B0B9.9000807@dancol.org>
Date: Fri, 26 Jul 2013 10:24:09 -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> <51F2AA0C DOT 4040903 AT dancol DOT org> <20130726171017 DOT GV5086 AT calimero DOT vinschen DOT de>
In-Reply-To: <20130726171017.GV5086@calimero.vinschen.de>
X-Virus-Found: No

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

On 7/26/2013 10:10 AM, Corinna Vinschen wrote:
> On Jul 26 09:55, Daniel Colascione wrote:
>> 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 th=
at
>>>>> do this (like the Console app and a couple of libraries floating arou=
nd)
>>>>> seem to have to poll the console looking for data and that could resu=
lt
>>>>> 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 detracto=
rs
>>>>> 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 =
doesn't
>>>> poll. It actually intercepts console APIs and implements console handl=
es as
>>>> pseudohandles, just like Windows <=3D 7 did, forwarding console API re=
quests to a
>>>> server. Any console program that works with Windows 7 should work with=
 this
>>>> library.
>>>
>>> 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. Con=
host
>> exists so there's something running with lower privileges that can draw =
console
>> UI --- it's a broker. The actual console-ing still happens entirely in u=
ser mode
>> though, with the functions in kernel32 conspiring to provide the illusio=
n that
>> the system has something called a console handle.
>>
>> In Windows 8, the implementation is completely different. There, console=
 handles
>> are real kernel objects.
>=20
> Really?  That's entirely new to me.  Do you know if there's some descript=
ion
> available?  What are the implications?  Are console handles now handles to
> something like named pipes as well?  Is there a console FS comparable to
> \Device\NamedPipe\?

I don't know the details, and I'm not aware of any new facilities exposed to
applications. I'd have loved a pseudoconsole API, but we didn't get one.

You can see the difference in a debugger, though: console pseudohandles *lo=
ok*
strange and don't show up in the process handle table. The difference shoul=
dn't
really matter, though: applications shouldn't really care what kind of hand=
les
they get as long as system APIs accept them. The problem with writes larger=
 than
8k (I think that was the limit?) to console handles failing seems to have
disappeared, though.

>> 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 han=
dles:
>> instead, it just needs to emulate the operations Windows actually allowe=
d on
>> console handles, which was actually a fairly limited subset of what's al=
lowed
>> for handles in general.
>>
>> Another way of saying it is that it's easy to fake console handles becau=
se
>> Windows, too, was faking all along.
>=20
> But then again, doesn't that mean that your method stops working on W8?

Not really --- it'll work fine. The difference means that operations on con=
sole
handles that used not to work on Windows 7 might work on Windows 8. The pub=
lic
API contract hasn't changed, however, so applications aren't supposed to be
doing these things anyway, and as long as application developers care about
testing their applications on Windows 7, they won't.

If you eventually do start seeing applications that do things with console
handles that can't be done with console pseudohandles, well, you can hook m=
ore
APIs to preserve the console handle illusion. But that time is a long way a=
way,
if it ever arrives at all.


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

iEYEARECAAYFAlHysLsACgkQ17c2LVA10Vt+DwCffmPH5WaJoeYQ0+3ptBy3xQv6
cLEAniyFMyjMMGepRJToBS76Usf8lr/9
=tJi6
-----END PGP SIGNATURE-----

------enig2ILQVWVTATQWDVJLDRPWN--

- Raw text -


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