NtSetInformationKey function (winternl.h)

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

Sets information for the specified registry key.


__kernel_entry NTSTATUS NtSetInformationKey(
  [in] HANDLE                    KeyHandle,
  [in] KEY_SET_INFORMATION_CLASS KeySetInformationClass,
  [in] PVOID                     KeySetInformation,
  [in] ULONG                     KeySetInformationLength


[in] KeyHandle

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

[in] KeySetInformationClass

A KEY_SET_INFORMATION_CLASS value that specifies the kind of information to be set.

[in] KeySetInformation

A pointer to the buffer that contains the information to be set. The format of this buffer is determined by the KeySetInformationClass parameter.

[in] KeySetInformationLength

The length of the buffer specified by the KeySetInformation parameter, in bytes.

Return value

Returns an NTSTATUS or error code. An error code of STATUS_INFO_LENGTH_MISMATCH indicates that the KeySetInformationLength parameter is the wrong length for the information class specified by the KeySetInformationClass parameter.

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.


You can also use the LoadLibrary and GetProcAddress functions to dynamically link to Ntdll.dll.


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

See also

Registry Key Security and Access Rights