GetEnvironmentVariable

E724277

GetEnvironmentVariable is a Windows API function that retrieves the value of a specified environment variable from the calling process’s environment block.

All labels observed (1)

Label Occurrences
GetEnvironmentVariable canonical 2

How this entity was disambiguated

Statements (48)

Predicate Object
instanceOf Windows API function
environment variable function
availableOn Windows 10
Windows 11
Windows 2000
Windows 7
Windows 8
Windows NT family
linked to: Windows NT

Windows Vista
Windows XP
belongsToLibrary Win32 API
bufferSizeUnit characters
callingConvention stdcall
canBeUsedFrom .NET via PInvoke
C++
category process and environment management API
characterSetVariants GetEnvironmentVariableA
GetEnvironmentVariableW
declaredInHeader windows.h
definedInLibrary Kernel32.dll
linked to: Kernel32
documentationSite Microsoft Learn
errorCode ERROR_ENVVAR_NOT_FOUND
ERROR_INSUFFICIENT_BUFFER
errorReporting GetLastError
headerLanguage C
includesNullTerminatorInCount true
introducedIn early versions of Win32
linkerOption link against Kernel32.lib
namespace global Win32 API namespace
operatingSystem Windows
parameter DWORD nSize
LPCSTR lpName
LPCWSTR lpName (Unicode)
LPSTR lpBuffer
LPWSTR lpBuffer (Unicode)
readsFrom calling process environment block
relatedFunction ExpandEnvironmentStrings
SetEnvironmentVariable
requires Windows desktop apps
returns DWORD
returnValueMeaning 0 if the environment variable does not exist or on error
number of characters stored in the buffer on success
required buffer size if buffer is too small
scope process-level environment variables
supportsANSI true
supportsUnicode true
threadSafety not inherently thread-safe for concurrent environment modification
usage retrieve value of a named environment variable

How these facts were elicited

Referenced by (2)

Full triples — surface form annotated when it differs from this entity's canonical label.

Kernel32 exportsFunction GetEnvironmentVariable
SetEnvironmentVariable relatedFunction GetEnvironmentVariable