NtRenameKey function (winternl.h)

[This function may be changed or removed from Windows without further notice. ]

Changes the name of the specified registry key.

Syntax

__kernel_entry NTSTATUS NtRenameKey(
  [in] HANDLE          KeyHandle,
  [in] PUNICODE_STRING NewName
);

Parameters

[in] KeyHandle

A handle to the key to be renamed. The handle must be opened with the KEY_WRITE access right.

[in] NewName

A pointer to a UNICODE string that is the new name for the key.

Return value

Returns an NTSTATUS or error code. An error code of STATUS_ACCESS_DENIED indicates that the caller does not have the necessary access rights to the specified registry key or subkeys.

The forms and significance of NTSTATUS error codes are listed in the Ntstatus.h header file available in the WDK, and are described in the WDK documentation.

Remarks

This function has no associated header file. You can also use the LoadLibrary and GetProcAddress functions to dynamically link to Ntdll.dll.

The NtRenameKey function can be used to rename an entire registry subtree. The caller must have KEY_CREATE_SUB_KEY access to the parent of the specified key and DELETE access to the entire subtree being renamed.

Requirements

Requirement Value
Target Platform Windows
Header winternl.h
Library ntdll.lib
DLL ntdll.dll

See also

Registry Key Security and Access Rights