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

Gijs Vermeulen gijsvrm at gmail.com
Wed Apr 21 13:21:36 CDT 2021


Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51035
Signed-off-by: Gijs Vermeulen <gijsvrm at gmail.com>
---
 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 1ed52b9728f..c11960db165 100644
--- a/dlls/ntdll/env.c
+++ b/dlls/ntdll/env.c
@@ -276,7 +276,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));
 
@@ -352,7 +352,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 eed8ae38c14..da61d11c1f2 100644
--- a/dlls/ntdll/tests/env.c
+++ b/dlls/ntdll/tests/env.c
@@ -621,7 +621,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);
@@ -632,7 +632,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");
-- 
2.31.1




More information about the wine-devel mailing list