This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: shared_info::init_obcaseinsensitive implemented incorrectly


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.lowe@gmail.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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]