mirror of
https://github.com/reactos/reactos.git
synced 2024-07-08 21:55:08 +00:00
- Don't do ObInsertObject() for a key object, but use CmpCreateHandle() instead.
- Remove some dead code from CmiConnectHive() and move freeing of the create information to a different place. svn path=/trunk/; revision=27690
This commit is contained in:
parent
0d051c196e
commit
938646d914
|
@ -322,24 +322,6 @@ NtCreateKey(OUT PHANDLE KeyHandle,
|
|||
goto Cleanup;
|
||||
}
|
||||
|
||||
Status = ObInsertObject((PVOID)KeyObject,
|
||||
NULL,
|
||||
DesiredAccess,
|
||||
0,
|
||||
NULL,
|
||||
&hKey);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
ObDereferenceObject(KeyObject);
|
||||
DPRINT1("ObInsertObject() failed!\n");
|
||||
|
||||
PostCreateKeyInfo.Object = NULL;
|
||||
PostCreateKeyInfo.Status = Status;
|
||||
CmiCallRegisteredCallbacks(RegNtPostCreateKey, &PostCreateKeyInfo);
|
||||
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
KeyObject->ParentKey = Object;
|
||||
KeyObject->RegistryHive = KeyObject->ParentKey->RegistryHive;
|
||||
KeyObject->Flags = 0;
|
||||
|
@ -398,6 +380,28 @@ NtCreateKey(OUT PHANDLE KeyHandle,
|
|||
|
||||
VERIFY_KEY_OBJECT(KeyObject);
|
||||
|
||||
Status = CmpCreateHandle(KeyObject,
|
||||
DesiredAccess,
|
||||
ObjectCreateInfo.Attributes,
|
||||
&hKey);
|
||||
|
||||
/* Free the create information */
|
||||
ObpFreeAndReleaseCapturedAttributes(OBJECT_TO_OBJECT_HEADER(KeyObject)->ObjectCreateInfo);
|
||||
OBJECT_TO_OBJECT_HEADER(KeyObject)->ObjectCreateInfo = NULL;
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT1("ObInsertObject() failed!\n");
|
||||
|
||||
PostCreateKeyInfo.Object = NULL;
|
||||
PostCreateKeyInfo.Status = Status;
|
||||
CmiCallRegisteredCallbacks(RegNtPostCreateKey, &PostCreateKeyInfo);
|
||||
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
/* Add the keep-alive reference */
|
||||
ObReferenceObject(KeyObject);
|
||||
/* Release hive lock */
|
||||
ExReleaseResourceLite(&CmpRegistryLock);
|
||||
KeLeaveCriticalRegion();
|
||||
|
|
|
@ -281,20 +281,6 @@ CmiConnectHive(IN POBJECT_ATTRIBUTES KeyObjectAttributes,
|
|||
return Status;
|
||||
}
|
||||
|
||||
#if 0
|
||||
DPRINT("Inserting Key into Object Tree\n");
|
||||
Status = ObInsertObject((PVOID)NewKey,
|
||||
NULL,
|
||||
KEY_ALL_ACCESS,
|
||||
0,
|
||||
NULL,
|
||||
NULL);
|
||||
DPRINT("Status %x\n", Status);
|
||||
#else
|
||||
/* Free the create information */
|
||||
ObpFreeAndReleaseCapturedAttributes(OBJECT_TO_OBJECT_HEADER(NewKey)->ObjectCreateInfo);
|
||||
OBJECT_TO_OBJECT_HEADER(NewKey)->ObjectCreateInfo = NULL;
|
||||
#endif
|
||||
NewKey->Flags = 0;
|
||||
NewKey->SubKeyCounts = 0;
|
||||
NewKey->SubKeys = NULL;
|
||||
|
@ -333,6 +319,10 @@ CmiConnectHive(IN POBJECT_ATTRIBUTES KeyObjectAttributes,
|
|||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
/* Free the create information */
|
||||
ObpFreeAndReleaseCapturedAttributes(OBJECT_TO_OBJECT_HEADER(NewKey)->ObjectCreateInfo);
|
||||
OBJECT_TO_OBJECT_HEADER(NewKey)->ObjectCreateInfo = NULL;
|
||||
|
||||
/* FN1 */
|
||||
ObReferenceObject (NewKey);
|
||||
|
||||
|
|
Loading…
Reference in a new issue