Fixed GetEnvironmentVariableX win32 call to ConvertFromUnicode
This commit is contained in:
parent
850e0b107f
commit
952068145e
@ -665,13 +665,14 @@ DWORD GetEnvironmentVariableX(const char* lpName, char* lpBuffer, DWORD nSize)
|
||||
{
|
||||
char lpBufferMaxA[WINPR_MAX_ENVIRONMENT_LENGTH] = { 0 };
|
||||
WCHAR lpBufferMaxW[WINPR_MAX_ENVIRONMENT_LENGTH] = { 0 };
|
||||
LPSTR lpTmpBuffer = lpBufferMaxA;
|
||||
|
||||
nSizeW = ARRAYSIZE(lpBufferMaxW);
|
||||
|
||||
result = GetEnvironmentVariableW(lpNameW, lpBufferMaxW, nSizeW);
|
||||
|
||||
status = ConvertFromUnicode(CP_UTF8, 0, lpBufferMaxW, _wcsnlen(lpBufferMaxW, nSizeW),
|
||||
&lpBufferMaxA, sizeof(lpBufferMaxA), NULL, NULL);
|
||||
&lpTmpBuffer, sizeof(lpBufferMaxA), NULL, NULL);
|
||||
|
||||
if (status > 0)
|
||||
result = (DWORD)status;
|
||||
|
Loading…
Reference in New Issue
Block a user