- Change the registry name from Registry to REGISTRY, which fixes almost all Wine registry tests and any other application using the registry in case-sensitive mode, because the real name is REGISTRY.

- Add SEH to NtCreate/OpenKey, which fixes the rest of the wine registry tests.
- Fix PnP Manager code that was doing case sensitive registry access with "Registry".

svn path=/trunk/; revision=33869
This commit is contained in:
Aleksey Bragin 2008-06-06 21:40:37 +00:00
parent d409591250
commit edc9924731
3 changed files with 71 additions and 11 deletions

View file

@ -860,7 +860,7 @@ CmpCreateRegistryRoot(VOID)
}
/* Create '\Registry' key. */
RtlInitUnicodeString(&KeyName, L"\\Registry");
RtlInitUnicodeString(&KeyName, L"\\REGISTRY");
SecurityDescriptor = CmpHiveRootSecurityDescriptor();
InitializeObjectAttributes(&ObjectAttributes,
&KeyName,
@ -885,7 +885,7 @@ CmpCreateRegistryRoot(VOID)
if (!KeyCell) return FALSE;
/* Create the KCB */
RtlInitUnicodeString(&KeyName, L"Registry");
RtlInitUnicodeString(&KeyName, L"\\REGISTRY");
Kcb = CmpCreateKeyControlBlock(&CmiVolatileHive->Hive,
RootIndex,
KeyCell,

View file

@ -27,18 +27,55 @@ NtCreateKey(OUT PHANDLE KeyHandle,
IN ULONG CreateOptions,
OUT PULONG Disposition)
{
NTSTATUS Status;
NTSTATUS Status = STATUS_SUCCESS;
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
CM_PARSE_CONTEXT ParseContext = {0};
HANDLE Handle;
PAGED_CODE();
DPRINT("NtCreateKey(OB 0x%wZ)\n", ObjectAttributes->ObjectName);
/* Prepare to probe parameters */
_SEH_TRY
{
/* Check for user-mode caller */
if (PreviousMode == UserMode)
{
/* Check if we have a class */
if (Class)
{
/* Probe it */
ProbeForReadUnicodeString(Class);
ProbeForRead(ParseContext.Class.Buffer,
ParseContext.Class.Length,
sizeof(WCHAR));
ParseContext.Class = *Class;
}
/* Probe the key handle */
ProbeForWriteHandle(KeyHandle);
*KeyHandle = NULL;
/* Probe object attributes */
ProbeForRead(ObjectAttributes, sizeof(OBJECT_ATTRIBUTES), 4);
}
else
{
/* Save the class directly */
if (Class) ParseContext.Class = *Class;
}
}
_SEH_HANDLE
{
/* Get the status */
Status = _SEH_GetExceptionCode();
}
_SEH_END;
if (!NT_SUCCESS(Status)) return Status;
/* Setup the parse context */
ParseContext.CreateOperation = TRUE;
ParseContext.CreateOptions = CreateOptions;
if (Class) ParseContext.Class = *Class;
/* Do the create */
Status = ObOpenObjectByName(ObjectAttributes,
CmpKeyObjectType,
@ -62,10 +99,33 @@ NtOpenKey(OUT PHANDLE KeyHandle,
{
CM_PARSE_CONTEXT ParseContext = {0};
HANDLE Handle;
NTSTATUS Status;
NTSTATUS Status = STATUS_SUCCESS;
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
PAGED_CODE();
DPRINT("NtOpenKey(OB 0x%wZ)\n", ObjectAttributes->ObjectName);
/* Prepare to probe parameters */
_SEH_TRY
{
/* Check for user-mode caller */
if (PreviousMode == UserMode)
{
/* Probe the key handle */
ProbeForWriteHandle(KeyHandle);
*KeyHandle = NULL;
/* Probe object attributes */
ProbeForRead(ObjectAttributes, sizeof(OBJECT_ATTRIBUTES), 4);
}
}
_SEH_HANDLE
{
/* Get the status */
Status = _SEH_GetExceptionCode();
}
_SEH_END;
if (!NT_SUCCESS(Status)) return Status;
/* Just let the object manager handle this */
Status = ObOpenObjectByName(ObjectAttributes,
CmpKeyObjectType,

View file

@ -3217,7 +3217,7 @@ IopUpdateRootKey(VOID)
HANDLE hEnum, hRoot, hHalAcpiDevice, hHalAcpiId, hLogConf;
NTSTATUS Status;
InitializeObjectAttributes(&ObjectAttributes, &EnumU, OBJ_KERNEL_HANDLE, NULL, NULL);
InitializeObjectAttributes(&ObjectAttributes, &EnumU, OBJ_KERNEL_HANDLE | OBJ_CASE_INSENSITIVE, NULL, NULL);
Status = ZwCreateKey(&hEnum, KEY_CREATE_SUB_KEY, &ObjectAttributes, 0, NULL, 0, NULL);
if (!NT_SUCCESS(Status))
{
@ -3225,7 +3225,7 @@ IopUpdateRootKey(VOID)
return Status;
}
InitializeObjectAttributes(&ObjectAttributes, &RootPathU, OBJ_KERNEL_HANDLE, hEnum, NULL);
InitializeObjectAttributes(&ObjectAttributes, &RootPathU, OBJ_KERNEL_HANDLE | OBJ_CASE_INSENSITIVE, hEnum, NULL);
Status = ZwCreateKey(&hRoot, KEY_CREATE_SUB_KEY, &ObjectAttributes, 0, NULL, 0, NULL);
ZwClose(hEnum);
if (!NT_SUCCESS(Status))
@ -3236,12 +3236,12 @@ IopUpdateRootKey(VOID)
if (IopIsAcpiComputer())
{
InitializeObjectAttributes(&ObjectAttributes, &HalAcpiDevice, OBJ_KERNEL_HANDLE, hRoot, NULL);
InitializeObjectAttributes(&ObjectAttributes, &HalAcpiDevice, OBJ_KERNEL_HANDLE | OBJ_CASE_INSENSITIVE, hRoot, NULL);
Status = ZwCreateKey(&hHalAcpiDevice, KEY_CREATE_SUB_KEY, &ObjectAttributes, 0, NULL, REG_OPTION_VOLATILE, NULL);
ZwClose(hRoot);
if (!NT_SUCCESS(Status))
return Status;
InitializeObjectAttributes(&ObjectAttributes, &HalAcpiId, OBJ_KERNEL_HANDLE, hHalAcpiDevice, NULL);
InitializeObjectAttributes(&ObjectAttributes, &HalAcpiId, OBJ_KERNEL_HANDLE | OBJ_CASE_INSENSITIVE, hHalAcpiDevice, NULL);
Status = ZwCreateKey(&hHalAcpiId, KEY_CREATE_SUB_KEY, &ObjectAttributes, 0, NULL, REG_OPTION_VOLATILE, NULL);
ZwClose(hHalAcpiDevice);
if (!NT_SUCCESS(Status))
@ -3251,7 +3251,7 @@ IopUpdateRootKey(VOID)
Status = ZwSetValueKey(hHalAcpiId, &HardwareIDU, 0, REG_MULTI_SZ, HalAcpiHardwareID.Buffer, HalAcpiHardwareID.MaximumLength);
if (NT_SUCCESS(Status))
{
InitializeObjectAttributes(&ObjectAttributes, &LogConfU, OBJ_KERNEL_HANDLE, hHalAcpiId, NULL);
InitializeObjectAttributes(&ObjectAttributes, &LogConfU, OBJ_KERNEL_HANDLE | OBJ_CASE_INSENSITIVE, hHalAcpiId, NULL);
Status = ZwCreateKey(&hLogConf, 0, &ObjectAttributes, 0, NULL, REG_OPTION_VOLATILE, NULL);
if (NT_SUCCESS(Status))
ZwClose(hLogConf);