Author: fireball
Date: Mon Jul 16 01:35:16 2007
New Revision: 27690
URL:
http://svn.reactos.org/svn/reactos?rev=27690&view=rev
Log:
- 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.
Modified:
trunk/reactos/ntoskrnl/cm/ntfunc.c
trunk/reactos/ntoskrnl/cm/registry.c
Modified: trunk/reactos/ntoskrnl/cm/ntfunc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cm/ntfunc.c?rev=2…
==============================================================================
--- trunk/reactos/ntoskrnl/cm/ntfunc.c (original)
+++ trunk/reactos/ntoskrnl/cm/ntfunc.c Mon Jul 16 01:35:16 2007
@@ -322,24 +322,6 @@
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 @@
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();
Modified: trunk/reactos/ntoskrnl/cm/registry.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cm/registry.c?rev…
==============================================================================
--- trunk/reactos/ntoskrnl/cm/registry.c (original)
+++ trunk/reactos/ntoskrnl/cm/registry.c Mon Jul 16 01:35:16 2007
@@ -281,20 +281,6 @@
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;
@@ -332,6 +318,10 @@
ObDereferenceObject (ParentKey);
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);