- RtlSetEnvironmentVariable: Removing a variable that didn't exist in the first place should still returns STATUS_SUCCESS.

- Removing a variable can be done by using a pointer to a UNICODE_STRING with a NULL Buffer as the value, as well as just passing NULL as the value.

svn path=/trunk/; revision=40470
This commit is contained in:
Jeffrey Morlan
2009-04-12 04:41:33 +00:00
parent 72585aa30d
commit d418f42b89
2 changed files with 6 additions and 19 deletions
+5 -14
View File
@@ -244,21 +244,12 @@ SetEnvironmentVariableW (
RtlInitUnicodeString (&VarName,
lpName);
if (lpValue)
{
RtlInitUnicodeString (&VarValue,
lpValue);
RtlInitUnicodeString (&VarValue,
lpValue);
Status = RtlSetEnvironmentVariable (NULL,
&VarName,
&VarValue);
}
else
{
Status = RtlSetEnvironmentVariable (NULL,
&VarName,
NULL);
}
Status = RtlSetEnvironmentVariable (NULL,
&VarName,
&VarValue);
if (!NT_SUCCESS(Status))
{
+1 -5
View File
@@ -354,7 +354,7 @@ RtlSetEnvironmentVariable(PWSTR *Environment,
}
found:
if (Value != NULL)
if (Value != NULL && Value->Buffer != NULL)
{
hole_len = tail - hole;
/* calculate new environment size */
@@ -473,10 +473,6 @@ found:
tail,
(env_end - tail) * sizeof(WCHAR));
}
else
{
Status = STATUS_VARIABLE_NOT_FOUND;
}
}
if (Environment == NULL)