mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
Fixed the return value in GetEnvironmentVariable().
svn path=/trunk/; revision=2728
This commit is contained in:
parent
3e432831b1
commit
9a02e2c18b
1 changed files with 21 additions and 3 deletions
|
@ -1,4 +1,4 @@
|
|||
/* $Id: env.c,v 1.11 2000/07/01 17:07:00 ea Exp $
|
||||
/* $Id: env.c,v 1.12 2002/03/17 17:56:57 hbirr Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
|
@ -70,7 +70,14 @@ GetEnvironmentVariableA (
|
|||
RtlFreeUnicodeString (&VarNameU);
|
||||
|
||||
SetLastErrorByStatus (Status);
|
||||
return 0;
|
||||
if (Status == STATUS_BUFFER_TOO_SMALL)
|
||||
{
|
||||
return VarNameU.Length / sizeof(WCHAR) + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* convert unicode value string to ansi */
|
||||
|
@ -115,7 +122,14 @@ GetEnvironmentVariableW (
|
|||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastErrorByStatus (Status);
|
||||
return 0;
|
||||
if (Status == STATUS_BUFFER_TOO_SMALL)
|
||||
{
|
||||
return (VarValue.Length / sizeof(WCHAR)) + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return (VarValue.Length / sizeof(WCHAR));
|
||||
|
@ -135,6 +149,8 @@ SetEnvironmentVariableA (
|
|||
UNICODE_STRING VarValueU;
|
||||
NTSTATUS Status;
|
||||
|
||||
DPRINT("SetEnvironmentVariableA(Name '%s', Value '%s')\n", lpName, lpValue);
|
||||
|
||||
RtlInitAnsiString (&VarName,
|
||||
(LPSTR)lpName);
|
||||
RtlAnsiStringToUnicodeString (&VarNameU,
|
||||
|
@ -175,6 +191,8 @@ SetEnvironmentVariableW (
|
|||
UNICODE_STRING VarValue;
|
||||
NTSTATUS Status;
|
||||
|
||||
DPRINT("SetEnvironmentVariableW(Name '%S', Value '%S')\n", lpName, lpValue);
|
||||
|
||||
RtlInitUnicodeString (&VarName,
|
||||
lpName);
|
||||
|
||||
|
|
Loading…
Reference in a new issue