[NTOSKRNL]
[reactos.git] / reactos / ntoskrnl / config / cminit.c
index 897e584..8689e8e 100644 (file)
@@ -238,6 +238,28 @@ CmpInitializeHive(OUT PCMHIVE *RegistryHive,
     return STATUS_SUCCESS;
 }
 
+NTSTATUS
+NTAPI
+CmpDestroyHive(IN PCMHIVE CmHive)
+{
+    /* Remove the hive from the list */
+    ExAcquirePushLockExclusive(&CmpHiveListHeadLock);
+    RemoveEntryList(&CmHive->HiveList);
+    ExReleasePushLock(&CmpHiveListHeadLock);
+
+    /* Delete the flusher lock */
+    ExDeleteResourceLite(CmHive->FlusherLock);
+    ExFreePoolWithTag(CmHive->FlusherLock, TAG_CM);
+
+    /* Delete the view lock */
+    ExFreePoolWithTag(CmHive->ViewLock, TAG_CM);
+
+    /* Free the hive */
+    HvFree(&CmHive->Hive);
+
+    return STATUS_SUCCESS;
+}
+
 NTSTATUS
 NTAPI
 CmpOpenHiveFiles(IN PCUNICODE_STRING BaseName,