mirror of
https://github.com/reactos/reactos.git
synced 2024-11-23 11:33:31 +08:00
[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
This commit is contained in:
parent
f1d2a44859
commit
7dd8a30cf9
@ -2242,7 +2242,7 @@ CmUnloadKey(IN PCM_KEY_CONTROL_BLOCK Kcb,
|
||||
{
|
||||
if (Flags != REG_FORCE_UNLOAD)
|
||||
{
|
||||
if (CmpEnumerateOpenSubKeys(Kcb, FALSE, FALSE, FALSE) != 0)
|
||||
if (CmpEnumerateOpenSubKeys(Kcb, FALSE, TRUE, FALSE) != 0)
|
||||
{
|
||||
/* There are open subkeys but we don't force hive unloading, fail */
|
||||
Hive->HiveFlags &= ~HIVE_IS_UNLOADING;
|
||||
@ -2251,7 +2251,6 @@ CmUnloadKey(IN PCM_KEY_CONTROL_BLOCK Kcb,
|
||||
}
|
||||
else
|
||||
{
|
||||
DPRINT1("CmUnloadKey: Force unloading is HALF-IMPLEMENTED, expect dangling KCBs problems!\n");
|
||||
if (CmpEnumerateOpenSubKeys(Kcb, TRUE, TRUE, TRUE) != 0)
|
||||
{
|
||||
/* There are open subkeys that we cannot force to unload, fail */
|
||||
|
Loading…
Reference in New Issue
Block a user