- Actually create KCB where needed.

svn path=/trunk/; revision=29958
This commit is contained in:
Aleksey Bragin 2007-10-29 18:05:54 +00:00
parent 904dde02c7
commit b26a87eed3
4 changed files with 51 additions and 10 deletions

View file

@ -365,6 +365,7 @@ CmpParseKey(IN PVOID ParsedObject,
UNICODE_STRING TargetPath;
UNICODE_STRING KeyName;
PWSTR *Path = &RemainingName->Buffer;
PCM_KEY_CONTROL_BLOCK ParentKcb = NULL, Kcb;
ParsedKey = ParsedObject;
@ -415,22 +416,25 @@ CmpParseKey(IN PVOID ParsedObject,
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 @@ CmpParseKey(IN PVOID ParsedObject,
/* 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;

View file

@ -520,6 +520,7 @@ typedef struct _KEY_OBJECT
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;

View file

@ -96,6 +96,7 @@ CmpDoCreateChild(IN PHHIVE Hive,
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 @@ CmpDoCreateChild(IN PHHIVE Hive,
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;

View file

@ -669,7 +669,6 @@ CmpCreateRegistryRoot(VOID)
if (!CmpCreateRootNode(&CmiVolatileHive->Hive, L"REGISTRY", &RootIndex))
{
/* We failed */
DPRINT1("Fail\n");
return FALSE;
}
@ -716,6 +715,7 @@ CmpCreateRegistryRoot(VOID)
RootKey->ProcessID = PsGetCurrentProcessId();
#else
RtlpCreateUnicodeString(&RootKey->Name, L"Registry", NonPagedPool);
RootKey->KeyControlBlock = Kcb;
RootKey->RegistryHive = CmiVolatileHive;
RootKey->KeyCellOffset = RootIndex;
RootKey->KeyCell = KeyCell;