Alternative ways to get (TEMP path) / (Environment Variable) in windowssteemCreated with Sketch.

in Computer Programming3 years ago (edited)

tempPath.jpg

Dtube Video Link

1- GetTempPathW Api/GetTempPathA in kernel32.dll

wchar_t tmpPath[MAX_PATH];
GetTempPathW(MAX_PATH, tmpPath);

2- GetEnvironmentVariableW/GetEnvironmentVariableA in kernel32.dll

wchar_t buf[MAX_PATH];
GetEnvironmentVariableW(L"TEMP",buf, MAX_PATH);

3- _wdupenv_s/_dupenv_s

wchar_t *buf;
size_t bufLen;
errno_t tt= _wdupenv_s(&buf, &bufLen, L"TEMP");

4- RtlQueryEnvironmentVariable in ntdll

wchar_t buf[260];
size_t retLen;
RtlQueryEnvironmentVariable(NULL, L"TEMP", 4, buf, 260, &retLen);

Please Vote this post if you like it.
Please Follow me if you like my posts.
If you have any questions about this post, ask in comments.
Follow me on :
DTube
Hive

Coin Marketplace

STEEM 0.20
TRX 0.13
JST 0.030
BTC 66533.06
ETH 3491.29
USDT 1.00
SBD 2.71