mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-08-29 19:26:33 +00:00
- 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:
@@ -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))
|
||||
{
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user