[4/4] msi: Don't create all directories in the CreateFolders action.

Hans Leidekker hans at codeweavers.com
Thu Jan 28 04:06:51 CST 2010


The CreatFolders action should create only the directories listed in the
CreateFolder table, the rest will be created during the InstallFiles action.

Fixes the EndNote 8 installer.
---
 dlls/msi/action.c        |    6 ----
 dlls/msi/tests/install.c |   75 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 75 insertions(+), 6 deletions(-)

diff --git a/dlls/msi/action.c b/dlls/msi/action.c
index af028c7..0d765ea 100644
--- a/dlls/msi/action.c
+++ b/dlls/msi/action.c
@@ -959,10 +959,6 @@ UINT msi_create_component_directories( MSIPACKAGE *package )
     return ERROR_SUCCESS;
 }
 
-/*
- * Also we cannot enable/disable components either, so for now I am just going 
- * to do all the directories for all the components.
- */
 static UINT ACTION_CreateFolders(MSIPACKAGE *package)
 {
     static const WCHAR ExecSeqQuery[] =
@@ -981,8 +977,6 @@ static UINT ACTION_CreateFolders(MSIPACKAGE *package)
     rc = MSI_IterateRecords(view, NULL, ITERATE_CreateFolders, package);
     msiobj_release(&view->hdr);
 
-    msi_create_component_directories( package );
-
     return rc;
 }
 
diff --git a/dlls/msi/tests/install.c b/dlls/msi/tests/install.c
index a3bffe7..3904185 100644
--- a/dlls/msi/tests/install.c
+++ b/dlls/msi/tests/install.c
@@ -1063,6 +1063,38 @@ static const CHAR aup_custom_action_dat[] = "Action\tType\tSource\tTarget\tISCom
                                             "CustomAction\tAction\n"
                                             "TestAllUsersProp\t19\t\tTest failed\t\n";
 
+static const CHAR cf_create_folders_dat[] = "Directory_\tComponent_\n"
+                                            "s72\ts72\n"
+                                            "CreateFolder\tDirectory_\tComponent_\n"
+                                            "MSITESTDIR\tOne\n";
+
+static const CHAR cf_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
+                                              "s72\tS255\tI2\n"
+                                              "InstallExecuteSequence\tAction\n"
+                                              "CostFinalize\t\t1000\n"
+                                              "ValidateProductID\t\t700\n"
+                                              "CostInitialize\t\t800\n"
+                                              "FileCost\t\t900\n"
+                                              "RemoveFiles\t\t3500\n"
+                                              "CreateFolders\t\t3700\n"
+                                              "InstallExecute\t\t3800\n"
+                                              "TestCreateFolders\t\t3900\n"
+                                              "InstallFiles\t\t4000\n"
+                                              "RegisterUser\t\t6000\n"
+                                              "RegisterProduct\t\t6100\n"
+                                              "PublishFeatures\t\t6300\n"
+                                              "PublishProduct\t\t6400\n"
+                                              "InstallFinalize\t\t6600\n"
+                                              "InstallInitialize\t\t1500\n"
+                                              "ProcessComponents\t\t1600\n"
+                                              "UnpublishFeatures\t\t1800\n"
+                                              "InstallValidate\t\t1400\n"
+                                              "LaunchConditions\t\t100\n";
+
+static const CHAR cf_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
+                                           "s72\ti2\tS64\tS0\tS255\n"
+                                           "CustomAction\tAction\n"
+                                           "TestCreateFolders\t19\t\tHalts installation\t\n";
 typedef struct _msi_table
 {
     const CHAR *filename;
@@ -1766,6 +1798,20 @@ static const msi_table fiuc_tables[] =
     ADD_TABLE(property),
 };
 
+static const msi_table cf_tables[] =
+{
+    ADD_TABLE(component),
+    ADD_TABLE(directory),
+    ADD_TABLE(feature),
+    ADD_TABLE(feature_comp),
+    ADD_TABLE(file),
+    ADD_TABLE(cf_create_folders),
+    ADD_TABLE(cf_install_exec_seq),
+    ADD_TABLE(cf_custom_action),
+    ADD_TABLE(media),
+    ADD_TABLE(property)
+};
+
 /* cabinet definitions */
 
 /* make the max size large so there is only one cab file */
@@ -7336,6 +7382,34 @@ static void test_feature_override(void)
     delete_test_files();
 }
 
+static void test_create_folder(void)
+{
+    UINT r;
+
+    create_test_files();
+    create_database(msifile, cf_tables, sizeof(cf_tables) / sizeof(msi_table));
+
+    MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
+
+    r = MsiInstallProductA(msifile, NULL);
+    ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
+
+    ok(!delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File installed\n");
+    ok(!delete_pf("msitest\\cabout\\new", FALSE), "Directory created\n");
+    ok(!delete_pf("msitest\\cabout\\four.txt", TRUE), "File installed\n");
+    ok(!delete_pf("msitest\\cabout", FALSE), "Directory created\n");
+    ok(!delete_pf("msitest\\changed\\three.txt", TRUE), "File installed\n");
+    ok(!delete_pf("msitest\\changed", FALSE), "Directory created\n");
+    ok(!delete_pf("msitest\\first\\two.txt", TRUE), "File installed\n");
+    ok(!delete_pf("msitest\\first", FALSE), "Directory created\n");
+    ok(!delete_pf("msitest\\filename", TRUE), "File installed\n");
+    ok(!delete_pf("msitest\\one.txt", TRUE), "File installed\n");
+    ok(!delete_pf("msitest\\service.exe", TRUE), "File installed\n");
+    todo_wine ok(!delete_pf("msitest", FALSE), "Directory created\n");
+
+    delete_test_files();
+}
+
 START_TEST(install)
 {
     DWORD len;
@@ -7427,6 +7501,7 @@ START_TEST(install)
     test_MsiSetExternalUI();
     test_allusers_prop();
     test_feature_override();
+    test_create_folder();
 
     DeleteFileA(log_file);
 
-- 
1.6.3.3




More information about the wine-patches mailing list