mirror of
https://github.com/reactos/reactos.git
synced 2025-06-10 12:24:48 +00:00
[KERNEL32]
Properly fix GetEnvironmentVariableW and set error in case of RtlInitUnicodeStringEx failure svn path=/trunk/; revision=54459
This commit is contained in:
parent
c1f9c89d62
commit
37bc0a5a08
1 changed files with 18 additions and 14 deletions
|
@ -182,10 +182,15 @@ GetEnvironmentVariableW(IN LPCWSTR lpName,
|
|||
UniSize = UNICODE_STRING_MAX_BYTES - sizeof(UNICODE_NULL);
|
||||
}
|
||||
|
||||
RtlInitEmptyUnicodeString(&VarValue, lpBuffer, UniSize);
|
||||
Status = RtlInitUnicodeStringEx(&VarName, lpName);
|
||||
if (NT_SUCCESS(Status))
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
BaseSetLastNTError(Status);
|
||||
return 0;
|
||||
}
|
||||
|
||||
RtlInitEmptyUnicodeString(&VarValue, lpBuffer, UniSize);
|
||||
|
||||
Status = RtlQueryEnvironmentVariable_U(NULL, &VarName, &VarValue);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
|
@ -198,7 +203,6 @@ GetEnvironmentVariableW(IN LPCWSTR lpName,
|
|||
}
|
||||
|
||||
lpBuffer[VarValue.Length / sizeof(WCHAR)] = UNICODE_NULL;
|
||||
}
|
||||
|
||||
return (VarValue.Length / sizeof(WCHAR));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue