NtSetInformationKey function (winternl.h)

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

Sets information for the specified registry key.

Syntax

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

Parameters

[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.

Remarks

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

Requirements

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

See also

Registry Key Security and Access Rights