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