Registry - How to rename a registry key using C ++?

How to rename a key in the registry using C ++?

I want to rename the key "Myapp \ Version1" to "Myapp \ Version2".

I do not see any functions in MSDN about renaming keys in the registry.

+3
source share
5 answers

There is no rename function in old versions of windows, you need to copy / delete to your own AFAIK.

+4
source

If your application requires Vista or a later version of Windows, you can use RegCopyTree (), followed by RegDeleteTree ().

+7
source

, , , - , ...

MSDN - RegRenameKey(hKey, keyName, newKeyName), Vista .

+2

:

NTRenameKey() - API .

, Pavel RegRenameKey(), randomsock, ( ++ ) PInvoke .

[DllImport("advapi32")]
public static extern int RegRenameKey(
     SafeRegistryHandle hKey,
     [MarshalAs(UnmanagedType.LPWStr)] string oldname,
     [MarshalAs(UnmanagedType.LPWStr)] string newname);
+2

Source: https://habr.com/ru/post/1719214/


All Articles