Juan Lang wrote:
I didn't find a way yet (and didn't look to hard) to make the subkeys inherit these new permissions. Otherwise I have to do this for every key.
I don't think you can if you don't actually create the key. The caller of RegCreateKeyEx is able to set the default DACL for the key, and subkeys will inherit this if they don't set their own DACL. In this case we expect that some system process is creating the key, so we have to change the DACL after the fact.
In other words, I think your function looks fine :) --Juan
Ok, I will go ahead and start creating the patches to be able to delete the registry keys after each test (if there are leftovers of course).
Currently we will have loads of Windows boxes out there that have bogus registry keys. Should I first create a cleanup routine at the start of devinst.c ?
A problem I'm seeing is that more registry keys are added after reboots. Running the tests on a clean machine adds bogus entries to HKLM/SYSTEM/CurrentControlSet and there are 'links' from ControlSet001 for example. When I delete them before a reboot the 'links' are gone as well. When I however first reboot I've seen occasions where the keys can also be found at ControlSet002 (or 003 even). Deleting the keys in CurrentControlSet now doesn't remove them from ControlSet002 (or 003).
Another approach is of course to only do the cleanup afterwards which means we will have 1 run of tests that will fail.