Hello,
I have a driver that starts at SERVICE_SYSTEM_START (1) with a group of
“Base” and a tag value that puts it first in the Base group.
At the point that the driver loads, only the HKLM\SYSTEM portion of the
registry is available. I need to modify other portions of the registry so
I first load the remaining hives (not all of them, just the ones I need). I
determine the paths of the on-disk hives and the keys upon which to mount
them by enumerating HKLM\SYSTEM\CurrentControlSet\Control\hivelist. Each
hive is loaded by calling ZwLoadKey().
After these steps I can query and modify the registry without any errors. I
then unload the hives by calling ZwUnloadKey() on each one and the system
continues to boot. A brief instant later the system reloads the hives and
the GUI comes up (If I don’t unload the hives, the system crashes when it
gets to this step).
Everything is perfect for read-only operations, but all of my sets, creates
and deletes, which all returned STATUS_SUCCESS, are missing once the system
finishes booting. I tried calling ZwFlushKey() after each update and that
didn’t change things. I also tried using ZwLoadKey2() instead of
ZwLoadKey() and specifying the REG_NO_LAZY_FLUSH flag, but again, the
results were the same.
Is there some other magic flag (or syscall) that I’m missing or is it the
time at which I’m trying to do this that’s causing the problem?
Any insight would be great!
Thanks,
Jeff