ntdll: Don't fail when trying to remove the value of a non-existant variable in RtlSetEnvironmentVariable().

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51035
Signed-off-by: Gijs Vermeulen <gijsvrm@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
(cherry picked from commit 2f2cdc8bb1)
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
This commit is contained in:
Gijs Vermeulen 2021-04-21 20:21:36 +02:00 committed by Michael Stefaniuc
parent 43120ef411
commit ebaafad23e
2 changed files with 3 additions and 4 deletions

View File

@ -733,7 +733,7 @@ NTSTATUS WINAPI RtlSetEnvironmentVariable(PWSTR* penv, PUNICODE_STRING name,
{
INT varlen, len, old_size;
LPWSTR p, env;
NTSTATUS nts = STATUS_VARIABLE_NOT_FOUND;
NTSTATUS nts = STATUS_SUCCESS;
TRACE("(%p, %s, %s)\n", penv, debugstr_us(name), debugstr_us(value));
@ -806,7 +806,6 @@ NTSTATUS WINAPI RtlSetEnvironmentVariable(PWSTR* penv, PUNICODE_STRING name,
memcpy( p, value->Buffer, value->Length );
p[value->Length / sizeof(WCHAR)] = 0;
}
nts = STATUS_SUCCESS;
done:
if (!penv) RtlReleasePebLock();

View File

@ -580,7 +580,7 @@ static void test_RtlSetEnvironmentVariable(void)
query_env_var(env, L"cat", NULL);
status = set_env_var(&env, L"cat", NULL);
todo_wine ok(!status, "got %#x\n", status);
ok(!status, "got %#x\n", status);
status = set_env_var(&env, L"foo", L"meouw");
ok(!status, "got %#x\n", status);
@ -591,7 +591,7 @@ static void test_RtlSetEnvironmentVariable(void)
query_env_var(env, L"foo", NULL);
status = set_env_var(&env, L"horse", NULL);
todo_wine ok(!status, "got %#x\n", status);
ok(!status, "got %#x\n", status);
query_env_var(env, L"horse", NULL);
status = set_env_var(&env, L"me=too", L"also");