From 6eb74409147751a69cbf7dff34d79bd7e3a5dc7a Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Thu, 24 May 2018 19:14:10 -0500 Subject: [PATCH] msi/tests: Test deferral of MsiPublishAssemblies and MsiUnpublishAssemblies. Signed-off-by: Zebediah Figura Signed-off-by: Hans Leidekker Signed-off-by: Alexandre Julliard --- dlls/msi/tests/action.c | 14 ++++++++++ dlls/msi/tests/custom.c | 55 ++++++++++++++++++++++++++++++++++++++ dlls/msi/tests/custom.spec | 2 ++ 3 files changed, 71 insertions(+) diff --git a/dlls/msi/tests/action.c b/dlls/msi/tests/action.c index 1600fe39932..bd1e2c02d26 100644 --- a/dlls/msi/tests/action.c +++ b/dlls/msi/tests/action.c @@ -1733,12 +1733,25 @@ static const char pa_install_exec_seq_dat[] = "InstallInitialize\t\t1500\n" "ProcessComponents\t\t1600\n" "MsiPublishAssemblies\t\t3000\n" + "pa_immediate\tNOT REMOVE AND NOT ALLUSERS\t3001\n" + "pa_deferred\tNOT REMOVE AND NOT ALLUSERS\t3002\n" "MsiUnpublishAssemblies\t\t4000\n" + "ua_immediate\tREMOVE AND NOT ALLUSERS\t4001\n" + "ua_deferred\tREMOVE AND NOT ALLUSERS\t4002\n" "RegisterProduct\t\t5000\n" "PublishFeatures\t\t5100\n" "PublishProduct\t\t5200\n" "InstallFinalize\t\t6000\n"; +static const char pa_custom_action_dat[] = + "Action\tType\tSource\tTarget\n" + "s72\ti2\tS64\tS0\n" + "CustomAction\tAction\n" + "pa_immediate\t1\tcustom.dll\tpa_absent\n" + "pa_deferred\t1025\tcustom.dll\tpa_present\n" + "ua_immediate\t1\tcustom.dll\tpa_present\n" + "ua_deferred\t1025\tcustom.dll\tpa_absent\n"; + static const char rep_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n" "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n" @@ -2191,6 +2204,7 @@ static const msi_table pa_tables[] = ADD_TABLE(pa_msi_assembly), ADD_TABLE(pa_msi_assembly_name), ADD_TABLE(pa_install_exec_seq), + ADD_TABLE(pa_custom_action), ADD_TABLE(media), ADD_TABLE(property) }; diff --git a/dlls/msi/tests/custom.c b/dlls/msi/tests/custom.c index 0bf62d972b1..ee067db6a0f 100644 --- a/dlls/msi/tests/custom.c +++ b/dlls/msi/tests/custom.c @@ -1379,3 +1379,58 @@ todo_wine { } return ERROR_SUCCESS; } + +static void check_reg_str(MSIHANDLE hinst, HKEY key, const char *name, const char *expect) +{ + char value[300]; + DWORD sz; + LONG res; + + sz = sizeof(value); + res = RegQueryValueExA(key, name, NULL, NULL, (BYTE *)value, &sz); + if (expect) + { + ok(hinst, !res, "failed to get value \"%s\": %d\n", name, res); + ok(hinst, !strcmp(value, expect), "\"%s\": expected \"%s\", got \"%s\"\n", + name, expect, value); + } + else + ok(hinst, res == ERROR_FILE_NOT_FOUND, "\"%s\": expected missing, got %u\n", + name, res); +} + +static const char path_dotnet[] = "Software\\Microsoft\\Installer\\Assemblies\\Global"; +static const char name_dotnet[] = "Wine.Dotnet.Assembly,processorArchitecture=\"MSIL\"," + "publicKeyToken=\"abcdef0123456789\",version=\"1.0.0.0\",culture=\"neutral\""; + +UINT WINAPI pa_present(MSIHANDLE hinst) +{ + HKEY key; + LONG res; + + res = RegOpenKeyA(HKEY_CURRENT_USER, path_dotnet, &key); + ok(hinst, !res, "got %d\n", res); +todo_wine_if(!MsiGetMode(hinst, MSIRUNMODE_SCHEDULED)) { + check_reg_str(hinst, key, name_dotnet, "rcHQPHq?CA@Uv-XqMI1e>Z'q,T*76M@=YEg6My?~]"); +} + RegCloseKey(key); + + return ERROR_SUCCESS; +} + +UINT WINAPI pa_absent(MSIHANDLE hinst) +{ + HKEY key; + LONG res; + + res = RegOpenKeyA(HKEY_CURRENT_USER, path_dotnet, &key); + ok(hinst, !res || res == ERROR_FILE_NOT_FOUND, "got %d\n", res); + if (!res) + { +todo_wine_if(!MsiGetMode(hinst, MSIRUNMODE_SCHEDULED)) { + check_reg_str(hinst, key, name_dotnet, NULL); +} + RegCloseKey(key); + } + return ERROR_SUCCESS; +} diff --git a/dlls/msi/tests/custom.spec b/dlls/msi/tests/custom.spec index 4b46dc3744a..e5caa76ad08 100644 --- a/dlls/msi/tests/custom.spec +++ b/dlls/msi/tests/custom.spec @@ -13,6 +13,8 @@ @ stdcall mov_absent(long) @ stdcall odbc_present(long) @ stdcall odbc_absent(long) +@ stdcall pa_present(long) +@ stdcall pa_absent(long) @ stdcall rd_present(long) @ stdcall rd_absent(long) @ stdcall sds_present(long)