Click to See Complete Forum and Search --> : Rename registry key


JohnL
July 13th, 1999, 06:24 AM
How can I rename an NT registry key using the Win32 APIs without doing a tree copy of all the keys and values below it.
I want to be able to rename a whole branch, as a backup, before writing the new contents of the branch.

bimmer boy
July 13th, 1999, 07:16 AM
i am not aware of this functionality.

miked

Lothar Haensler
July 13th, 1999, 07:42 AM
try the RegReplaceKey, RegSaveKey APIs

Fabi Pantera
July 13th, 1999, 07:50 AM
Where did you find this functions? Is there any documentation for them? I try to find them in the MSDN, but I can't find nothing.
Thanks for your time.
Regards,
Faby

Lothar Haensler
July 13th, 1999, 07:52 AM
of course MSDN!
these are pretty old suckers.
RegReplaceKey requires NT 3.5...

Lothar Haensler
July 13th, 1999, 07:54 AM
and...
do a DUMPBIN /exports of advapi32.dll.
They really exist :-)

Fabi Pantera
July 13th, 1999, 08:18 AM
Thanks, I made the dump, I saw that it exists. I also find the .h file...but in the MSDN I still can't find them. I think they forgot to include them.
Regards,
Faby

JohnL
July 13th, 1999, 09:50 AM
The RegReplaceKey and RegSaveKey APIs backup and restore registry subtrees from files which may be what I have to do. What I would like to do is open a key using RegOpenKeyEx and rename the key that was opened.

e.g. Open the key \\HKEY_LOCAL_MACHINE\Software\Company\ProgData and call an API to rename the opened key to ....\ProgData_OLD.

The NT regedit program allows this, right click on a registry key and select rename. Internally it may copy the whole subtree to a new tree with the new name then delete the old subtree. I am beginning to think this is the way it must work.