- Remove CmiAddKeyToList.
authorAleksey Bragin <aleksey@reactos.org>
Thu, 6 Dec 2007 18:31:37 +0000 (18:31 +0000)
committerAleksey Bragin <aleksey@reactos.org>
Thu, 6 Dec 2007 18:31:37 +0000 (18:31 +0000)
- Use ParseContext in CmpDoCreate, removing OriginatingHive parameter since ReactOS doesn't use this.
- Sending the create options as key node flags is wrong -- identify this in the code (fixing this however will break the boot -- need to investigate).

svn path=/trunk/; revision=31046

reactos/ntoskrnl/cm/ntfunc.c
reactos/ntoskrnl/cm/regobj.c
reactos/ntoskrnl/config/cm.h
reactos/ntoskrnl/config/cmparse.c
reactos/ntoskrnl/config/cmsysini.c

index b46d2f4..4b89579 100644 (file)
@@ -52,8 +52,14 @@ NtCreateKey(OUT PHANDLE KeyHandle,
     KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
     HANDLE hKey;
     PCM_KEY_NODE Node, ParentNode;
+    CM_PARSE_CONTEXT ParseContext = {0};
     PAGED_CODE();
 
+    /* Setup the parse context */
+    ParseContext.CreateOperation = TRUE;
+    ParseContext.CreateOptions = CreateOptions;
+    if (Class) ParseContext.Class = *Class;
+
     /* Capture all the info */
     Status = ObpCaptureObjectAttributes(ObjectAttributes,
                                         PreviousMode,
@@ -146,10 +152,8 @@ NtCreateKey(OUT PHANDLE KeyHandle,
                          NULL,
                          &RemainingPath,
                          KernelMode,
-                         Class,
-                         CreateOptions,
+                         &ParseContext,
                          Parent->KeyControlBlock,
-                         NULL,
                          (PVOID*)&KeyObject);
     if (!NT_SUCCESS(Status)) goto Cleanup;
 
@@ -175,7 +179,7 @@ NtCreateKey(OUT PHANDLE KeyHandle,
     KeyObject->KeyControlBlock->ValueCache.Count = Node->ValueList.Count;
 
     /* Link child to parent */
-    CmiAddKeyToList(Parent->KeyControlBlock, KeyObject);
+    InsertTailList(&Parent->KeyControlBlock->KeyBodyListHead, &KeyObject->KeyBodyEntry);
 
     /* Create the actual handle to the object */
     Status = CmpCreateHandle(KeyObject,
index d03c8c3..2353877 100644 (file)
@@ -720,7 +720,7 @@ CmpParseKey(IN PVOID ParsedObject,
         FoundObject->KeyControlBlock = Kcb;
         ASSERT(FoundObject->KeyControlBlock->KeyHive == ParsedKey->KeyControlBlock->KeyHive);
         RtlpCreateUnicodeString(&FoundObject->Name, KeyName.Buffer, NonPagedPool);
-        CmiAddKeyToList(ParsedKey->KeyControlBlock, FoundObject);
+        InsertTailList(&ParsedKey->KeyControlBlock->KeyBodyListHead, &FoundObject->KeyBodyEntry);
         DPRINT("Created object 0x%p\n", FoundObject);
     }
     else
@@ -903,13 +903,6 @@ CmpQueryKeyName(PVOID ObjectBody,
     return STATUS_SUCCESS;
 }
 
-VOID
-CmiAddKeyToList(PCM_KEY_CONTROL_BLOCK ParentKey,
-                PKEY_OBJECT NewKey)
-{
-    InsertTailList(&ParentKey->KeyBodyListHead, &NewKey->KeyBodyEntry);
-}
-
 static NTSTATUS
 CmiGetLinkTarget(PCMHIVE RegistryHive,
                  PCM_KEY_NODE KeyCell,
index 09f140a..edec7eb 100644 (file)
@@ -507,9 +507,6 @@ CmFindObject(POBJECT_CREATE_INFORMATION ObjectCreateInfo,
              IN PACCESS_STATE AccessState,
              IN PVOID ParseContext);
 NTSTATUS CmiCallRegisteredCallbacks(IN REG_NOTIFY_CLASS Argument1, IN PVOID Argument2);
-VOID
-CmiAddKeyToList(IN PCM_KEY_CONTROL_BLOCK ParentKey,
-                IN PKEY_OBJECT NewKey);
 ///////////////////////////////////////////////////////////////////////////////
 
 //
@@ -1029,10 +1026,8 @@ CmpDoCreate(
     IN PACCESS_STATE AccessState,
     IN PUNICODE_STRING Name,
     IN KPROCESSOR_MODE AccessMode,
-    IN PUNICODE_STRING Class,
-    IN ULONG CreateOptions,
+    IN PCM_PARSE_CONTEXT Context,
     IN PCM_KEY_CONTROL_BLOCK ParentKcb,
-    IN PCMHIVE OriginatingHive OPTIONAL,
     OUT PVOID *Object
 );
 
index 989ef79..eab9238 100644 (file)
@@ -82,9 +82,9 @@ CmpDoCreateChild(IN PHHIVE Hive,
                  IN PACCESS_STATE AccessState,\r
                  IN PUNICODE_STRING Name,\r
                  IN KPROCESSOR_MODE AccessMode,\r
-                 IN PUNICODE_STRING Class,\r
+                 IN PCM_PARSE_CONTEXT ParseContext,\r
                  IN PCM_KEY_CONTROL_BLOCK ParentKcb,\r
-                 IN ULONG CreateOptions,\r
+                 IN ULONG Flags,\r
                  OUT PHCELL_INDEX KeyCell,\r
                  OUT PVOID *Object)\r
 {\r
@@ -110,7 +110,7 @@ CmpDoCreateChild(IN PHHIVE Hive,
 \r
     /* Get the storage type */\r
     StorageType = Stable;\r
-    if (CreateOptions & REG_OPTION_VOLATILE) StorageType = Volatile;\r
+    if (Flags & REG_OPTION_VOLATILE) StorageType = Volatile;\r
 \r
     /* Allocate the child */\r
     *KeyCell = HvAllocateCell(Hive,\r
@@ -139,10 +139,13 @@ CmpDoCreateChild(IN PHHIVE Hive,
     HvReleaseCell(Hive, *KeyCell);\r
 \r
     /* Check if we have a class name */\r
-    if (Class->Length > 0)\r
+    if (ParseContext->Class.Length > 0)\r
     {\r
         /* Allocate a class cell */\r
-        ClassCell = HvAllocateCell(Hive, Class->Length, StorageType, HCELL_NIL);\r
+        ClassCell = HvAllocateCell(Hive,\r
+                                   ParseContext->Class.Length,\r
+                                   StorageType,\r
+                                   HCELL_NIL);\r
         if (ClassCell == HCELL_NIL)\r
         {\r
             /* Fail */\r
@@ -165,7 +168,7 @@ CmpDoCreateChild(IN PHHIVE Hive,
     KeyBody = (PKEY_OBJECT)(*Object);\r
 \r
     /* Check if we had a class */\r
-    if (Class->Length > 0)\r
+    if (ParseContext->Class.Length > 0)\r
     {\r
         /* Get the class cell */\r
         CellData = HvGetCell(Hive, ClassCell);\r
@@ -183,13 +186,13 @@ CmpDoCreateChild(IN PHHIVE Hive,
 \r
         /* Copy the class data */\r
         RtlCopyMemory(&CellData->u.KeyString[0],\r
-                      Class->Buffer,\r
-                      Class->Length);\r
+                      ParseContext->Class.Buffer,\r
+                      ParseContext->Class.Length);\r
     }\r
 \r
     /* Fill out the key node */\r
     KeyNode->Signature = CM_KEY_NODE_SIGNATURE;\r
-    KeyNode->Flags = CreateOptions;\r
+    KeyNode->Flags = Flags;\r
     KeQuerySystemTime(&SystemTime);\r
     KeyNode->LastWriteTime = SystemTime;\r
     KeyNode->Spare = 0;\r
@@ -202,7 +205,7 @@ CmpDoCreateChild(IN PHHIVE Hive,
     KeyNode->ValueList.List = HCELL_NIL;\r
     KeyNode->Security = HCELL_NIL;\r
     KeyNode->Class = ClassCell;\r
-    KeyNode->ClassLength = Class->Length;\r
+    KeyNode->ClassLength = ParseContext->Class.Length;\r
     KeyNode->MaxValueDataLen = 0;\r
     KeyNode->MaxNameLen = 0;\r
     KeyNode->MaxValueNameLen = 0;\r
@@ -236,7 +239,7 @@ Quickie:
     if (!NT_SUCCESS(Status))\r
     {\r
         /* Free any cells we might've allocated */\r
-        if (Class->Length > 0) HvFreeCell(Hive, ClassCell);\r
+        if (ParseContext->Class.Length > 0) HvFreeCell(Hive, ClassCell);\r
         HvFreeCell(Hive, *KeyCell);\r
     }\r
 \r
@@ -260,10 +263,8 @@ CmpDoCreate(IN PHHIVE Hive,
             IN PACCESS_STATE AccessState,\r
             IN PUNICODE_STRING Name,\r
             IN KPROCESSOR_MODE AccessMode,\r
-            IN PUNICODE_STRING Class OPTIONAL,\r
-            IN ULONG CreateOptions,\r
+            IN PCM_PARSE_CONTEXT ParseContext,\r
             IN PCM_KEY_CONTROL_BLOCK ParentKcb,\r
-            IN PCMHIVE OriginatingHive OPTIONAL,\r
             OUT PVOID *Object)\r
 {\r
     NTSTATUS Status;\r
@@ -274,8 +275,6 @@ CmpDoCreate(IN PHHIVE Hive,
     PSECURITY_DESCRIPTOR SecurityDescriptor = NULL;\r
     LARGE_INTEGER TimeStamp;\r
     PCM_KEY_NODE KeyNode;\r
-    UNICODE_STRING LocalClass = {0};\r
-    if (!Class) Class = &LocalClass;\r
 \r
     /* Sanity check */\r
 #if 0\r
@@ -319,7 +318,8 @@ CmpDoCreate(IN PHHIVE Hive,
 \r
     /* Get the parent type */\r
     ParentType = HvGetCellType(Cell);\r
-    if ((ParentType == Volatile) && !(CreateOptions & REG_OPTION_VOLATILE))\r
+    if ((ParentType == Volatile) &&\r
+        !(ParseContext->CreateOptions & REG_OPTION_VOLATILE))\r
     {\r
         /* Children of volatile parents must also be volatile */\r
         ASSERT(FALSE);\r
@@ -346,9 +346,9 @@ CmpDoCreate(IN PHHIVE Hive,
                               AccessState,\r
                               Name,\r
                               AccessMode,\r
-                              Class,\r
+                              ParseContext,\r
                               ParentKcb,\r
-                              CreateOptions,\r
+                              ParseContext->CreateOptions, // WRONG!\r
                               &KeyCell,\r
                               Object);\r
     if (NT_SUCCESS(Status))\r
@@ -391,14 +391,14 @@ CmpDoCreate(IN PHHIVE Hive,
         }\r
 \r
         /* Check if we need toupdate class length maximum */\r
-        if (KeyNode->MaxClassLen < Class->Length)\r
+        if (KeyNode->MaxClassLen < ParseContext->Class.Length)\r
         {\r
             /* Update it */\r
-            KeyNode->MaxClassLen = Class->Length;\r
+            KeyNode->MaxClassLen = ParseContext->Class.Length;\r
         }\r
 \r
         /* Check if we're creating a symbolic link */\r
-        if (CreateOptions & REG_OPTION_CREATE_LINK)\r
+        if (ParseContext->CreateOptions & REG_OPTION_CREATE_LINK)\r
         {\r
             /* Get the cell data */\r
             CellData = HvGetCell(Hive, KeyCell);\r
@@ -591,7 +591,7 @@ CmpCreateLinkNode(IN PHHIVE Hive,
                            AccessState,\r
                            AccessMode,\r
                            CreateOptions,\r
-                           NULL,\r
+                           Context,\r
                            0,\r
                            &Kcb,\r
                            &Name,\r
@@ -607,7 +607,7 @@ CmpCreateLinkNode(IN PHHIVE Hive,
                                   AccessState,\r
                                   &Name,\r
                                   AccessMode,\r
-                                  &Context->Class,\r
+                                  Context,\r
                                   ParentKcb,\r
                                   KEY_HIVE_ENTRY | KEY_NO_DELETE,\r
                                   &ChildCell,\r
index 62b924c..99e5915 100644 (file)
@@ -614,7 +614,7 @@ CmpLinkHiveToMaster(IN PUNICODE_STRING LinkName,
     ObReferenceObject(NewKey);\r
     \r
     /* Link this key to the parent */\r
-    CmiAddKeyToList(ParentKey->KeyControlBlock, NewKey);\r
+    InsertTailList(&ParentKey->KeyControlBlock->KeyBodyListHead, &NewKey->KeyBodyEntry);\r
     return STATUS_SUCCESS;    \r
 }\r
 \r