Author: ekohl
Date: Mon Jun 29 18:26:56 2015
New Revision: 68313
URL:
http://svn.reactos.org/svn/reactos?rev=68313&view=rev
Log:
[NTOSKRNL]
Add CmpDestroySecurityCache() and CmpDestroyHiveViewList() stubs and call them in
CmpDestroyHive and CmUnloadKey().
CORE-6492 #resolve #comment Thank you Hermes! This is exactly what I needed!
Modified:
trunk/reactos/ntoskrnl/config/cmapi.c
trunk/reactos/ntoskrnl/config/cminit.c
trunk/reactos/ntoskrnl/config/cmmapvw.c
trunk/reactos/ntoskrnl/config/cmsecach.c
trunk/reactos/ntoskrnl/include/internal/cm.h
Modified: trunk/reactos/ntoskrnl/config/cmapi.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cmapi.c?re…
==============================================================================
--- trunk/reactos/ntoskrnl/config/cmapi.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/config/cmapi.c [iso-8859-1] Mon Jun 29 18:26:56 2015
@@ -2241,7 +2241,11 @@
/* Remove the hive from the hive file list */
CmpRemoveFromHiveFileList(CmHive);
- /* FIXME: More cleanup */
+ /* Destroy the security descriptor cache */
+ CmpDestroySecurityCache(CmHive);
+
+ /* Destroy the view list */
+ CmpDestroyHiveViewList(CmHive);
/* Free the hive storage */
HvFree(Hive);
Modified: trunk/reactos/ntoskrnl/config/cminit.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cminit.c?r…
==============================================================================
--- trunk/reactos/ntoskrnl/config/cminit.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/config/cminit.c [iso-8859-1] Mon Jun 29 18:26:56 2015
@@ -256,6 +256,12 @@
/* Delete the view lock */
ExFreePoolWithTag(CmHive->ViewLock, TAG_CM);
+
+ /* Destroy the security descriptor cache */
+ CmpDestroySecurityCache(CmHive);
+
+ /* Destroy the view list */
+ CmpDestroyHiveViewList(CmHive);
/* Free the hive storage */
HvFree(&CmHive->Hive);
Modified: trunk/reactos/ntoskrnl/config/cmmapvw.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cmmapvw.c?…
==============================================================================
--- trunk/reactos/ntoskrnl/config/cmmapvw.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/config/cmmapvw.c [iso-8859-1] Mon Jun 29 18:26:56 2015
@@ -29,3 +29,54 @@
Hive->PinnedViews = 0;
Hive->UseCount = 0;
}
+
+VOID
+NTAPI
+CmpDestroyHiveViewList(IN PCMHIVE Hive)
+{
+ PCM_VIEW_OF_FILE CmView;
+ PLIST_ENTRY EntryList;
+
+ /* Do NOT destroy the views of read-only hives */
+ ASSERT(Hive->Hive.ReadOnly == FALSE);
+
+ /* Free all the views inside the Pinned View List */
+ EntryList = RemoveHeadList(&Hive->PinViewListHead);
+ while (EntryList != &Hive->PinViewListHead)
+ {
+ CmView = CONTAINING_RECORD(EntryList, CM_VIEW_OF_FILE, PinViewList);
+
+ /* FIXME: Unmap the view if it is mapped */
+
+ ExFreePool(CmView);
+
+ Hive->PinnedViews--;
+
+ EntryList = RemoveHeadList(&Hive->PinViewListHead);
+ }
+
+ /* The Pinned View List should be empty */
+ ASSERT(IsListEmpty(&Hive->PinViewListHead) == TRUE);
+ ASSERT(Hive->PinnedViews == 0);
+
+ /* Now, free all the views inside the LRU View List */
+ EntryList = RemoveHeadList(&Hive->LRUViewListHead);
+ while (EntryList != &Hive->LRUViewListHead)
+ {
+ CmView = CONTAINING_RECORD(EntryList, CM_VIEW_OF_FILE, LRUViewList);
+
+ /* FIXME: Unmap the view if it is mapped */
+
+ ExFreePool(CmView);
+
+ Hive->MappedViews--;
+
+ EntryList = RemoveHeadList(&Hive->LRUViewListHead);
+ }
+
+ /* The LRU View List should be empty */
+ ASSERT(IsListEmpty(&Hive->LRUViewListHead) == TRUE);
+ ASSERT(Hive->MappedViews == 0);
+}
+
+/* EOF */
Modified: trunk/reactos/ntoskrnl/config/cmsecach.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cmsecach.c…
==============================================================================
--- trunk/reactos/ntoskrnl/config/cmsecach.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/config/cmsecach.c [iso-8859-1] Mon Jun 29 18:26:56 2015
@@ -35,3 +35,18 @@
InitializeListHead(&Hive->SecurityHash[i]);
}
}
+
+VOID
+NTAPI
+CmpDestroySecurityCache(IN PCMHIVE Hive)
+{
+ /* FIXME: clean Hive->SecurityHash and/or Hive->SecurityCache */
+
+ /* Reset data */
+ Hive->SecurityCount = 0;
+ Hive->SecurityCacheSize = 0;
+ Hive->SecurityHitHint = -1;
+ Hive->SecurityCache = NULL;
+}
+
+/* EOF */
Modified: trunk/reactos/ntoskrnl/include/internal/cm.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/cm.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/cm.h [iso-8859-1] Mon Jun 29 18:26:56 2015
@@ -552,12 +552,24 @@
IN PCMHIVE Hive
);
+VOID
+NTAPI
+CmpDestroyHiveViewList(
+ IN PCMHIVE Hive
+);
+
//
// Security Cache Functions
//
VOID
NTAPI
CmpInitSecurityCache(
+ IN PCMHIVE Hive
+);
+
+VOID
+NTAPI
+CmpDestroySecurityCache(
IN PCMHIVE Hive
);