GetEnvironmentStringsW function (processenv.h)
Retrieves the environment variables for the current process.
If the function succeeds, the return value is a pointer to the environment block of the current process.
If the function fails, the return value is NULL.
The GetEnvironmentStrings function returns a pointer to a block of memory that contains the environment variables of the calling process (both the system and the user environment variables). Each environment block contains the environment variables in the following format:
The name of an environment variable cannot include an equal sign (=).
When the block returned by GetEnvironmentStrings is no longer needed, it should be freed by calling the FreeEnvironmentStrings function.
Note that the ANSI version of this function, GetEnvironmentStringsA, returns OEM characters.
For an example, see Changing Environment Variables.
The processenv.h header defines GetEnvironmentStrings as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.
|Minimum supported client||Windows XP [desktop apps | UWP apps]|
|Minimum supported server||Windows Server 2003 [desktop apps | UWP apps]|
|Header||processenv.h (include Windows Server 2003, Windows Vista, Windows 7, Windows Server 2008 Windows Server 2008 R2, Windows.h)|