[NTOS:CM] Remove orphaned KCBs of keys during normal hive unload 6649/head
authorGeorge Bișoc <george.bisoc@reactos.org>
Sat, 23 Mar 2024 19:40:56 +0000 (20:40 +0100)
committerGeorge Bișoc <george.bisoc@reactos.org>
Sun, 24 Mar 2024 18:03:47 +0000 (19:03 +0100)
commit7dd8a30cf957788db0d80352c9e3bf0f6eae9307
tree003ed44751c4269b917dc7805c95be38e17e2aa1
parentf1d2a4485975004e5ff1c666ed2d8ebefe5282b7
[NTOS:CM] Remove orphaned KCBs of keys during normal hive unload

A hive whose KCBs have a reference count of 0, meaning nobody is using these keys anymore, will not get removed from the cache table.
As a result during a normal hive unloading operation you will get orphaned KCBs which results in an unload failure.

This is wrong, because this is what a normal hive unloading is supposed to do. What it cannot do of course is that it cannot
scramble the references of opened keys by the users who use the Registry, as it is the job of force unloading mechanism to do that.

Also remove a misleading debug print. Force unloading works as intended by scrambling the references of keys and marking the KCB for deletion,
which is what how a force unload works. Namely Windows does exactly that.

CORE-10705
ntoskrnl/config/cmapi.c