diff --git a/reactos/dll/win32/kernel32/misc/env.c b/reactos/dll/win32/kernel32/misc/env.c index 2acacbfb722..2e38f80db03 100644 --- a/reactos/dll/win32/kernel32/misc/env.c +++ b/reactos/dll/win32/kernel32/misc/env.c @@ -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)) { diff --git a/reactos/lib/rtl/env.c b/reactos/lib/rtl/env.c index f7fac92aeb8..10c40ac3f38 100644 --- a/reactos/lib/rtl/env.c +++ b/reactos/lib/rtl/env.c @@ -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)