[ros-diffs] [fireball] 29986: - Start using members inside the KCB instead of the PKEY_OBJECT. - Remove DummyKcb hacks since we now have a real, valid KCB. - Get rid of the cm worker thread and related code, this should fix a couple of random registry bugchecks and corruption. - This is a slow transition to using CM_KEY_BODY and KCB.

fireball at svn.reactos.org fireball at svn.reactos.org
Tue Oct 30 21:50:18 CET 2007


Author: fireball
Date: Tue Oct 30 23:50:18 2007
New Revision: 29986

URL: http://svn.reactos.org/svn/reactos?rev=29986&view=rev
Log:
- Start using members inside the KCB instead of the PKEY_OBJECT.
- Remove DummyKcb hacks since we now have a real, valid KCB.
- Get rid of the cm worker thread and related code, this should fix a couple of random registry bugchecks and corruption.
- This is a slow transition to using CM_KEY_BODY and KCB.

Modified:
    trunk/reactos/ntoskrnl/cm/ntfunc.c
    trunk/reactos/ntoskrnl/cm/registry.c
    trunk/reactos/ntoskrnl/cm/regobj.c
    trunk/reactos/ntoskrnl/config/cm.h
    trunk/reactos/ntoskrnl/config/cmparse.c
    trunk/reactos/ntoskrnl/config/cmsysini.c

Modified: trunk/reactos/ntoskrnl/cm/ntfunc.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cm/ntfunc.c?rev=29986&r1=29985&r2=29986&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/cm/ntfunc.c (original)
+++ trunk/reactos/ntoskrnl/cm/ntfunc.c Tue Oct 30 23:50:18 2007
@@ -149,6 +149,7 @@
     KPROCESSOR_MODE PreviousMode;
     UNICODE_STRING CapturedClass = {0};
     HANDLE hKey;
+    PCM_KEY_NODE Node, ParentNode;
 
     PAGED_CODE();
 
@@ -237,7 +238,7 @@
     if (RemainingPath.Length == 0)
     {
         /* Fail if the key has been deleted */
-        if (((PKEY_OBJECT) Object)->Flags & KO_MARKED_FOR_DELETE)
+        if (((PKEY_OBJECT) Object)->KeyControlBlock->Delete)
         {
             PostCreateKeyInfo.Object = NULL;
             PostCreateKeyInfo.Status = STATUS_UNSUCCESSFUL;
@@ -305,8 +306,8 @@
     ExAcquireResourceExclusiveLite(&CmpRegistryLock, TRUE);
 
     /* Create the key */
-    Status = CmpDoCreate(&((PKEY_OBJECT)Object)->RegistryHive->Hive,
-                         ((PKEY_OBJECT)Object)->KeyCellOffset,
+    Status = CmpDoCreate(((PKEY_OBJECT)Object)->KeyControlBlock->KeyHive,
+                         ((PKEY_OBJECT)Object)->KeyControlBlock->KeyCell,
                          NULL,
                          &RemainingPath,
                          KernelMode,
@@ -332,10 +333,17 @@
 
     RtlCreateUnicodeString(&KeyObject->Name, Start);
 
-    KeyObject->KeyCell->Parent = KeyObject->ParentKey->KeyCellOffset;
-    KeyObject->KeyCell->Security = KeyObject->ParentKey->KeyCell->Security;
-    KeyObject->ValueCache.ValueList = KeyObject->KeyCell->ValueList.List;
-    KeyObject->ValueCache.Count = KeyObject->KeyCell->ValueList.Count;
+    ParentNode = (PCM_KEY_NODE)HvGetCell(KeyObject->ParentKey->KeyControlBlock->KeyHive,
+                                         KeyObject->ParentKey->KeyControlBlock->KeyCell);
+
+    Node = (PCM_KEY_NODE)HvGetCell(KeyObject->KeyControlBlock->KeyHive,
+                                   KeyObject->KeyControlBlock->KeyCell);
+    
+    Node->Parent = KeyObject->ParentKey->KeyControlBlock->KeyCell;
+    Node->Security = ParentNode->Security;
+    
+    KeyObject->KeyControlBlock->ValueCache.ValueList = Node->ValueList.List;
+    KeyObject->KeyControlBlock->ValueCache.Count = Node->ValueList.Count;
 
     DPRINT("RemainingPath: %wZ\n", &RemainingPath);
 
@@ -435,7 +443,7 @@
 
     VERIFY_KEY_OBJECT(KeyObject);
 
-    RegistryHive = KeyObject->RegistryHive;
+    RegistryHive = (PCMHIVE)KeyObject->KeyControlBlock->KeyHive;
 
     /* Acquire hive lock */
     KeEnterCriticalRegion();
@@ -576,7 +584,7 @@
     RtlFreeUnicodeString(&RemainingPath);
 
     /* Fail if the key has been deleted */
-    if (((PKEY_OBJECT)Object)->Flags & KO_MARKED_FOR_DELETE)
+    if (((PKEY_OBJECT)Object)->KeyControlBlock->Delete)
     {
         Status = STATUS_UNSUCCESSFUL;
         goto openkey_cleanup;
@@ -708,17 +716,13 @@
     Status = CmiCallRegisteredCallbacks(RegNtPreDeleteKey, &DeleteKeyInfo);
     if (NT_SUCCESS(Status))
     {
-        /* HACK: Setup the Dummy KCB */
-        CM_KEY_CONTROL_BLOCK DummyKcb = {0};
-        DummyKcb.KeyHive = &KeyObject->RegistryHive->Hive;
-        DummyKcb.KeyCell = KeyObject->KeyCellOffset;
-
         /* Call the internal API */
-        Status = CmDeleteKey(&DummyKcb);
+        Status = CmDeleteKey(KeyObject->KeyControlBlock);
 
         /* Remove the keep-alive reference */
         ObDereferenceObject(KeyObject);
-        if (KeyObject->RegistryHive != KeyObject->ParentKey->RegistryHive)
+        if (KeyObject->KeyControlBlock->KeyHive !=
+            KeyObject->ParentKey->KeyControlBlock->KeyHive)
         {
             /* Dereference again */
             ObDereferenceObject(KeyObject);
@@ -777,13 +781,8 @@
     Status = CmiCallRegisteredCallbacks(RegNtPreEnumerateKey, &EnumerateKeyInfo);
     if (NT_SUCCESS(Status))
     {
-        /* HACK: Setup the Dummy KCB */
-        CM_KEY_CONTROL_BLOCK DummyKcb = {0};
-        DummyKcb.KeyHive = &KeyObject->RegistryHive->Hive;
-        DummyKcb.KeyCell = KeyObject->KeyCellOffset;
-
         /* Call the internal API */
-        Status = CmEnumerateKey(&DummyKcb,
+        Status = CmEnumerateKey(KeyObject->KeyControlBlock,
                                 Index,
                                 KeyInformationClass,
                                 KeyInformation,
@@ -845,13 +844,8 @@
                                         &EnumerateValueKeyInfo);
     if (NT_SUCCESS(Status))
     {
-        /* HACK: Setup the Dummy KCB */
-        CM_KEY_CONTROL_BLOCK DummyKcb = {0};
-        DummyKcb.KeyHive = &KeyObject->RegistryHive->Hive;
-        DummyKcb.KeyCell = KeyObject->KeyCellOffset;
-
         /* Call the internal API */
-        Status = CmEnumerateValueKey(&DummyKcb,
+        Status = CmEnumerateValueKey(KeyObject->KeyControlBlock,
                                      Index,
                                      KeyValueInformationClass,
                                      KeyValueInformation,
@@ -911,13 +905,8 @@
     Status = CmiCallRegisteredCallbacks(RegNtPreQueryKey, &QueryKeyInfo);
     if (NT_SUCCESS(Status))
     {
-        /* HACK: Setup the Dummy KCB */
-        CM_KEY_CONTROL_BLOCK DummyKcb = {0};
-        DummyKcb.KeyHive = &KeyObject->RegistryHive->Hive;
-        DummyKcb.KeyCell = KeyObject->KeyCellOffset;
-
         /* Call the internal API */
-        Status = CmQueryKey(&DummyKcb,
+        Status = CmQueryKey(KeyObject->KeyControlBlock,
                             KeyInformationClass,
                             KeyInformation,
                             Length,
@@ -976,13 +965,8 @@
     Status = CmiCallRegisteredCallbacks(RegNtPreQueryValueKey, &QueryValueKeyInfo);
     if (NT_SUCCESS(Status))
     {
-        /* HACK: Setup the Dummy KCB */
-        CM_KEY_CONTROL_BLOCK DummyKcb = {0};
-        DummyKcb.KeyHive = &KeyObject->RegistryHive->Hive;
-        DummyKcb.KeyCell = KeyObject->KeyCellOffset;
-
         /* Call the internal API */
-        Status = CmQueryValueKey(&DummyKcb,
+        Status = CmQueryValueKey(KeyObject->KeyControlBlock,
                                  *ValueName,
                                  KeyValueInformationClass,
                                  KeyValueInformation,
@@ -1044,14 +1028,9 @@
     /* Do the callback */
     Status = CmiCallRegisteredCallbacks(RegNtPreSetValueKey, &SetValueKeyInfo);
     if (NT_SUCCESS(Status))
-    {
-        /* HACK: Setup the Dummy KCB */
-        CM_KEY_CONTROL_BLOCK DummyKcb = {0};
-        DummyKcb.KeyHive = &KeyObject->RegistryHive->Hive;
-        DummyKcb.KeyCell = KeyObject->KeyCellOffset;
-        
+    {        
         /* Call the internal API */
-        Status = CmSetValueKey(&DummyKcb,
+        Status = CmSetValueKey(KeyObject->KeyControlBlock,
                                ValueName,
                                Type,
                                Data,
@@ -1100,13 +1079,8 @@
                                         &DeleteValueKeyInfo);
     if (NT_SUCCESS(Status))
     {
-        /* HACK: Setup the Dummy KCB */
-        CM_KEY_CONTROL_BLOCK DummyKcb = {0};
-        DummyKcb.KeyHive = &KeyObject->RegistryHive->Hive;
-        DummyKcb.KeyCell = KeyObject->KeyCellOffset;
-
         /* Call the internal API */
-        Status = CmDeleteValueKey(&DummyKcb, *ValueName);
+        Status = CmDeleteValueKey(KeyObject->KeyControlBlock, *ValueName);
 
         /* Do the post callback */
         PostOperationInfo.Object = (PVOID)KeyObject;

Modified: trunk/reactos/ntoskrnl/cm/registry.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cm/registry.c?rev=29986&r1=29985&r2=29986&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/cm/registry.c (original)
+++ trunk/reactos/ntoskrnl/cm/registry.c Tue Oct 30 23:50:18 2007
@@ -34,10 +34,8 @@
 
 ERESOURCE CmpRegistryLock;
 
-KTIMER CmiWorkerTimer;
 LIST_ENTRY CmiKeyObjectListHead;
 LIST_ENTRY CmiConnectedHiveList;
-ULONG CmiTimer = 0; /* gets incremented every 5 seconds (CmiWorkerTimer) */
 
 volatile BOOLEAN CmiHiveSyncEnabled = FALSE;
 volatile BOOLEAN CmiHiveSyncPending = FALSE;
@@ -53,136 +51,6 @@
 
 extern LIST_ENTRY CmiCallbackHead;
 extern FAST_MUTEX CmiCallbackLock;
-
-/* FUNCTIONS ****************************************************************/
-
-/* Debugging helper functions:                                             */
-/*   CmiVerifyHiveListIntegrity                                            */
-/*   CmiVerifyHiveListIntegrityWhileLocked                                 */
-/* These functions are normally unused. However, should any of the asserts */
-/* checking for registry loops in CmiWorkerThread start to trigger, it is  */
-/* recommended to add liberal amounts of calls to this function throughout */
-/* suspect code. This function is due to its iterative nature not intended */
-/* to be called during normal circumstances, but as a debugging aid.       */
-static
-VOID
-NTAPI
-CmipVerifyHiveListIntegrity(BOOLEAN IsLocked)
-{
-    PLIST_ENTRY CurrentEntry;
-    if (!IsLocked)
-    {
-        /* Acquire hive lock */
-        KeEnterCriticalRegion();
-        ExAcquireResourceExclusiveLite(&CmpRegistryLock, TRUE);
-    }
-
-    if (IsListEmpty(&CmiKeyObjectListHead))
-    {
-        ASSERT(CmiKeyObjectListHead.Blink == CmiKeyObjectListHead.Flink);
-    }
-    /* walk the list both forwards and backwards */
-    CurrentEntry = CmiKeyObjectListHead.Flink;
-    while (CurrentEntry != &CmiKeyObjectListHead)
-    {
-        ASSERT(CurrentEntry->Blink != CurrentEntry);
-        ASSERT(CurrentEntry->Flink != CurrentEntry);
-        CurrentEntry = CurrentEntry->Flink;
-    }
-
-    CurrentEntry = CmiKeyObjectListHead.Blink;
-    while (CurrentEntry != &CmiKeyObjectListHead)
-    {
-        ASSERT(CurrentEntry->Blink != CurrentEntry);
-        ASSERT(CurrentEntry->Flink != CurrentEntry);
-        CurrentEntry = CurrentEntry->Blink;
-    }
-
-    if (!IsLocked)
-    {
-        ExReleaseResourceLite(&CmpRegistryLock);
-        KeLeaveCriticalRegion();
-    }
-}
-
-VOID NTAPI CmiVerifyHiveListIntegrity()            { CmipVerifyHiveListIntegrity(FALSE); }
-VOID NTAPI CmiVerifyHiveListIntegrityWhileLocked() { CmipVerifyHiveListIntegrity(TRUE); }
-
-
-
-VOID
-NTAPI
-CmiWorkerThread(PVOID Param)
-{
-    NTSTATUS Status;
-    PLIST_ENTRY CurrentEntry;
-    PKEY_OBJECT CurrentKey;
-    ULONG Count; /* how many objects have been dereferenced each pass */
-
-    /* Loop forever, getting woken up every 5 seconds by CmiWorkerTimer */
-
-    while (1)
-    {
-        Status = KeWaitForSingleObject(&CmiWorkerTimer,
-                                       Executive,
-                                       KernelMode,
-                                       FALSE,
-                                       NULL);
-        if (Status == STATUS_SUCCESS)
-        {
-            DPRINT("CmiWorkerThread\n");
-
-            /* Acquire hive lock */
-            KeEnterCriticalRegion();
-            ExAcquireResourceExclusiveLite(&CmpRegistryLock, TRUE);
-
-            CmiTimer++;
-
-            Count = 0;
-            CurrentEntry = CmiKeyObjectListHead.Blink;
-            while (CurrentEntry != &CmiKeyObjectListHead)
-            {
-                CurrentKey = CONTAINING_RECORD(CurrentEntry, KEY_OBJECT, ListEntry);
-                if (CurrentKey->TimeStamp + 120 > CmiTimer)
-                {
-                    /* The object was accessed in the last 10min */
-                    break;
-                }
-                if (1 == ObGetObjectPointerCount(CurrentKey) &&
-                    !(CurrentKey->Flags & KO_MARKED_FOR_DELETE))
-                {
-                    /* PointerCount is 1, and it's not marked for delete */
-                    ObDereferenceObject(CurrentKey);
-                    if (CurrentEntry == CmiKeyObjectListHead.Blink)
-                    {
-                        DPRINT("Registry loop detected! Crashing\n");
-                        KEBUGCHECK(0);
-                    }
-                    CurrentEntry = CmiKeyObjectListHead.Blink;
-                    Count++;
-                }
-                else
-                {
-                    /* PointerCount was not 1, or it was marked for delete */
-                    if (CurrentEntry == CurrentEntry->Blink)
-                    {
-                        DPRINT("Registry loop detected! Crashing\n");
-                        KEBUGCHECK(0);
-                    }
-                    CurrentEntry = CurrentEntry->Blink;
-                }
-            }
-            ExReleaseResourceLite(&CmpRegistryLock);
-            KeLeaveCriticalRegion();
-
-            DPRINT("Removed %d key objects\n", Count);
-        }
-        else
-        {
-            KEBUGCHECK(0);
-        }
-    }
-}
 
 PVOID
 NTAPI
@@ -234,7 +102,7 @@
     ExAcquireResourceExclusiveLite(&CmpRegistryLock, TRUE);
 
     /* Insert it into the global list (we don't have KCBs here) */
-    InsertTailList(&CmiKeyObjectListHead, &KeyObject->ListEntry);
+    InsertTailList(&CmiKeyObjectListHead, &KeyObject->KeyBodyList);
 
     ExReleaseResourceLite(&CmpRegistryLock);
     KeLeaveCriticalRegion();
@@ -338,8 +206,8 @@
     DPRINT ("SubName %S\n", SubName);
 
     /* Create the key */
-    Status = CmpDoCreate(&ParentKey->RegistryHive->Hive,
-                         ParentKey->KeyCellOffset,
+    Status = CmpDoCreate(ParentKey->KeyControlBlock->KeyHive,
+                         ParentKey->KeyControlBlock->KeyCell,
                          NULL,
                          &RemainingPath,
                          KernelMode,
@@ -356,9 +224,8 @@
         return STATUS_INSUFFICIENT_RESOURCES;
     }
 
-    NewKey->KeyCellOffset = RegistryHive->Hive.BaseBlock->RootCell;
-    NewKey->KeyCell = (PVOID)HvGetCell(&RegistryHive->Hive, NewKey->KeyCellOffset);
-    NewKey->RegistryHive = RegistryHive;
+    NewKey->KeyControlBlock->KeyCell = RegistryHive->Hive.BaseBlock->RootCell;
+    NewKey->KeyControlBlock->KeyHive = &RegistryHive->Hive;
 
     Status = RtlpCreateUnicodeString(&NewKey->Name,
         SubName, NonPagedPool);

Modified: trunk/reactos/ntoskrnl/cm/regobj.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cm/regobj.c?rev=29986&r1=29985&r2=29986&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/cm/regobj.c (original)
+++ trunk/reactos/ntoskrnl/cm/regobj.c Tue Oct 30 23:50:18 2007
@@ -366,7 +366,8 @@
     UNICODE_STRING KeyName;
     PWSTR *Path = &RemainingName->Buffer;
     PCM_KEY_CONTROL_BLOCK ParentKcb = NULL, Kcb;
-
+    PCM_KEY_NODE Node;
+    
     ParsedKey = ParsedObject;
 
     VERIFY_KEY_OBJECT(ParsedKey);
@@ -422,8 +423,11 @@
     if (FoundObject == NULL)
     {
         /* Search for the subkey */
-        BlockOffset = CmpFindSubKeyByName(&ParsedKey->RegistryHive->Hive,
-                                          ParsedKey->KeyCell,
+        Node = (PCM_KEY_NODE)HvGetCell(ParsedKey->KeyControlBlock->KeyHive,
+                                       ParsedKey->KeyControlBlock->KeyCell);
+        
+        BlockOffset = CmpFindSubKeyByName(ParsedKey->KeyControlBlock->KeyHive,
+                                          Node,
                                           &KeyName);
         if (BlockOffset == HCELL_NIL)
         {
@@ -434,13 +438,13 @@
         }
         
         /* Get the node */
-        SubKeyCell = (PCM_KEY_NODE)HvGetCell(&ParsedKey->RegistryHive->Hive, BlockOffset);
+        SubKeyCell = (PCM_KEY_NODE)HvGetCell(ParsedKey->KeyControlBlock->KeyHive, BlockOffset);
 
         if ((SubKeyCell->Flags & KEY_SYM_LINK) &&
             !((Attributes & OBJ_OPENLINK) && (EndPtr == NULL)))
         {
             RtlInitUnicodeString(&LinkPath, NULL);
-            Status = CmiGetLinkTarget(ParsedKey->RegistryHive,
+            Status = CmiGetLinkTarget((PCMHIVE)ParsedKey->KeyControlBlock->KeyHive,
                                       SubKeyCell,
                                       &LinkPath);
             if (NT_SUCCESS(Status))
@@ -520,7 +524,7 @@
         ObReferenceObject(FoundObject);
         
         /* Create the KCB */
-        Kcb = CmpCreateKeyControlBlock(&ParsedKey->RegistryHive->Hive,
+        Kcb = CmpCreateKeyControlBlock(ParsedKey->KeyControlBlock->KeyHive,
                                        BlockOffset,
                                        SubKeyCell,
                                        ParentKcb,
@@ -535,25 +539,25 @@
         }
                                   
         FoundObject->KeyControlBlock = Kcb;
-        FoundObject->Flags = 0;
-        FoundObject->KeyCell = SubKeyCell;
-        FoundObject->KeyCellOffset = BlockOffset;
-        FoundObject->RegistryHive = ParsedKey->RegistryHive;
-        InsertTailList(&CmiKeyObjectListHead, &FoundObject->ListEntry);
+        ASSERT(FoundObject->KeyControlBlock->KeyHive == ParsedKey->KeyControlBlock->KeyHive);
+        InsertTailList(&CmiKeyObjectListHead, &FoundObject->KeyBodyList);
         RtlpCreateUnicodeString(&FoundObject->Name, KeyName.Buffer, NonPagedPool);
         CmiAddKeyToList(ParsedKey, FoundObject);
         DPRINT("Created object 0x%p\n", FoundObject);
     }
     else
     {
-        if ((FoundObject->KeyCell->Flags & KEY_SYM_LINK) &&
+        Node = (PCM_KEY_NODE)HvGetCell(FoundObject->KeyControlBlock->KeyHive,
+                                       FoundObject->KeyControlBlock->KeyCell);
+        
+        if ((Node->Flags & KEY_SYM_LINK) &&
             !((Attributes & OBJ_OPENLINK) && (EndPtr == NULL)))
         {
             DPRINT("Found link\n");
 
             RtlInitUnicodeString(&LinkPath, NULL);
-            Status = CmiGetLinkTarget(FoundObject->RegistryHive,
-                                      FoundObject->KeyCell,
+            Status = CmiGetLinkTarget((PCMHIVE)FoundObject->KeyControlBlock->KeyHive,
+                                      Node,
                                       &LinkPath);
             if (NT_SUCCESS(Status))
             {
@@ -598,9 +602,8 @@
         }
     }
 
-    RemoveEntryList(&FoundObject->ListEntry);
-    InsertHeadList(&CmiKeyObjectListHead, &FoundObject->ListEntry);
-    FoundObject->TimeStamp = CmiTimer;
+    RemoveEntryList(&FoundObject->KeyBodyList);
+    InsertHeadList(&CmiKeyObjectListHead, &FoundObject->KeyBodyList);
 
     ExReleaseResourceLite(&CmpRegistryLock);
     KeLeaveCriticalRegion();
@@ -650,10 +653,10 @@
     KeEnterCriticalRegion();
     ExAcquireResourceExclusiveLite(&CmpRegistryLock, TRUE);
 
-    RemoveEntryList(&KeyObject->ListEntry);
+    RemoveEntryList(&KeyObject->KeyBodyList);
     RtlFreeUnicodeString(&KeyObject->Name);
 
-    ASSERT((KeyObject->Flags & KO_MARKED_FOR_DELETE) == FALSE);
+    ASSERT((KeyObject->KeyControlBlock->Delete) == FALSE);
 
     ObDereferenceObject (ParentKeyObject);
 
@@ -812,7 +815,7 @@
 
     if (Index < Parent->SubKeyCounts)
     {
-        if (CurKey->Flags & KO_MARKED_FOR_DELETE)
+        if (CurKey->KeyControlBlock->Delete)
         {
             CHECKPOINT;
             *ReturnedObject = NULL;

Modified: trunk/reactos/ntoskrnl/config/cm.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cm.h?rev=29986&r1=29985&r2=29986&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/config/cm.h (original)
+++ trunk/reactos/ntoskrnl/config/cm.h Tue Oct 30 23:50:18 2007
@@ -505,21 +505,13 @@
 #define IsNoFileHive(Hive)      ((Hive)->Flags & HIVE_NO_FILE)
 typedef struct _KEY_OBJECT
 {
-    CSHORT Type;
-    CSHORT Size;
-    ULONG Flags;
+    ULONG Type;
     UNICODE_STRING Name;
-    PCMHIVE RegistryHive;
-    HCELL_INDEX KeyCellOffset;
-    PCM_KEY_NODE KeyCell;
     struct _KEY_OBJECT *ParentKey;
-    LIST_ENTRY ListEntry;
+    LIST_ENTRY KeyBodyList;
     ULONG SubKeyCounts;
     ULONG SizeOfSubKeys;
     struct _KEY_OBJECT **SubKeys;
-    ULONG TimeStamp;
-    LIST_ENTRY HiveList;
-    CACHED_CHILD_LIST ValueCache;
     PCM_KEY_CONTROL_BLOCK KeyControlBlock;
 } KEY_OBJECT, *PKEY_OBJECT;
 extern PCMHIVE CmiVolatileHive;

Modified: trunk/reactos/ntoskrnl/config/cmparse.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cmparse.c?rev=29986&r1=29985&r2=29986&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/config/cmparse.c (original)
+++ trunk/reactos/ntoskrnl/config/cmparse.c Tue Oct 30 23:50:18 2007
@@ -230,15 +230,11 @@
 
     /* Now fill out the Cm object */
     KeyBody->KeyControlBlock = Kcb;
-    KeyBody->KeyCell = KeyNode;
-    KeyBody->KeyCellOffset = *KeyCell;
-    KeyBody->Flags = 0;
     KeyBody->SubKeyCounts = 0;
     KeyBody->SubKeys = NULL;
     KeyBody->SizeOfSubKeys = 0;
     KeyBody->ParentKey = Parent;
-    KeyBody->RegistryHive = KeyBody->ParentKey->RegistryHive;
-    InsertTailList(&CmiKeyObjectListHead, &KeyBody->ListEntry);
+    InsertTailList(&CmiKeyObjectListHead, &KeyBody->KeyBodyList);
 
 Quickie:
     /* Check if we got here because of failure */
@@ -290,8 +286,7 @@
     ExAcquirePushLockShared((PVOID)&((PCMHIVE)Hive)->FlusherLock);
 
     /* Check if the parent is being deleted */
-    #define KO_MARKED_FOR_DELETE 0x00000001
-    if (Parent->Flags & KO_MARKED_FOR_DELETE)
+    if (Parent->KeyControlBlock->Delete)
     {
         /* It has, quit */
         ASSERT(FALSE);
@@ -319,7 +314,7 @@
     }
 
     /* Sanity check */
-    ASSERT(Cell == Parent->KeyCellOffset);
+    ASSERT(Cell == Parent->KeyControlBlock->KeyCell);
 
     /* Get the parent type */
     ParentType = HvGetCellType(Cell);
@@ -332,7 +327,7 @@
     }
 
     /* Don't allow children under symlinks */
-    if (Parent->Flags & KEY_SYM_LINK)
+    if (Parent->KeyControlBlock->Flags & KEY_SYM_LINK)
     {
         /* Fail */
         ASSERT(FALSE);
@@ -376,8 +371,8 @@
         }
 
         /* Sanity checks */
-        ASSERT(KeyBody->ParentKey->KeyCellOffset == Cell);
-        ASSERT(&KeyBody->ParentKey->RegistryHive->Hive == Hive);
+        ASSERT(KeyBody->ParentKey->KeyControlBlock->KeyCell == Cell);
+        ASSERT(KeyBody->ParentKey->KeyControlBlock->KeyHive == Hive);
         ASSERT(KeyBody->ParentKey == Parent);
 
         /* Update the timestamp */

Modified: trunk/reactos/ntoskrnl/config/cmsysini.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cmsysini.c?rev=29986&r1=29985&r2=29986&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/config/cmsysini.c (original)
+++ trunk/reactos/ntoskrnl/config/cmsysini.c Tue Oct 30 23:50:18 2007
@@ -708,19 +708,14 @@
     if (!Kcb) return FALSE;
 
     /* Initialize the object */
-#if 0
     RootKey->Type = TAG('k', 'v', '0', '2');
     RootKey->KeyControlBlock = Kcb;
+#if 0
     RootKey->NotifyBlock = NULL;
     RootKey->ProcessID = PsGetCurrentProcessId();
 #else
     RtlpCreateUnicodeString(&RootKey->Name, L"Registry", NonPagedPool);
-    RootKey->KeyControlBlock = Kcb;
-    RootKey->RegistryHive = CmiVolatileHive;
-    RootKey->KeyCellOffset = RootIndex;
-    RootKey->KeyCell = KeyCell;
     RootKey->ParentKey = RootKey;
-    RootKey->Flags = 0;
     RootKey->SubKeyCounts = 0;
     RootKey->SubKeys = NULL;
     RootKey->SizeOfSubKeys = 0;
@@ -759,9 +754,6 @@
     UNICODE_STRING KeyName;
     HANDLE KeyHandle;
     NTSTATUS Status;
-    LARGE_INTEGER DueTime;
-    HANDLE ThreadHandle;
-    CLIENT_ID ThreadId;
     PCMHIVE HardwareHive;
     PVOID BaseAddress;
     ULONG Length;
@@ -806,23 +798,6 @@
     /* OLD CM: Initialize the key object list */
     InitializeListHead(&CmiKeyObjectListHead);
     InitializeListHead(&CmiConnectedHiveList);
-
-    /* OLD CM: Initialize the worker timer */
-    KeInitializeTimerEx(&CmiWorkerTimer, SynchronizationTimer);
-
-    /* OLD CM: Initialize the worker thread */
-    Status = PsCreateSystemThread(&ThreadHandle,
-                                  THREAD_ALL_ACCESS,
-                                  NULL,
-                                  NULL,
-                                  &ThreadId,
-                                  CmiWorkerThread,
-                                  NULL);
-    if (!NT_SUCCESS(Status)) return FALSE;
-
-    /* OLD CM: Start the timer */
-    DueTime.QuadPart = -1;
-    KeSetTimerEx(&CmiWorkerTimer, DueTime, 5000, NULL); /* 5sec */
 #endif
 
     /* Create the key object types */




More information about the Ros-diffs mailing list