[PATCH] msi: Remove system environment variables on uninstall.

Hans Leidekker hans at codeweavers.com
Wed Apr 17 08:14:01 CDT 2019


Signed-off-by: Hans Leidekker <hans at codeweavers.com>
---
 dlls/msi/action.c       |  2 +-
 dlls/msi/tests/action.c | 14 ++++++++++++--
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/dlls/msi/action.c b/dlls/msi/action.c
index 849335edde..03b6abfa45 100644
--- a/dlls/msi/action.c
+++ b/dlls/msi/action.c
@@ -7050,7 +7050,7 @@ static UINT env_parse_flags( LPCWSTR *name, LPCWSTR *value, DWORD *flags )
         else if (*cptr == '!')
             *flags |= ENV_ACT_REMOVEMATCH;
         else if (*cptr == '*')
-            *flags |= ENV_MOD_MACHINE;
+            *flags |= ENV_MOD_MACHINE | ENV_ACT_REMOVE;
         else
             break;
 
diff --git a/dlls/msi/tests/action.c b/dlls/msi/tests/action.c
index 068fc55b78..60ae92e64c 100644
--- a/dlls/msi/tests/action.c
+++ b/dlls/msi/tests/action.c
@@ -247,7 +247,8 @@ static const char env_environment_dat[] =
     "Var26\t+-MSITESTVAR20\t2[~]\tOne\n"
     "Var27\t+-MSITESTVAR21\t[~];1\tOne\n"
     "Var28\t-MSITESTVAR22\t1\tOne\n"
-    "Var29\t-MSITESTVAR23\t2\tOne\n";
+    "Var29\t-MSITESTVAR23\t2\tOne\n"
+    "Var30\t*MSITESTVAR100\t1\tOne\n";
 
 static const char service_install_dat[] =
     "ServiceInstall\tName\tDisplayName\tServiceType\tStartType\tErrorControl\t"
@@ -4960,7 +4961,7 @@ static void test_envvar(void)
 {
     char buffer[16];
     UINT r, i;
-    HKEY env;
+    HKEY env, env2;
     LONG res;
 
     if (is_process_limited())
@@ -4974,6 +4975,10 @@ static void test_envvar(void)
     res = RegCreateKeyExA(HKEY_CURRENT_USER, "Environment", 0, NULL, 0, KEY_ALL_ACCESS, NULL, &env, NULL);
     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
 
+    res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, "System\\CurrentControlSet\\Control\\Session Manager\\Environment",
+                          0, NULL, 0, KEY_ALL_ACCESS, NULL, &env2, NULL);
+    ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
+
     res = RegSetValueExA(env, "MSITESTVAR1", 0, REG_SZ, (const BYTE *)"0", 2);
     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
 
@@ -5027,6 +5032,7 @@ static void test_envvar(void)
     CHECK_REG_STR(env, "MSITESTVAR19", "1");
     CHECK_REG_STR(env, "MSITESTVAR20", "1");
     CHECK_REG_STR(env, "MSITESTVAR21", "1");
+    CHECK_REG_STR(env2, "MSITESTVAR100", "1");
 
     res = RegSetValueExA(env, "MSITESTVAR22", 0, REG_SZ, (const BYTE *)"1", 2);
     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
@@ -5054,11 +5060,15 @@ todo_wine {
         ok(res == ERROR_FILE_NOT_FOUND, "[%d] got %u\n", i, res);
     }
 
+    res = RegDeleteValueA(env2, "MSITESTVAR100");
+    ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
+
 error:
     RegDeleteValueA(env, "MSITESTVAR1");
     RegDeleteValueA(env, "MSITESTVAR2");
     RegDeleteValueA(env, "MSITESTVAR21");
     RegCloseKey(env);
+    RegCloseKey(env2);
 
     DeleteFileA(msifile);
 }
-- 
2.20.1




More information about the wine-devel mailing list