Author: jmorlan
Date: Sun Apr 12 08:41:33 2009
New Revision: 40470
URL:
http://svn.reactos.org/svn/reactos?rev=40470&view=rev
Log:
- 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.
Modified:
trunk/reactos/dll/win32/kernel32/misc/env.c
trunk/reactos/lib/rtl/env.c
Modified: trunk/reactos/dll/win32/kernel32/misc/env.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/misc/en…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/misc/env.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/misc/env.c [iso-8859-1] Sun Apr 12 08:41:33 2009
@@ -244,21 +244,12 @@
RtlInitUnicodeString (&VarName,
lpName);
- if (lpValue)
- {
- RtlInitUnicodeString (&VarValue,
- lpValue);
-
- Status = RtlSetEnvironmentVariable (NULL,
- &VarName,
- &VarValue);
- }
- else
- {
- Status = RtlSetEnvironmentVariable (NULL,
- &VarName,
- NULL);
- }
+ RtlInitUnicodeString (&VarValue,
+ lpValue);
+
+ Status = RtlSetEnvironmentVariable (NULL,
+ &VarName,
+ &VarValue);
if (!NT_SUCCESS(Status))
{
Modified: trunk/reactos/lib/rtl/env.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/env.c?rev=40470&am…
==============================================================================
--- trunk/reactos/lib/rtl/env.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/env.c [iso-8859-1] Sun Apr 12 08:41:33 2009
@@ -354,7 +354,7 @@
}
found:
- if (Value != NULL)
+ if (Value != NULL && Value->Buffer != NULL)
{
hole_len = tail - hole;
/* calculate new environment size */
@@ -472,10 +472,6 @@
memmove(head,
tail,
(env_end - tail) * sizeof(WCHAR));
- }
- else
- {
- Status = STATUS_VARIABLE_NOT_FOUND;
}
}