[ros-diffs] [fireball] 33869: - 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".

fireball at svn.reactos.org fireball at svn.reactos.org
Fri Jun 6 23:40:37 CEST 2008


Author: fireball
Date: Fri Jun  6 16:40:37 2008
New Revision: 33869

URL: http://svn.reactos.org/svn/reactos?rev=33869&view=rev
Log:
- 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".

Modified:
    trunk/reactos/ntoskrnl/config/cmsysini.c
    trunk/reactos/ntoskrnl/config/ntapi.c
    trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c

Modified: trunk/reactos/ntoskrnl/config/cmsysini.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cmsysini.c?rev=33869&r1=33868&r2=33869&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/config/cmsysini.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/config/cmsysini.c [iso-8859-1] Fri Jun  6 16:40:37 2008
@@ -860,7 +860,7 @@
     }
 
     /* Create '\Registry' key. */
-    RtlInitUnicodeString(&KeyName, L"\\Registry");
+    RtlInitUnicodeString(&KeyName, L"\\REGISTRY");
     SecurityDescriptor = CmpHiveRootSecurityDescriptor();
     InitializeObjectAttributes(&ObjectAttributes,
                                &KeyName,
@@ -885,7 +885,7 @@
     if (!KeyCell) return FALSE;
 
     /* Create the KCB */
-    RtlInitUnicodeString(&KeyName, L"Registry");
+    RtlInitUnicodeString(&KeyName, L"\\REGISTRY");
     Kcb = CmpCreateKeyControlBlock(&CmiVolatileHive->Hive,
                                    RootIndex,
                                    KeyCell,

Modified: trunk/reactos/ntoskrnl/config/ntapi.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/ntapi.c?rev=33869&r1=33868&r2=33869&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/config/ntapi.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/config/ntapi.c [iso-8859-1] Fri Jun  6 16:40:37 2008
@@ -27,18 +27,55 @@
             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,9 +99,32 @@
 {
     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,

Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c?rev=33869&r1=33868&r2=33869&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c [iso-8859-1] Fri Jun  6 16:40:37 2008
@@ -3217,7 +3217,7 @@
    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 @@
       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 @@
 
    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 @@
          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);



More information about the Ros-diffs mailing list