[PATCH 5/5] msi/tests: Test deferral of PublishFeatures and UnpublishFeatures.

Zebediah Figura z.figura12 at gmail.com
Tue May 22 18:39:28 CDT 2018


test_publish_assemblies() was leaving behind feature data that caused this
test to fail when run multiple times.

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 dlls/msi/tests/action.c    | 10 ++++++++++
 dlls/msi/tests/custom.c    | 42 ++++++++++++++++++++++++++++++++++++++++++
 dlls/msi/tests/custom.spec |  2 ++
 3 files changed, 54 insertions(+)

diff --git a/dlls/msi/tests/action.c b/dlls/msi/tests/action.c
index 48a1c88..82ec376 100644
--- a/dlls/msi/tests/action.c
+++ b/dlls/msi/tests/action.c
@@ -399,11 +399,15 @@ static const char pp_install_exec_seq_dat[] =
     "ppc_immediate\tPROCESS_COMPONENTS AND ALLUSERS\t1601\n"
     "ppc_deferred\tPROCESS_COMPONENTS AND ALLUSERS\t1602\n"
     "UnpublishFeatures\tUNPUBLISH_FEATURES=1 Or FULL=1\t1800\n"
+    "uf_immediate\tUNPUBLISH_FEATURES AND ALLUSERS\t1801\n"
+    "uf_deferred\tUNPUBLISH_FEATURES AND ALLUSERS\t1802\n"
     "RemoveFiles\t\t3500\n"
     "InstallFiles\t\t4000\n"
     "RegisterUser\tREGISTER_USER=1 Or FULL=1\t6000\n"
     "RegisterProduct\tREGISTER_PRODUCT=1 Or FULL=1\t6100\n"
     "PublishFeatures\tPUBLISH_FEATURES=1 Or FULL=1\t6300\n"
+    "pf_immediate\tPUBLISH_FEATURES AND ALLUSERS\t6301\n"
+    "pf_deferred\tPUBLISH_FEATURES AND ALLUSERS\t6302\n"
     "PublishProduct\tPUBLISH_PRODUCT=1 Or FULL=1\t6400\n"
     "InstallFinalize\t\t6600";
 
@@ -411,6 +415,10 @@ static const char pp_custom_action_dat[] =
     "Action\tType\tSource\tTarget\n"
     "s72\ti2\tS64\tS0\n"
     "CustomAction\tAction\n"
+    "pf_immediate\t1\tcustom.dll\tpf_absent\n"
+    "pf_deferred\t1025\tcustom.dll\tpf_present\n"
+    "uf_immediate\t1\tcustom.dll\tpf_present\n"
+    "uf_deferred\t1025\tcustom.dll\tpf_absent\n"
     "ppc_immediate\t1\tcustom.dll\tppc_absent\n"
     "ppc_deferred\t1025\tcustom.dll\tppc_present\n";
 
@@ -1763,6 +1771,7 @@ static const char pa_install_exec_seq_dat[] =
     "RegisterProduct\t\t5000\n"
     "PublishFeatures\t\t5100\n"
     "PublishProduct\t\t5200\n"
+    "UnpublishFeatures\t\t5300\n"
     "InstallFinalize\t\t6000\n";
 
 static const char pa_custom_action_dat[] =
@@ -1865,6 +1874,7 @@ static const msi_table pp_tables[] =
     ADD_TABLE(rof_feature_comp),
     ADD_TABLE(rof_file),
     ADD_TABLE(pp_install_exec_seq),
+    ADD_TABLE(pp_custom_action),
     ADD_TABLE(rof_media),
     ADD_TABLE(property),
 };
diff --git a/dlls/msi/tests/custom.c b/dlls/msi/tests/custom.c
index fed1e5e..b76a88b 100644
--- a/dlls/msi/tests/custom.c
+++ b/dlls/msi/tests/custom.c
@@ -1492,3 +1492,45 @@ todo_wine_if(!MsiGetMode(hinst, MSIRUNMODE_SCHEDULED))
     ok(hinst, res == ERROR_FILE_NOT_FOUND, "got %u\n", res);
     return ERROR_SUCCESS;
 }
+
+static const char pf_classkey[] = "Installer\\Features\\84A88FD7F6998CE40A22FB59F6B9C2BB";
+static const char pf_userkey[] = "Software\\Microsoft\\Windows\\CurrentVersion\\"
+    "Installer\\UserData\\S-1-5-18\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB\\Features";
+
+UINT WINAPI pf_present(MSIHANDLE hinst)
+{
+    HKEY key;
+    LONG res;
+
+todo_wine_if(!MsiGetMode(hinst, MSIRUNMODE_SCHEDULED)) {
+    res = RegOpenKeyExA(HKEY_CLASSES_ROOT, pf_classkey, 0, KEY_READ | KEY_WOW64_64KEY, &key);
+    ok(hinst, !res, "got %u\n", res);
+    check_reg_str(hinst, key, "feature", "");
+    check_reg_str(hinst, key, "montecristo", "");
+    RegCloseKey(key);
+
+    res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, pf_userkey, 0, KEY_READ | KEY_WOW64_64KEY, &key);
+    ok(hinst, !res, "got %u\n", res);
+    check_reg_str(hinst, key, "feature", "VGtfp^p+,?82 at JU1j_KE");
+    check_reg_str(hinst, key, "montecristo", "VGtfp^p+,?82 at JU1j_KE");
+    RegCloseKey(key);
+}
+
+    return ERROR_SUCCESS;
+}
+
+UINT WINAPI pf_absent(MSIHANDLE hinst)
+{
+    HKEY key;
+    LONG res;
+
+    res = RegOpenKeyExA(HKEY_CLASSES_ROOT, pf_classkey, 0, KEY_READ | KEY_WOW64_64KEY, &key);
+todo_wine_if(!MsiGetMode(hinst, MSIRUNMODE_SCHEDULED))
+    ok(hinst, res == ERROR_FILE_NOT_FOUND, "got %u\n", res);
+
+    res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, pf_userkey, 0, KEY_READ | KEY_WOW64_64KEY, &key);
+todo_wine_if(!MsiGetMode(hinst, MSIRUNMODE_SCHEDULED))
+    ok(hinst, res == ERROR_FILE_NOT_FOUND, "got %u\n", res);
+
+    return ERROR_SUCCESS;
+}
diff --git a/dlls/msi/tests/custom.spec b/dlls/msi/tests/custom.spec
index 2dc09e0..2092570 100644
--- a/dlls/msi/tests/custom.spec
+++ b/dlls/msi/tests/custom.spec
@@ -15,6 +15,8 @@
 @ stdcall odbc_absent(long)
 @ stdcall pa_present(long)
 @ stdcall pa_absent(long)
+@ stdcall pf_present(long)
+@ stdcall pf_absent(long)
 @ stdcall ppc_present(long)
 @ stdcall ppc_absent(long)
 @ stdcall pub_present(long)
-- 
2.7.4




More information about the wine-devel mailing list