[NTOSKRNL:CONFIG]
authorEric Kohl <eric.kohl@reactos.org>
Sat, 16 Aug 2014 08:56:48 +0000 (08:56 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Sat, 16 Aug 2014 08:56:48 +0000 (08:56 +0000)
CmShutdownSystem: Close all hive files after flushing the hives.

svn path=/trunk/; revision=63897

reactos/ntoskrnl/config/cmsysini.c

index f41d27b..a191797 100644 (file)
@@ -2043,12 +2043,35 @@ VOID
 NTAPI
 CmShutdownSystem(VOID)
 {
+    PLIST_ENTRY ListEntry;
+    PCMHIVE Hive;
+    ULONG i;
+
     /* Kill the workers */
     if (!CmFirstTime) CmpShutdownWorkers();
 
     /* Flush all hives */
     CmpLockRegistryExclusive();
     CmpDoFlushAll(TRUE);
+
+    /* Close all hive files */
+    ListEntry = CmpHiveListHead.Flink;
+    while (ListEntry != &CmpHiveListHead)
+    {
+        Hive = CONTAINING_RECORD(ListEntry, CMHIVE, HiveList);
+
+        for (i = 0; i < HFILE_TYPE_MAX; i++)
+        {
+            if (Hive->FileHandles[i] != NULL)
+            {
+                ZwClose(Hive->FileHandles[i]);
+                Hive->FileHandles[i] = NULL;
+            }
+        }
+
+        ListEntry = ListEntry->Flink;
+    }
+
     CmpUnlockRegistry();
 }