diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2012-02-21 17:03:51 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2012-02-21 17:03:51 +0000 |
commit | 801bf9f27287a43eb9aaafe0c0f2dfac08455532 (patch) | |
tree | 61cf87ba153a11338363e10ce7eac9f3eaf8373e /winsup/cygwin/shared.cc | |
parent | db05364aa905eedd40dce5c326421a5d3275be6b (diff) | |
download | cygnal-801bf9f27287a43eb9aaafe0c0f2dfac08455532.tar.gz cygnal-801bf9f27287a43eb9aaafe0c0f2dfac08455532.tar.bz2 cygnal-801bf9f27287a43eb9aaafe0c0f2dfac08455532.zip |
* shared.cc (shared_info::init_obcaseinsensitive): Check actual state
of case sensitivity on post-Windows 2000 systems.
* wincap.h (wincaps::kernel_is_always_casesensitive): New element.
* wincap.cc: Implement above element throughout.
Diffstat (limited to 'winsup/cygwin/shared.cc')
-rw-r--r-- | winsup/cygwin/shared.cc | 49 |
1 files changed, 35 insertions, 14 deletions
diff --git a/winsup/cygwin/shared.cc b/winsup/cygwin/shared.cc index 86f93c269..7a0b2510b 100644 --- a/winsup/cygwin/shared.cc +++ b/winsup/cygwin/shared.cc @@ -286,23 +286,44 @@ shared_destroy () UnmapViewOfFile (user_shared); } -/* Initialize obcaseinsensitive. Default to case insensitive on pre-XP. */ +/* Initialize obcaseinsensitive.*/ void shared_info::init_obcaseinsensitive () { - NTSTATUS status; - DWORD def_obcaseinsensitive = 1; - - obcaseinsensitive = def_obcaseinsensitive; - RTL_QUERY_REGISTRY_TABLE tab[2] = { - { NULL, RTL_QUERY_REGISTRY_DIRECT | RTL_QUERY_REGISTRY_NOSTRING, - L"obcaseinsensitive", &obcaseinsensitive, REG_DWORD, - &def_obcaseinsensitive, sizeof (DWORD) }, - { NULL, 0, NULL, NULL, 0, NULL, 0 } - }; - status = RtlQueryRegistryValues (RTL_REGISTRY_CONTROL, - L"Session Manager\\kernel", - tab, NULL, NULL); + if (wincap.kernel_is_always_casesensitive ()) + { + /* Only Windows 2000. Default to case insensitive unless the user + sets the obcaseinsensitive registry value explicitely to 0. */ + DWORD def_obcaseinsensitive = 1; + + obcaseinsensitive = def_obcaseinsensitive; + RTL_QUERY_REGISTRY_TABLE tab[2] = { + { NULL, RTL_QUERY_REGISTRY_DIRECT | RTL_QUERY_REGISTRY_NOSTRING, + L"obcaseinsensitive", &obcaseinsensitive, REG_DWORD, + &def_obcaseinsensitive, sizeof (DWORD) }, + { NULL, 0, NULL, NULL, 0, NULL, 0 } + }; + RtlQueryRegistryValues (RTL_REGISTRY_CONTROL, + L"Session Manager\\kernel", + tab, NULL, NULL); + } + else + { + /* Instead of reading the obcaseinsensitive registry value, test the + actual state of case sensitivity handling in the kernel. */ + UNICODE_STRING sysroot; + OBJECT_ATTRIBUTES attr; + HANDLE h; + + RtlInitUnicodeString (&sysroot, L"\\SYSTEMROOT"); + InitializeObjectAttributes (&attr, &sysroot, 0, NULL, NULL); + /* NtOpenSymbolicLinkObject returns STATUS_ACCESS_DENIED when called + with a 0 access mask. However, if the kernel is case sensitive, + it returns STATUS_OBJECT_NAME_NOT_FOUND because we used the incorrect + case for the filename (It's actually "\\SystemRoot"). */ + obcaseinsensitive = NtOpenSymbolicLinkObject (&h, 0, &attr) + != STATUS_OBJECT_NAME_NOT_FOUND; + } } void inline |