Hello. I am writing a simple backup app that uses RegSaveKey to save a portion of the registry. I then want to return it using RegReplaceKey. However, when I use RegReplaceKey on the exported file from RegSaveKey and restart my windows 2k pro machine, windows will not boot because it cannot load the file C:\WinNT\config\system. The only way I was able to solve the problem was by copying the system backup from repair.
I tried to return the key using RegRestoreKey. This does work successfully (the changes are in place and there is no corruption of any sort after a restart). So it appears that the file exported by RegSaveKey works fine. I want to use RegReplaceKey because I intend on backing up crucial running areas of the registry (like specific parts of current control set), and I think those are most logically replaced when there is nothing actively running.
Does anyone know why RegReplaceKey would be causing the corruption that keeps my computer from booting when RegRestoreKey works fine? Are there any alternatives to RegReplaceKey that replace the hive on shutdown when it is no longer being accessed? RegRestoreKey has the REG_REFRESH_HIVE flag which sounds as though it might do the same thing, but the wording seems too vague to know for certain. Also it says the TCB privilege is necessary, and I do not know of a way to acquire that privilege in my administrator-mode application.
Thanks for any help you can provide.
Have you tried it on another machine? Perhaps your problem is local to your own machine. I'd test it myself, but I do not have access to an imaged version of windows 2k.