KEY_NAME_INFORMATION - NtDoc

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

/**
 * Returns a counted native registry path, rather than the final component used by KEY_BASIC_INFORMATION. The
 * path is not an HKEY_* alias or a NUL-terminated string. The prefix is 4 bytes; the complete record needs 4
 * + NameLength bytes. NameLength remains the full required name length when only a prefix is returned.
 * Querying this class does not require KEY_QUERY_VALUE, but a zero-access handle is rejected. Virtualization
 * can affect the path shown.
 * \sa https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/ntddk/ns-ntddk-_key_name_information
 */
typedef struct _KEY_NAME_INFORMATION
{
    ULONG NameLength;                               // The size, in bytes, of the key name string in the Name array.
    _Field_size_bytes_(NameLength) WCHAR Name[1];   // The name of the registry key. This string is not null-terminated.
} KEY_NAME_INFORMATION, *PKEY_NAME_INFORMATION;

#endif

View code on GitHub
// ntddk.h

typedef struct _KEY_NAME_INFORMATION {
  ULONG NameLength;
  WCHAR Name[1];
} KEY_NAME_INFORMATION, *PKEY_NAME_INFORMATION;
View the official Windows Driver Kit DDI reference

NtDoc

This structure is documented in Windows Driver Kit.

Windows Driver Kit DDI reference (ns-ntddk-_key_name_information)

_KEY_NAME_INFORMATION structure

Description

The KEY_NAME_INFORMATION structure holds the name and name length of the key.

Members

NameLength

The size, in bytes, of the key name string in the Name array.

Name

An array of wide characters that contains the name of the key. This character string is not null-terminated. Only the first element in this array is included in the KEY_NAME_INFORMATION structure definition. The storage for the remaining elements in the array immediately follows this element.

Remarks

The ZwQueryKey routine uses the KEY_NAME_INFORMATION structure to contain the registry key name. When the KeyInformationClass parameter of this routine is KeyNameInformation, the KeyInformation buffer is treated as a KEY_NAME_INFORMATION structure. For more information about the KeyNameInformation enumeration value, see KEY_INFORMATION_CLASS.

See also

KEY_BASIC_INFORMATION

KEY_CACHED_INFORMATION

KEY_INFORMATION_CLASS

KEY_NODE_INFORMATION

KEY_VIRTUALIZATION_INFORMATION

ZwQueryKey