RtlWriteRegistryValue

NTSTATUS
    RtlWriteRegistryValue(

        IN ULONG  RelativeTo,
        IN PWSTR  Path,
        IN PWSTR  ValueName,
        IN ULONG  ValueType,
        IN PVOID  ValueData,
        IN ULONG  ValueLength
        );

RtlWriteRegistryValue writes caller-supplied data into the registry along the specified relative path at the given value name.

Parameters

RelativeTo
Specifies whether Path is an absolute registry path or is relative to a predefined 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.

RTL_REGISTRY_OPTIONAL

Specifies that the key referenced by this parameter and the Path parameter are optional.

RTL_REGISTRY_HANDLE

 

Specifies that the Path parameter is actually a registry handle to use. This value is optional.

Path
Points to either an absolute registry path or a path relative to the known location specified by the RelativeTo parameter. If the RTL_REGISTRY_HANDLE flag is specified, this parameter is a registry handle for an already opened key to be used directly.
ValueName
Points to the name of a subkey or value entry to be written into the registry.
ValueType
Points to the type of value, identified by the ValueName parameter, to be placed in the registry.
ValueData
Points to the name of a subkey or values for its value entries (or both) to be written into the registry.
ValueLength
Specifies the number of bytes of ValueData to be written into the registry.

Return Value

RtlWriteRegistryValue returns the status of the operation.

Comments

Callers of RtlWriteRegistryValue must be running at IRQL PASSIVE_LEVEL.

See Also

RtlCheckRegistryKey, RtlCreateRegistryKey, RtlDeleteRegistryValue, RtlQueryRegistryValues, ZwOpenKey