Zebediah Figura : msi/tests: Test deferral of MsiPublishAssemblies and MsiUnpublishAssemblies.

Alexandre Julliard julliard at winehq.org
Fri May 25 13:41:12 CDT 2018


Module: wine
Branch: master
Commit: 6eb74409147751a69cbf7dff34d79bd7e3a5dc7a
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=6eb74409147751a69cbf7dff34d79bd7e3a5dc7a

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Thu May 24 19:14:10 2018 -0500

msi/tests: Test deferral of MsiPublishAssemblies and MsiUnpublishAssemblies.

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 1600fe3..bd1e2c0 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 0bf62d9..ee067db 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 at 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 4b46dc3..e5caa76 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)




More information about the wine-cvs mailing list