GetEnvironmentVariable
E724277
GetEnvironmentVariable is a Windows API function that retrieves the value of a specified environment variable from the calling process’s environment block.
Statements (48)
| Predicate | Object |
|---|---|
| instanceOf |
Windows API function
ⓘ
environment variable function ⓘ |
| availableOn |
Windows 10
NERFINISHED
ⓘ
Windows 11 NERFINISHED ⓘ Windows 2000 NERFINISHED ⓘ Windows 7 NERFINISHED ⓘ Windows 8 NERFINISHED ⓘ Windows NT family NERFINISHED ⓘ Windows Vista NERFINISHED ⓘ Windows XP NERFINISHED ⓘ |
| belongsToLibrary | Win32 API NERFINISHED ⓘ |
| bufferSizeUnit | characters ⓘ |
| callingConvention | stdcall ⓘ |
| canBeUsedFrom |
.NET via PInvoke
ⓘ
C++ NERFINISHED ⓘ |
| category | process and environment management API ⓘ |
| characterSetVariants |
GetEnvironmentVariableA
ⓘ
GetEnvironmentVariableW ⓘ |
| declaredInHeader | windows.h ⓘ |
| definedInLibrary | Kernel32.dll NERFINISHED ⓘ |
| documentationSite | Microsoft Learn NERFINISHED ⓘ |
| errorCode |
ERROR_ENVVAR_NOT_FOUND
ⓘ
ERROR_INSUFFICIENT_BUFFER NERFINISHED ⓘ |
| 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 ⓘ |
Referenced by (1)
Full triples — surface form annotated when it differs from this entity's canonical label.