Module: wine Branch: stable Commit: ebaafad23eb80261c02180282a63d6bb31a93a80 URL: https://source.winehq.org/git/wine.git/?a=commit;h=ebaafad23eb80261c02180282... Author: Gijs Vermeulen <gijsvrm(a)gmail.com> Date: Wed Apr 21 20:21:36 2021 +0200 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(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> (cherry picked from commit 2f2cdc8bb147f62ade1c5a2f1ae4c7b2863e6b08) Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org> --- dlls/ntdll/env.c | 3 +-- dlls/ntdll/tests/env.c | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/dlls/ntdll/env.c b/dlls/ntdll/env.c index 5d1b6de5bba..f4f3ebb3d37 100644 --- a/dlls/ntdll/env.c +++ b/dlls/ntdll/env.c @@ -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(); diff --git a/dlls/ntdll/tests/env.c b/dlls/ntdll/tests/env.c index a60d08e5967..6514591874b 100644 --- a/dlls/ntdll/tests/env.c +++ b/dlls/ntdll/tests/env.c @@ -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");