* 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.
This commit is contained in:
@@ -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;
|
||||
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 }
|
||||
};
|
||||
status = RtlQueryRegistryValues (RTL_REGISTRY_CONTROL,
|
||||
L"Session Manager\\kernel",
|
||||
tab, NULL, NULL);
|
||||
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
|
||||
|
Reference in New Issue
Block a user