delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2012/02/21/06:34:49

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=0.2 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW
X-Spam-Check-By: sourceware.org
Received-SPF: pass (google.com: domain of nick DOT lowe AT gmail DOT com designates 10.52.180.74 as permitted sender) client-ip=10.52.180.74;
Authentication-Results: mr.google.com; spf=pass (google.com: domain of nick DOT lowe AT gmail DOT com designates 10.52.180.74 as permitted sender) smtp.mail=nick DOT lowe AT gmail DOT com; dkim=pass header.i=nick DOT lowe AT gmail DOT com
MIME-Version: 1.0
In-Reply-To: <CADSoG1sCUeC=6UCmTmb56pWFoDM0mR9+RT0ozGNRtiaMPsbBCA@mail.gmail.com>
References: <CADSoG1so=3KxR5TS6mVNRhZGkdUku42Y=S3eWV0dtDgiZE8Tww AT mail DOT gmail DOT com> <CADSoG1uVEpxOSxAm2ZtbzE9oh95TcAQYkj_YRAZxP0tL8-3uDQ AT mail DOT gmail DOT com> <CADSoG1v5skh+gsKmBfVSbykA+AXHJjJEs+oTWsjSav04BvUNzg AT mail DOT gmail DOT com> <CADSoG1uBYBYYW6K+XS-N3ouQN3-x7dYWzR5vQ16DaR2WShd45Q AT mail DOT gmail DOT com> <CADSoG1sCUeC=6UCmTmb56pWFoDM0mR9+RT0ozGNRtiaMPsbBCA AT mail DOT gmail DOT com>
Date: Tue, 21 Feb 2012 11:34:28 +0000
Message-ID: <CADSoG1vOz3agNFs2dG_u4D-Kw4PBv+YHdJUE_ziSUOCaqdo35g@mail.gmail.com>
Subject: Re: shared_info::init_obcaseinsensitive implemented incorrectly
From: Nick Lowe <nick DOT lowe AT gmail DOT com>
To: cygwin AT cygwin DOT com
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

I really should subscribe to get individual messages and not just the
digest so that I can reply properly. Sorry!

> Just call NtOpenDirectoryObject on \\SYSTEMROOT, rather than NtOpenSymbolicLinkObject.

I would have thought that NtOpenSymbolicLinkObject would have been the
more correct approach as the object expected is a symbolic link. No?

>That's not an off-chance.  It works for all admin accounts.

Hmm, strange. Unless the query (0x1) symbolic link specific access
right is specified, I always get STATUS_ACCESS_DENIED. With it
specified, it succeeds as an administrator or fails otherwise.
(I have only tested this under 64-bit Windows 7.)

Regards,

Nick

On Tue, Feb 21, 2012 at 10:26 AM, Nick Lowe <nick DOT lowe AT gmail DOT com> wrote:
> I have just tested this and it works. It is faster, simpler and has
> less overheads than querying the registry for a potentially stale
> value.
>
> Just call NtOpenSymbolicLinkObject for \SYSTEMROOT with a
> DesiredAccess of 0 and no attributes flags in the OBJECT_ATTRIBUTES
> structure.
>
> This will fail with STATUS_ACCESS_DENIED if the system is running with
> case insensitivity and STATUS_OBJECT_NAME_NOT_FOUND if running with
> case sensitivity.
>
> For correctness, on the off chance that a successful NTSTATUS value is
> returned, the system is running with case insensitivity and the handle
> must be closed.
>
> Regards,
>
> Nick
>
> On Tue, Feb 21, 2012 at 9:52 AM, Nick Lowe <nick DOT lowe AT gmail DOT com> wrote:
>> OK, fair enough, it is an edge case... I am a stickler for correctness! :P
>>
>> Looking at previous threads though actually, I notice that the
>> following is documented by Microsoft regarding the obcaseinsensitive
>> value:
>>
>> "If this setting is enabled, case insensitivity is enforced for all
>> directory objects, symbolic links, and IO objects, including file
>> objects. Disabling this setting does not allow the Win32 subsystem to
>> become case sensitive."
>>
>> You could just get away with therefore, in theory, a call to
>> NtOpenSymbolicLinkObject for \SYSTEMROOT. If it fails because it
>> cannot be found, you know that the system is running with case
>> sensitivity, otherwise, it is case sensitive.
>>
>> Regards,
>>
>> Nick

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