mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
f4de5ceb9e
During an open or create procedure of a registry key, the registry parser grabs a key control block (KCB) from the parser object and uses its information to do the necessary work in order to obtain a pointer to the newly created or opened registry key. However, the registry parsers faces several issues. First, we don't do subkey cache cleaning information against gathered KCBs so whenever we do a registry parse we end up with KCBs that have cache inconsistencies. Moreover we don't do any locking of whatever KCB we are grabing during a parse procedure. === PROPOSED CHANGES === * Implement CmpComputeHashValue and CmpLookInCache functions. With CmpComputeHashValue we can compute the convkey hashes of each subkey in the path name of a key so we can lock them with CmpBuildAndLockKcbArray. CmpLookInCache is a function that searches for the suitable KCB in the cache. The factors that determine if a KCB is "suitable" are: -- the currently found KCB in the hash list has the same levels as that of the given KCB from the parse object; -- The key names from the computed hash values match with the block name of the KCB; -- The currently found KCB is not deleted. The KCB will be changed if the key path name points to a partial match name in the cache. The KCB from the parse object will be used if we have a full match of remaining levels. * Add missing CMP_LOCK_HASHES_FOR_KCB flags on CmpCreateKeyControlBlock calls that create KCBs during a parse procedure. Such lock has to be preserved until we're done with the registry parsing. * On CmpDoCreateChild, preserve the exclusive lock of the KCB when we are enlisting the key body. * On CmpDoCreate, make sure that the passed parent KCB is locked exclusively and lock the hiver flusher as we don't want the flusher to kick in during a key creation on the given hive. Cleanup the subkey info when we're creating a key object. Also implement missing cleanup path codes. Furthermore, avoid key object creation if the parent KCB is protected with a read-only switch. * Soft rewrite the CmpDoOpen function, namely how we manage a direct open vs create KCB on open scenario. When a KCB is found in cache avoid touching the key node. If the symbolic link has been resolved (aka found) then lock exclusively the symbolic KCB. Otherwise just give the cached KCB to the caller. If it were for the caller to request a KCB creation, we must check the passed KCB from the parser object is locked exclusively, unlike on the case above the caller doesn't want to create a KCB because there's already one in the cache. We don't want anybody to touch our KCB while we are still toying with it during its birth. Furthermore, enlist the key body but mind the kind of lock it's been used. * On CmpCreateLinkNode, avoid creating a key object if the parent KCB is protected with a read-only switch. In addition, add missing hive flusher locks for both the target hive and its child. Cleanup the subkey information of the KCB when creating a link node, this ensures our cached KCB data remains consistent. * Do a direct open on CmpParseKey if no remaining subkey levels have been found during hash computation and cache lookup, in this case the given KCB is the block that points to the exact key. This happens when for example someone tried to call RegOpenKeyExW but submitting NULL to the lpSubKey argument parameter. CORE-10581 ROSTESTS-198 |
||
---|---|---|
.. | ||
arm | ||
i386 | ||
cmalloc.c | ||
cmapi.c | ||
cmboot.c | ||
cmcheck.c | ||
cmconfig.c | ||
cmcontrl.c | ||
cmdata.c | ||
cmdelay.c | ||
cmhook.c | ||
cmhvlist.c | ||
cminit.c | ||
cmkcbncb.c | ||
cmlazy.c | ||
cmmapvw.c | ||
cmnotify.c | ||
cmparse.c | ||
cmquota.c | ||
cmse.c | ||
cmsecach.c | ||
cmsysini.c | ||
cmvalche.c | ||
cmwraprs.c | ||
ntapi.c |