James Hawkins : msi: Ignore the custom action type 51 if the source field is empty.

Alexandre Julliard julliard at winehq.org
Tue Mar 11 10:51:48 CDT 2008


Module: wine
Branch: master
Commit: 2d0ff9740605cb8b663cce44775b08856b570ac5
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=2d0ff9740605cb8b663cce44775b08856b570ac5

Author: James Hawkins <jhawkins at codeweavers.com>
Date:   Tue Mar 11 00:30:24 2008 -0500

msi: Ignore the custom action type 51 if the source field is empty.

---

 dlls/msi/custom.c        |    3 ++
 dlls/msi/tests/install.c |   65 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 68 insertions(+), 0 deletions(-)

diff --git a/dlls/msi/custom.c b/dlls/msi/custom.c
index 53cdf68..316fe5a 100644
--- a/dlls/msi/custom.c
+++ b/dlls/msi/custom.c
@@ -331,6 +331,9 @@ UINT ACTION_CustomAction(MSIPACKAGE *package, LPCWSTR action, UINT script, BOOL
             msi_free(deformated);
             break;
         case 51: /* Property set with formatted text. */
+            if (!source)
+                break;
+
             deformat_string(package,target,&deformated);
             rc = MSI_SetPropertyW(package,source,deformated);
             msi_free(deformated);
diff --git a/dlls/msi/tests/install.c b/dlls/msi/tests/install.c
index 03458dc..00cd705 100644
--- a/dlls/msi/tests/install.c
+++ b/dlls/msi/tests/install.c
@@ -603,6 +603,36 @@ static const CHAR wrv_registry_dat[] = "Registry\tRoot\tKey\tName\tValue\tCompon
                                        "Registry\tRegistry\n"
                                        "regdata\t2\tSOFTWARE\\Wine\\msitest\tValue\t[~]one[~]two[~]three\taugustus";
 
+static const CHAR ca51_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
+                                         "s72\tS38\ts72\ti2\tS255\tS72\n"
+                                         "Component\tComponent\n"
+                                         "augustus\t\tMSITESTDIR\t0\tMYPROP=42\taugustus\n";
+
+static const CHAR ca51_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
+                                                "s72\tS255\tI2\n"
+                                                "InstallExecuteSequence\tAction\n"
+                                                "ValidateProductID\t\t700\n"
+                                                "GoodSetProperty\t\t725\n"
+                                                "BadSetProperty\t\t750\n"
+                                                "CostInitialize\t\t800\n"
+                                                "FileCost\t\t900\n"
+                                                "CostFinalize\t\t1000\n"
+                                                "InstallValidate\t\t1400\n"
+                                                "InstallInitialize\t\t1500\n"
+                                                "ProcessComponents\t\t1600\n"
+                                                "UnpublishFeatures\t\t1800\n"
+                                                "InstallFiles\t\t4000\n"
+                                                "RegisterProduct\t\t6100\n"
+                                                "PublishFeatures\t\t6300\n"
+                                                "PublishProduct\t\t6400\n"
+                                                "InstallFinalize\t\t6600";
+
+static const CHAR ca51_custom_action_dat[] = "Action\tType\tSource\tTarget\n"
+                                             "s72\ti2\tS64\tS0\n"
+                                             "CustomAction\tAction\n"
+                                             "GoodSetProperty\t51\tMYPROP\t42\n"
+                                             "BadSetProperty\t51\t\tMYPROP\n";
+
 typedef struct _msi_table
 {
     const CHAR *filename;
@@ -928,6 +958,19 @@ static const msi_table sf_tables[] =
     ADD_TABLE(property),
 };
 
+static const msi_table ca51_tables[] =
+{
+    ADD_TABLE(ca51_component),
+    ADD_TABLE(directory),
+    ADD_TABLE(rof_feature),
+    ADD_TABLE(ci2_feature_comp),
+    ADD_TABLE(ci2_file),
+    ADD_TABLE(ca51_install_exec_seq),
+    ADD_TABLE(rof_media),
+    ADD_TABLE(property),
+    ADD_TABLE(ca51_custom_action),
+};
+
 /* cabinet definitions */
 
 /* make the max size large so there is only one cab file */
@@ -4250,6 +4293,27 @@ static void test_sourcefolder(void)
     DeleteFile("augustus");
 }
 
+static void test_customaction51(void)
+{
+    UINT r;
+
+    CreateDirectoryA("msitest", NULL);
+    create_file("msitest\\augustus", 500);
+
+    create_database(msifile, ca51_tables, sizeof(ca51_tables) / sizeof(msi_table));
+
+    MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
+
+    r = MsiInstallProductA(msifile, NULL);
+    ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
+    ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
+    ok(delete_pf("msitest", FALSE), "File installed\n");
+
+    DeleteFile(msifile);
+    DeleteFile("msitest\\augustus");
+    RemoveDirectory("msitest");
+}
+
 START_TEST(install)
 {
     DWORD len;
@@ -4299,6 +4363,7 @@ START_TEST(install)
     test_duplicatefiles();
     test_writeregistryvalues();
     test_sourcefolder();
+    test_customaction51();
 
     SetCurrentDirectoryA(prev_path);
 }




More information about the wine-cvs mailing list