NtSetInformationKey function

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

Sets information for the specified registry key.


NTSTATUS NtSetInformationKey(
  _In_ HANDLE                    KeyHandle,
  _In_ KEY_SET_INFORMATION_CLASS KeySetInformationClass,
  _In_ PVOID                     KeySetInformation,
  _In_ ULONG                     KeySetInformationLength


KeyHandle [in]

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

KeySetInformationClass [in]

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

KeySetInformation [in]

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

KeySetInformationLength [in]

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.


The associated import library, Ntdll.lib, is available in the WDK. You can also use the LoadLibrary and GetProcAddress functions to dynamically link to Ntdll.dll.






See also

Registry Key Security and Access Rights