mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 21:42:57 +00:00
- Actually create KCB where needed.
svn path=/trunk/; revision=29958
This commit is contained in:
parent
904dde02c7
commit
b26a87eed3
4 changed files with 51 additions and 10 deletions
|
@ -365,6 +365,7 @@ CmpParseKey(IN PVOID ParsedObject,
|
||||||
UNICODE_STRING TargetPath;
|
UNICODE_STRING TargetPath;
|
||||||
UNICODE_STRING KeyName;
|
UNICODE_STRING KeyName;
|
||||||
PWSTR *Path = &RemainingName->Buffer;
|
PWSTR *Path = &RemainingName->Buffer;
|
||||||
|
PCM_KEY_CONTROL_BLOCK ParentKcb = NULL, Kcb;
|
||||||
|
|
||||||
ParsedKey = ParsedObject;
|
ParsedKey = ParsedObject;
|
||||||
|
|
||||||
|
@ -415,22 +416,25 @@ CmpParseKey(IN PVOID ParsedObject,
|
||||||
RtlFreeUnicodeString(&KeyName);
|
RtlFreeUnicodeString(&KeyName);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ParentKcb = ParsedKey->KeyControlBlock;
|
||||||
|
|
||||||
if (FoundObject == NULL)
|
if (FoundObject == NULL)
|
||||||
{
|
{
|
||||||
Status = CmiScanForSubKey(ParsedKey->RegistryHive,
|
/* Search for the subkey */
|
||||||
ParsedKey->KeyCell,
|
BlockOffset = CmpFindSubKeyByName(&ParsedKey->RegistryHive->Hive,
|
||||||
&SubKeyCell,
|
ParsedKey->KeyCell,
|
||||||
&BlockOffset,
|
&KeyName);
|
||||||
&KeyName,
|
if (BlockOffset == HCELL_NIL)
|
||||||
0,
|
|
||||||
Attributes);
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
{
|
||||||
ExReleaseResourceLite(&CmpRegistryLock);
|
ExReleaseResourceLite(&CmpRegistryLock);
|
||||||
KeLeaveCriticalRegion();
|
KeLeaveCriticalRegion();
|
||||||
RtlFreeUnicodeString(&KeyName);
|
RtlFreeUnicodeString(&KeyName);
|
||||||
return(STATUS_UNSUCCESSFUL);
|
return(STATUS_UNSUCCESSFUL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Get the node */
|
||||||
|
SubKeyCell = (PCM_KEY_NODE)HvGetCell(&ParsedKey->RegistryHive->Hive, BlockOffset);
|
||||||
|
|
||||||
if ((SubKeyCell->Flags & KEY_SYM_LINK) &&
|
if ((SubKeyCell->Flags & KEY_SYM_LINK) &&
|
||||||
!((Attributes & OBJ_OPENLINK) && (EndPtr == NULL)))
|
!((Attributes & OBJ_OPENLINK) && (EndPtr == NULL)))
|
||||||
|
@ -514,7 +518,23 @@ CmpParseKey(IN PVOID ParsedObject,
|
||||||
|
|
||||||
/* Add the keep-alive reference */
|
/* Add the keep-alive reference */
|
||||||
ObReferenceObject(FoundObject);
|
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->Flags = 0;
|
||||||
FoundObject->KeyCell = SubKeyCell;
|
FoundObject->KeyCell = SubKeyCell;
|
||||||
FoundObject->KeyCellOffset = BlockOffset;
|
FoundObject->KeyCellOffset = BlockOffset;
|
||||||
|
|
|
@ -520,6 +520,7 @@ typedef struct _KEY_OBJECT
|
||||||
ULONG TimeStamp;
|
ULONG TimeStamp;
|
||||||
LIST_ENTRY HiveList;
|
LIST_ENTRY HiveList;
|
||||||
CACHED_CHILD_LIST ValueCache;
|
CACHED_CHILD_LIST ValueCache;
|
||||||
|
PCM_KEY_CONTROL_BLOCK KeyControlBlock;
|
||||||
} KEY_OBJECT, *PKEY_OBJECT;
|
} KEY_OBJECT, *PKEY_OBJECT;
|
||||||
extern PCMHIVE CmiVolatileHive;
|
extern PCMHIVE CmiVolatileHive;
|
||||||
extern LIST_ENTRY CmiKeyObjectListHead, CmiConnectedHiveList;
|
extern LIST_ENTRY CmiKeyObjectListHead, CmiConnectedHiveList;
|
||||||
|
|
|
@ -96,6 +96,7 @@ CmpDoCreateChild(IN PHHIVE Hive,
|
||||||
ULONG StorageType;
|
ULONG StorageType;
|
||||||
LARGE_INTEGER SystemTime;
|
LARGE_INTEGER SystemTime;
|
||||||
BOOLEAN Hack = FALSE;
|
BOOLEAN Hack = FALSE;
|
||||||
|
PCM_KEY_CONTROL_BLOCK Kcb;
|
||||||
|
|
||||||
/* ReactOS Hack */
|
/* ReactOS Hack */
|
||||||
if (Name->Buffer[0] == OBJ_NAME_PATH_SEPARATOR)
|
if (Name->Buffer[0] == OBJ_NAME_PATH_SEPARATOR)
|
||||||
|
@ -208,8 +209,27 @@ CmpDoCreateChild(IN PHHIVE Hive,
|
||||||
KeyNode->MaxClassLen = 0;
|
KeyNode->MaxClassLen = 0;
|
||||||
KeyNode->NameLength = CmpCopyName(Hive, KeyNode->Name, Name);
|
KeyNode->NameLength = CmpCopyName(Hive, KeyNode->Name, Name);
|
||||||
if (KeyNode->NameLength < Name->Length) KeyNode->Flags |= KEY_COMP_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 */
|
/* Now fill out the Cm object */
|
||||||
|
KeyBody->KeyControlBlock = Kcb;
|
||||||
KeyBody->KeyCell = KeyNode;
|
KeyBody->KeyCell = KeyNode;
|
||||||
KeyBody->KeyCellOffset = *KeyCell;
|
KeyBody->KeyCellOffset = *KeyCell;
|
||||||
KeyBody->Flags = 0;
|
KeyBody->Flags = 0;
|
||||||
|
|
|
@ -669,7 +669,6 @@ CmpCreateRegistryRoot(VOID)
|
||||||
if (!CmpCreateRootNode(&CmiVolatileHive->Hive, L"REGISTRY", &RootIndex))
|
if (!CmpCreateRootNode(&CmiVolatileHive->Hive, L"REGISTRY", &RootIndex))
|
||||||
{
|
{
|
||||||
/* We failed */
|
/* We failed */
|
||||||
DPRINT1("Fail\n");
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -716,6 +715,7 @@ CmpCreateRegistryRoot(VOID)
|
||||||
RootKey->ProcessID = PsGetCurrentProcessId();
|
RootKey->ProcessID = PsGetCurrentProcessId();
|
||||||
#else
|
#else
|
||||||
RtlpCreateUnicodeString(&RootKey->Name, L"Registry", NonPagedPool);
|
RtlpCreateUnicodeString(&RootKey->Name, L"Registry", NonPagedPool);
|
||||||
|
RootKey->KeyControlBlock = Kcb;
|
||||||
RootKey->RegistryHive = CmiVolatileHive;
|
RootKey->RegistryHive = CmiVolatileHive;
|
||||||
RootKey->KeyCellOffset = RootIndex;
|
RootKey->KeyCellOffset = RootIndex;
|
||||||
RootKey->KeyCell = KeyCell;
|
RootKey->KeyCell = KeyCell;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue