mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 01:35:43 +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
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS system libraries
|
* PROJECT: ReactOS system libraries
|
||||||
|
@ -70,7 +70,14 @@ GetEnvironmentVariableA (
|
||||||
RtlFreeUnicodeString (&VarNameU);
|
RtlFreeUnicodeString (&VarNameU);
|
||||||
|
|
||||||
SetLastErrorByStatus (Status);
|
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 */
|
/* convert unicode value string to ansi */
|
||||||
|
@ -115,7 +122,14 @@ GetEnvironmentVariableW (
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
SetLastErrorByStatus (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));
|
return (VarValue.Length / sizeof(WCHAR));
|
||||||
|
@ -135,6 +149,8 @@ SetEnvironmentVariableA (
|
||||||
UNICODE_STRING VarValueU;
|
UNICODE_STRING VarValueU;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
DPRINT("SetEnvironmentVariableA(Name '%s', Value '%s')\n", lpName, lpValue);
|
||||||
|
|
||||||
RtlInitAnsiString (&VarName,
|
RtlInitAnsiString (&VarName,
|
||||||
(LPSTR)lpName);
|
(LPSTR)lpName);
|
||||||
RtlAnsiStringToUnicodeString (&VarNameU,
|
RtlAnsiStringToUnicodeString (&VarNameU,
|
||||||
|
@ -175,6 +191,8 @@ SetEnvironmentVariableW (
|
||||||
UNICODE_STRING VarValue;
|
UNICODE_STRING VarValue;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
DPRINT("SetEnvironmentVariableW(Name '%S', Value '%S')\n", lpName, lpValue);
|
||||||
|
|
||||||
RtlInitUnicodeString (&VarName,
|
RtlInitUnicodeString (&VarName,
|
||||||
lpName);
|
lpName);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue