Author: fireball Date: Mon Oct 29 21:05:54 2007 New Revision: 29958
URL: http://svn.reactos.org/svn/reactos?rev=29958&view=rev Log: - Actually create KCB where needed.
Modified: 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/regobj.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cm/regobj.c?rev=29... ============================================================================== --- trunk/reactos/ntoskrnl/cm/regobj.c (original) +++ trunk/reactos/ntoskrnl/cm/regobj.c Mon Oct 29 21:05:54 2007 @@ -365,6 +365,7 @@ UNICODE_STRING TargetPath; UNICODE_STRING KeyName; PWSTR *Path = &RemainingName->Buffer; + PCM_KEY_CONTROL_BLOCK ParentKcb = NULL, Kcb;
ParsedKey = ParsedObject;
@@ -415,22 +416,25 @@ RtlFreeUnicodeString(&KeyName); return Status; } + + ParentKcb = ParsedKey->KeyControlBlock; + if (FoundObject == NULL) { - Status = CmiScanForSubKey(ParsedKey->RegistryHive, - ParsedKey->KeyCell, - &SubKeyCell, - &BlockOffset, - &KeyName, - 0, - Attributes); - if (!NT_SUCCESS(Status)) + /* Search for the subkey */ + BlockOffset = CmpFindSubKeyByName(&ParsedKey->RegistryHive->Hive, + ParsedKey->KeyCell, + &KeyName); + if (BlockOffset == HCELL_NIL) { ExReleaseResourceLite(&CmpRegistryLock); KeLeaveCriticalRegion(); RtlFreeUnicodeString(&KeyName); return(STATUS_UNSUCCESSFUL); } + + /* Get the node */ + SubKeyCell = (PCM_KEY_NODE)HvGetCell(&ParsedKey->RegistryHive->Hive, BlockOffset);
if ((SubKeyCell->Flags & KEY_SYM_LINK) && !((Attributes & OBJ_OPENLINK) && (EndPtr == NULL))) @@ -514,7 +518,23 @@
/* Add the keep-alive reference */ ObReferenceObject(FoundObject); - + + /* Create the KCB */ + Kcb = CmpCreateKeyControlBlock(&ParsedKey->RegistryHive->Hive, + BlockOffset, + SubKeyCell, + ParentKcb, + 0, + &KeyName); + if (!Kcb) + { + ExReleaseResourceLite(&CmpRegistryLock); + KeLeaveCriticalRegion(); + RtlFreeUnicodeString(&KeyName); + return STATUS_INSUFFICIENT_RESOURCES; + } + + FoundObject->KeyControlBlock = Kcb; FoundObject->Flags = 0; FoundObject->KeyCell = SubKeyCell; FoundObject->KeyCellOffset = BlockOffset;
Modified: trunk/reactos/ntoskrnl/config/cm.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cm.h?rev=29... ============================================================================== --- trunk/reactos/ntoskrnl/config/cm.h (original) +++ trunk/reactos/ntoskrnl/config/cm.h Mon Oct 29 21:05:54 2007 @@ -520,6 +520,7 @@ ULONG TimeStamp; LIST_ENTRY HiveList; CACHED_CHILD_LIST ValueCache; + PCM_KEY_CONTROL_BLOCK KeyControlBlock; } KEY_OBJECT, *PKEY_OBJECT; extern PCMHIVE CmiVolatileHive; extern LIST_ENTRY CmiKeyObjectListHead, CmiConnectedHiveList;
Modified: trunk/reactos/ntoskrnl/config/cmparse.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cmparse.c?r... ============================================================================== --- trunk/reactos/ntoskrnl/config/cmparse.c (original) +++ trunk/reactos/ntoskrnl/config/cmparse.c Mon Oct 29 21:05:54 2007 @@ -96,6 +96,7 @@ ULONG StorageType; LARGE_INTEGER SystemTime; BOOLEAN Hack = FALSE; + PCM_KEY_CONTROL_BLOCK Kcb;
/* ReactOS Hack */ if (Name->Buffer[0] == OBJ_NAME_PATH_SEPARATOR) @@ -208,8 +209,27 @@ KeyNode->MaxClassLen = 0; KeyNode->NameLength = CmpCopyName(Hive, KeyNode->Name, Name); if (KeyNode->NameLength < Name->Length) KeyNode->Flags |= KEY_COMP_NAME; + + /* Create the KCB */ + Kcb = CmpCreateKeyControlBlock(Hive, + *KeyCell, + KeyNode, + Parent->KeyControlBlock, + 0, + Name); + if (!Kcb) + { + /* Fail */ + ObDereferenceObjectDeferDelete(*Object); + Status = STATUS_INSUFFICIENT_RESOURCES; + goto Quickie; + } + + /* Sanity check */ + ASSERT(Kcb->RefCount == 1);
/* Now fill out the Cm object */ + KeyBody->KeyControlBlock = Kcb; KeyBody->KeyCell = KeyNode; KeyBody->KeyCellOffset = *KeyCell; KeyBody->Flags = 0;
Modified: trunk/reactos/ntoskrnl/config/cmsysini.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cmsysini.c?... ============================================================================== --- trunk/reactos/ntoskrnl/config/cmsysini.c (original) +++ trunk/reactos/ntoskrnl/config/cmsysini.c Mon Oct 29 21:05:54 2007 @@ -669,7 +669,6 @@ if (!CmpCreateRootNode(&CmiVolatileHive->Hive, L"REGISTRY", &RootIndex)) { /* We failed */ - DPRINT1("Fail\n"); return FALSE; }
@@ -716,6 +715,7 @@ RootKey->ProcessID = PsGetCurrentProcessId(); #else RtlpCreateUnicodeString(&RootKey->Name, L"Registry", NonPagedPool); + RootKey->KeyControlBlock = Kcb; RootKey->RegistryHive = CmiVolatileHive; RootKey->KeyCellOffset = RootIndex; RootKey->KeyCell = KeyCell;