#ifndef _NTRTL_H
/**
* The RtlCreateRegistryKey routine creates a registry key relative to one of the predefined RTL_REGISTRY_ locations.
*
* \param RelativeTo A flag that specifies the base location the Path is relative to.
* \param Path A pointer to the null-terminated path of the key to create.
* \return NTSTATUS Successful or errant status.
* \sa https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/nf-wdm-rtlcreateregistrykey
*/
NTSYSAPI
NTSTATUS
NTAPI
RtlCreateRegistryKey(
_In_ ULONG RelativeTo,
_In_ PCWSTR Path
);
View code on GitHub// wdm.h
NTSYSAPI NTSTATUS RtlCreateRegistryKey(
[in] ULONG RelativeTo,
[in] PCWSTR Path
);
View the official Windows Driver Kit DDI referenceThis function is documented in Windows Driver Kit.
The RtlCreateRegistryKey routine adds a key object in the registry along a given relative path.
RelativeTo [in]Specifies whether Path is an absolute registry path or is relative to a predefined key path as one of the following.
| Value | Meaning |
|---|---|
| RTL_REGISTRY_ABSOLUTE | Path is an absolute registry path. |
| RTL_REGISTRY_SERVICES | Path is relative to \Registry\Machine\System\CurrentControlSet\Services. |
| RTL_REGISTRY_CONTROL | Path is relative to \Registry\Machine\System\CurrentControlSet\Control. |
| RTL_REGISTRY_WINDOWS_NT | Path is relative to \Registry\Machine\Software\Microsoft\Windows NT\CurrentVersion. |
| RTL_REGISTRY_DEVICEMAP | Path is relative to \Registry\Machine\Hardware\DeviceMap. |
| RTL_REGISTRY_USER | Path is relative to \Registry\User\CurrentUser. (For a system process, this is \Users.Default.) |
Path [in]Specifies the registry path according to the RelativeTo value.
RtlCreateRegistryKey returns STATUS_SUCCESS if the key is created.
RtlCreateRegistryKey creates only the keys that you specify. It does not create missing keys in the path to the specified key. If any keys in the path are missing, the call will fail. To ensure that all keys in the path exist, you must call RtlCreateRegistryKey once for each key in the path.