NtSetInformationKey - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
#ifndef _NTREGAPI_H

/**
 * Sets information for a registry key.
 *
 * \param[in] KeyHandle A handle to the key to be modified.
 * \param[in] KeySetInformationClass The type of information to be set.
 * \param[in] KeySetInformation A pointer to a buffer that contains the key information.
 * \param[in] KeySetInformationLength The size of the buffer.
 * \return NTSTATUS Successful or errant status.
 */
NTSYSCALLAPI
NTSTATUS
NTAPI
NtSetInformationKey(
    _In_ HANDLE KeyHandle,
    _In_ KEY_SET_INFORMATION_CLASS KeySetInformationClass,
    _In_reads_bytes_(KeySetInformationLength) PVOID KeySetInformation,
    _In_ ULONG KeySetInformationLength
    );

#endif

View code on GitHub
#ifndef _NTZWAPI_H

NTSYSCALLAPI
NTSTATUS
NTAPI
ZwSetInformationKey(
    _In_ HANDLE KeyHandle,
    _In_ KEY_SET_INFORMATION_CLASS KeySetInformationClass,
    _In_reads_bytes_(KeySetInformationLength) PVOID KeySetInformation,
    _In_ ULONG KeySetInformationLength
    );

#endif

View code on GitHub
// winternl.h

__kernel_entry NTSTATUS NtSetInformationKey(
  [in] HANDLE                    KeyHandle,
  [in] KEY_SET_INFORMATION_CLASS KeySetInformationClass,
  [in] PVOID                     KeySetInformation,
  [in] ULONG                     KeySetInformationLength
);
View the official Win32 API reference

NtDoc

No description available.

Win32 API reference (nf-winternl-ntsetinformationkey)

NtSetInformationKey function

Description

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

Sets information for the specified registry key.

Parameters

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.

Remarks

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

See also

Registry Key Security and Access Rights


NTinternals.net (undocumented.ntinternals.net)

This function is documented in Windows SDK.


InformationClass

See <ntddk.h> for possible values. Currently only KEY_WRITE_TIME_INFORMATION is supported.

KeyInformationData

See <ntddk.h> for detailed structure KEY_WRITE_TIME_INFORMATION.

See also