mirror of
https://github.com/reactos/reactos.git
synced 2025-02-25 01:39:30 +00:00
- Get rid of parent key member in PKEY_OBJECT, and use ParentKcb instead.
- Modify more functions to use KCB instead of PKEY_OBJECT. svn path=/trunk/; revision=30026
This commit is contained in:
parent
0dc465de18
commit
cbb2ff96a6
6 changed files with 27 additions and 32 deletions
|
@ -313,7 +313,7 @@ NtCreateKey(OUT PHANDLE KeyHandle,
|
|||
KernelMode,
|
||||
Class,
|
||||
CreateOptions,
|
||||
(PKEY_OBJECT)Object,
|
||||
((PKEY_OBJECT)Object)->KeyControlBlock,
|
||||
NULL,
|
||||
(PVOID*)&KeyObject);
|
||||
if (!NT_SUCCESS(Status))
|
||||
|
@ -333,13 +333,13 @@ NtCreateKey(OUT PHANDLE KeyHandle,
|
|||
|
||||
RtlCreateUnicodeString(&KeyObject->Name, Start);
|
||||
|
||||
ParentNode = (PCM_KEY_NODE)HvGetCell(KeyObject->ParentKey->KeyControlBlock->KeyHive,
|
||||
KeyObject->ParentKey->KeyControlBlock->KeyCell);
|
||||
ParentNode = (PCM_KEY_NODE)HvGetCell(KeyObject->KeyControlBlock->ParentKcb->KeyHive,
|
||||
KeyObject->KeyControlBlock->ParentKcb->KeyCell);
|
||||
|
||||
Node = (PCM_KEY_NODE)HvGetCell(KeyObject->KeyControlBlock->KeyHive,
|
||||
KeyObject->KeyControlBlock->KeyCell);
|
||||
|
||||
Node->Parent = KeyObject->ParentKey->KeyControlBlock->KeyCell;
|
||||
Node->Parent = KeyObject->KeyControlBlock->ParentKcb->KeyCell;
|
||||
Node->Security = ParentNode->Security;
|
||||
|
||||
KeyObject->KeyControlBlock->ValueCache.ValueList = Node->ValueList.List;
|
||||
|
@ -347,7 +347,7 @@ NtCreateKey(OUT PHANDLE KeyHandle,
|
|||
|
||||
DPRINT("RemainingPath: %wZ\n", &RemainingPath);
|
||||
|
||||
CmiAddKeyToList(KeyObject->ParentKey, KeyObject);
|
||||
CmiAddKeyToList(((PKEY_OBJECT)Object), KeyObject);
|
||||
|
||||
VERIFY_KEY_OBJECT(KeyObject);
|
||||
|
||||
|
@ -722,7 +722,7 @@ NtDeleteKey(IN HANDLE KeyHandle)
|
|||
/* Remove the keep-alive reference */
|
||||
ObDereferenceObject(KeyObject);
|
||||
if (KeyObject->KeyControlBlock->KeyHive !=
|
||||
KeyObject->ParentKey->KeyControlBlock->KeyHive)
|
||||
KeyObject->KeyControlBlock->ParentKcb->KeyHive)
|
||||
{
|
||||
/* Dereference again */
|
||||
ObDereferenceObject(KeyObject);
|
||||
|
|
|
@ -213,7 +213,7 @@ CmiConnectHive(IN POBJECT_ATTRIBUTES KeyObjectAttributes,
|
|||
KernelMode,
|
||||
NULL,
|
||||
REG_OPTION_VOLATILE,
|
||||
ParentKey,
|
||||
ParentKey->KeyControlBlock,
|
||||
NULL,
|
||||
(PVOID*)&NewKey);
|
||||
if (!NT_SUCCESS(Status))
|
||||
|
|
|
@ -625,7 +625,6 @@ VOID
|
|||
NTAPI
|
||||
CmpDeleteKeyObject(PVOID DeletedObject)
|
||||
{
|
||||
PKEY_OBJECT ParentKeyObject;
|
||||
PKEY_OBJECT KeyObject;
|
||||
REG_KEY_HANDLE_CLOSE_INFORMATION KeyHandleCloseInfo;
|
||||
REG_POST_OPERATION_INFORMATION PostOperationInfo;
|
||||
|
@ -634,9 +633,7 @@ CmpDeleteKeyObject(PVOID DeletedObject)
|
|||
DPRINT("Delete key object (%p)\n", DeletedObject);
|
||||
|
||||
KeyObject = (PKEY_OBJECT) DeletedObject;
|
||||
ParentKeyObject = KeyObject->ParentKey;
|
||||
|
||||
ObReferenceObject (ParentKeyObject);
|
||||
|
||||
PostOperationInfo.Object = (PVOID)KeyObject;
|
||||
KeyHandleCloseInfo.Object = (PVOID)KeyObject;
|
||||
|
@ -645,7 +642,6 @@ CmpDeleteKeyObject(PVOID DeletedObject)
|
|||
{
|
||||
PostOperationInfo.Status = Status;
|
||||
CmiCallRegisteredCallbacks(RegNtPostKeyHandleClose, &PostOperationInfo);
|
||||
ObDereferenceObject (ParentKeyObject);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -658,8 +654,6 @@ CmpDeleteKeyObject(PVOID DeletedObject)
|
|||
|
||||
ASSERT((KeyObject->KeyControlBlock->Delete) == FALSE);
|
||||
|
||||
ObDereferenceObject (ParentKeyObject);
|
||||
|
||||
if (KeyObject->SizeOfSubKeys)
|
||||
{
|
||||
ExFreePool(KeyObject->SubKeys);
|
||||
|
@ -680,14 +674,15 @@ CmpQueryKeyName(PVOID ObjectBody,
|
|||
PULONG ReturnLength,
|
||||
IN KPROCESSOR_MODE PreviousMode)
|
||||
{
|
||||
DPRINT1("CmpQueryKeyName() called\n");
|
||||
while (TRUE);
|
||||
#if 0
|
||||
PKEY_OBJECT KeyObject;
|
||||
NTSTATUS Status;
|
||||
|
||||
DPRINT ("CmpQueryKeyName() called\n");
|
||||
|
||||
KeyObject = (PKEY_OBJECT)ObjectBody;
|
||||
|
||||
if (KeyObject->ParentKey != KeyObject)
|
||||
if (KeyObject->KeyControlBlock->ParentKcb != KeyObject->KeyControlBlock)
|
||||
{
|
||||
Status = ObQueryNameString (KeyObject->ParentKey,
|
||||
ObjectNameInfo,
|
||||
|
@ -734,8 +729,9 @@ CmpQueryKeyName(PVOID ObjectBody,
|
|||
{
|
||||
DPRINT ("Total path: %wZ\n", &ObjectNameInfo->Name);
|
||||
}
|
||||
#endif
|
||||
|
||||
return Status;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
VOID
|
||||
|
@ -773,7 +769,7 @@ CmiAddKeyToList(PKEY_OBJECT ParentKey,
|
|||
STANDARD_RIGHTS_REQUIRED,
|
||||
CmpKeyObjectType,
|
||||
KernelMode);
|
||||
NewKey->ParentKey = ParentKey;
|
||||
//NewKey->ParentKey = ParentKey;
|
||||
}
|
||||
|
||||
/* Preconditions: Must be called with CmpRegistryLock held. */
|
||||
|
|
|
@ -507,7 +507,6 @@ typedef struct _KEY_OBJECT
|
|||
{
|
||||
ULONG Type;
|
||||
UNICODE_STRING Name;
|
||||
struct _KEY_OBJECT *ParentKey;
|
||||
LIST_ENTRY KeyBodyList;
|
||||
ULONG SubKeyCounts;
|
||||
ULONG SizeOfSubKeys;
|
||||
|
@ -975,7 +974,7 @@ CmpDoCreate(
|
|||
IN KPROCESSOR_MODE AccessMode,
|
||||
IN PUNICODE_STRING Class,
|
||||
IN ULONG CreateOptions,
|
||||
IN PKEY_OBJECT Parent,
|
||||
IN PCM_KEY_CONTROL_BLOCK ParentKcb,
|
||||
IN PCMHIVE OriginatingHive OPTIONAL,
|
||||
OUT PVOID *Object
|
||||
);
|
||||
|
|
|
@ -83,7 +83,7 @@ CmpDoCreateChild(IN PHHIVE Hive,
|
|||
IN PUNICODE_STRING Name,
|
||||
IN KPROCESSOR_MODE AccessMode,
|
||||
IN PUNICODE_STRING Class,
|
||||
IN PKEY_OBJECT Parent,
|
||||
IN PCM_KEY_CONTROL_BLOCK ParentKcb,
|
||||
IN ULONG CreateOptions,
|
||||
OUT PHCELL_INDEX KeyCell,
|
||||
OUT PVOID *Object)
|
||||
|
@ -214,7 +214,7 @@ CmpDoCreateChild(IN PHHIVE Hive,
|
|||
Kcb = CmpCreateKeyControlBlock(Hive,
|
||||
*KeyCell,
|
||||
KeyNode,
|
||||
Parent->KeyControlBlock,
|
||||
ParentKcb,
|
||||
0,
|
||||
Name);
|
||||
if (!Kcb)
|
||||
|
@ -233,7 +233,6 @@ CmpDoCreateChild(IN PHHIVE Hive,
|
|||
KeyBody->SubKeyCounts = 0;
|
||||
KeyBody->SubKeys = NULL;
|
||||
KeyBody->SizeOfSubKeys = 0;
|
||||
KeyBody->ParentKey = Parent;
|
||||
InsertTailList(&CmiKeyObjectListHead, &KeyBody->KeyBodyList);
|
||||
|
||||
Quickie:
|
||||
|
@ -267,7 +266,7 @@ CmpDoCreate(IN PHHIVE Hive,
|
|||
IN KPROCESSOR_MODE AccessMode,
|
||||
IN PUNICODE_STRING Class OPTIONAL,
|
||||
IN ULONG CreateOptions,
|
||||
IN PKEY_OBJECT Parent,
|
||||
IN PCM_KEY_CONTROL_BLOCK ParentKcb,
|
||||
IN PCMHIVE OriginatingHive OPTIONAL,
|
||||
OUT PVOID *Object)
|
||||
{
|
||||
|
@ -286,7 +285,7 @@ CmpDoCreate(IN PHHIVE Hive,
|
|||
ExAcquirePushLockShared((PVOID)&((PCMHIVE)Hive)->FlusherLock);
|
||||
|
||||
/* Check if the parent is being deleted */
|
||||
if (Parent->KeyControlBlock->Delete)
|
||||
if (ParentKcb->Delete)
|
||||
{
|
||||
/* It has, quit */
|
||||
ASSERT(FALSE);
|
||||
|
@ -314,7 +313,7 @@ CmpDoCreate(IN PHHIVE Hive,
|
|||
}
|
||||
|
||||
/* Sanity check */
|
||||
ASSERT(Cell == Parent->KeyControlBlock->KeyCell);
|
||||
ASSERT(Cell == ParentKcb->KeyCell);
|
||||
|
||||
/* Get the parent type */
|
||||
ParentType = HvGetCellType(Cell);
|
||||
|
@ -327,7 +326,7 @@ CmpDoCreate(IN PHHIVE Hive,
|
|||
}
|
||||
|
||||
/* Don't allow children under symlinks */
|
||||
if (Parent->KeyControlBlock->Flags & KEY_SYM_LINK)
|
||||
if (ParentKcb->Flags & KEY_SYM_LINK)
|
||||
{
|
||||
/* Fail */
|
||||
ASSERT(FALSE);
|
||||
|
@ -346,7 +345,7 @@ CmpDoCreate(IN PHHIVE Hive,
|
|||
Name,
|
||||
AccessMode,
|
||||
Class,
|
||||
Parent,
|
||||
ParentKcb,
|
||||
CreateOptions,
|
||||
&KeyCell,
|
||||
Object);
|
||||
|
@ -371,9 +370,10 @@ CmpDoCreate(IN PHHIVE Hive,
|
|||
}
|
||||
|
||||
/* Sanity checks */
|
||||
ASSERT(KeyBody->ParentKey->KeyControlBlock->KeyCell == Cell);
|
||||
ASSERT(KeyBody->ParentKey->KeyControlBlock->KeyHive == Hive);
|
||||
ASSERT(KeyBody->ParentKey == Parent);
|
||||
ASSERT(KeyBody->KeyControlBlock->ParentKcb->KeyCell == Cell);
|
||||
ASSERT(KeyBody->KeyControlBlock->ParentKcb->KeyHive == Hive);
|
||||
ASSERT(KeyBody->KeyControlBlock->ParentKcb == ParentKcb);
|
||||
//ASSERT(KeyBody->KeyControlBlock->ParentKcb->KcbMaxNameLen == KeyNode->MaxNameLen);
|
||||
|
||||
/* Update the timestamp */
|
||||
KeQuerySystemTime(&TimeStamp);
|
||||
|
@ -384,6 +384,7 @@ CmpDoCreate(IN PHHIVE Hive,
|
|||
{
|
||||
/* Do it */
|
||||
KeyNode->MaxNameLen = Name->Length;
|
||||
KeyBody->KeyControlBlock->ParentKcb->KcbMaxNameLen = Name->Length;
|
||||
}
|
||||
|
||||
/* Check if we need toupdate class length maximum */
|
||||
|
|
|
@ -715,7 +715,6 @@ CmpCreateRegistryRoot(VOID)
|
|||
RootKey->ProcessID = PsGetCurrentProcessId();
|
||||
#else
|
||||
RtlpCreateUnicodeString(&RootKey->Name, L"Registry", NonPagedPool);
|
||||
RootKey->ParentKey = RootKey;
|
||||
RootKey->SubKeyCounts = 0;
|
||||
RootKey->SubKeys = NULL;
|
||||
RootKey->SizeOfSubKeys = 0;
|
||||
|
|
Loading…
Reference in a new issue