RtlSetEnvironmentVar - NtDoc

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

// private
/**
 * The RtlSetEnvironmentVar routine sets or removes an environment variable within an environment block, using counted strings.
 *
 * \param Environment An optional pointer to the environment block to modify; NULL uses the current environment.
 * \param Name The name of the environment variable.
 * \param NameLength The length, in characters, of Name.
 * \param Value The value to set, or NULL to remove the variable.
 * \param ValueLength The length, in characters, of Value.
 * \return NTSTATUS Successful or errant status.
 * \remarks NULL Value deletes the variable; a non-NULL value with zero counted length sets an empty value. Mutation can replace the allocation and update *Environment, invalidating cached interior pointers. NULL Environment selects process-global state; use a private block for isolated edits. Raw Var lengths are WCHAR counts, while UNICODE_STRING lengths are bytes.
 */
NTSYSAPI
NTSTATUS
NTAPI
RtlSetEnvironmentVar(
    _Inout_opt_ PVOID *Environment,
    _In_reads_(NameLength) PCWSTR Name,
    _In_ SIZE_T NameLength,
    _In_reads_opt_(ValueLength) PCWSTR Value,
    _In_opt_ SIZE_T ValueLength
    );

#endif

View code on GitHub

NtDoc

No description available.