From 074bd3b4681ddeb13502d228ae920562541b14ce Mon Sep 17 00:00:00 2001 From: winesync Date: Sat, 12 Mar 2022 15:14:48 +0100 Subject: [PATCH] [WINESYNC] msi/tests: Test deferral of PublishFeatures and UnpublishFeatures. test_publish_assemblies() was leaving behind feature data that caused this test to fail when run multiple times. Signed-off-by: Zebediah Figura Signed-off-by: Hans Leidekker Signed-off-by: Alexandre Julliard wine commit id 920dde0b1e1d137720a277ee05b65c6bf2387ad6 by Zebediah Figura --- modules/rostests/winetests/msi/action.c | 10 ++++++ modules/rostests/winetests/msi/custom.c | 42 ++++++++++++++++++++++ modules/rostests/winetests/msi/custom.spec | 2 ++ 3 files changed, 54 insertions(+) diff --git a/modules/rostests/winetests/msi/action.c b/modules/rostests/winetests/msi/action.c index 48a1c88bf61..82ec376ea17 100644 --- a/modules/rostests/winetests/msi/action.c +++ b/modules/rostests/winetests/msi/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/modules/rostests/winetests/msi/custom.c b/modules/rostests/winetests/msi/custom.c index 4d5cec77dee..bac2653a5fa 100644 --- a/modules/rostests/winetests/msi/custom.c +++ b/modules/rostests/winetests/msi/custom.c @@ -1494,3 +1494,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@JU1j_KE"); + check_reg_str(hinst, key, "montecristo", "VGtfp^p+,?82@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/modules/rostests/winetests/msi/custom.spec b/modules/rostests/winetests/msi/custom.spec index 2dc09e0a099..209257025f7 100644 --- a/modules/rostests/winetests/msi/custom.spec +++ b/modules/rostests/winetests/msi/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)