#ifndef _NTREGAPI_H
/**
* Renames a registry key.
*
* \param[in] KeyHandle A handle to the key to be renamed.
* \param[in] NewName A pointer to a UNICODE_STRING structure that specifies the new name of the key.
* \return NTSTATUS Successful or errant status.
*/
NTSYSCALLAPI
NTSTATUS
NTAPI
NtRenameKey(
_In_ HANDLE KeyHandle,
_In_ PCUNICODE_STRING NewName
);
View code on GitHub#ifndef _NTZWAPI_H
NTSYSCALLAPI
NTSTATUS
NTAPI
ZwRenameKey(
_In_ HANDLE KeyHandle,
_In_ PCUNICODE_STRING NewName
);
View code on GitHub// winternl.h
__kernel_entry NTSTATUS NtRenameKey(
[in] HANDLE KeyHandle,
[in] PUNICODE_STRING NewName
);
View the official Win32 API referenceThis function is documented in Windows SDK.
[This function may be changed or removed from Windows without further notice. ]
Changes the name of the specified registry key.
KeyHandle [in]A handle to the key to be renamed. The handle must be opened with the KEY_WRITE access right.
NewName [in]A pointer to a UNICODE string that is the new name for the key.
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.
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.
Registry Key Security and Access Rights