msi: Test the install sequence order

James Hawkins truiken at gmail.com
Thu Oct 12 16:53:45 CDT 2006


Hi,

MSI installers usually have at least two install sequencing tables,
InstallExecuteSequence and InstallUISequence.  If the install is run
at the Full UI level, then the installer executes the actions in the
InstallUISequence table in order, up to the ExecuteAction sequence.
At this point, the installer starts running through the actions in the
InstallExecuteSequence table.  On the other hand, this test shows that
some actions in the InstallExecuteSequence are run before certain
actions in the InstallUISequence table.  I don't know if the installer
has a set list of standard actions that are run in the
InstallExecuteSequence before the InstallUISequence, or what, but this
test at least shows that there is at least one action, ResolevSource,
that is run in the InstallExecuteSequence before other actions in the
InstallUISequence.  The test works like this:

InstallExecuteSequence         InstallUISequence
------------------------------------     -------------------------
ResolveSource          850        SetMagicKey       925
WriteRegistryValues 6000      ResolveSource  960
                                                     ExecuteAction     1300

ResolveSource (IES) gets called to set the property SOURCEDIR.
SetMagicKey sets the property MAGICKEY to 1 only if the SOURCEDIR
property is set.  WriteRegistryValues writes a certain registry key
only if MAGICKEY is set.  If the ResolveSource from the
InstallExecuteSequence doesn't get called before SetMagicKey, then
SOURCEDIR will not be set, and SetMagicKey, and thus
WriteRegistryValues, will not be called.

Changelog:
* Test the install sequence order.

 dlls/msi/tests/install.c |  149 ++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 137 insertions(+), 12 deletions(-)

-- 
James Hawkins
-------------- next part --------------
diff --git a/dlls/msi/tests/install.c b/dlls/msi/tests/install.c
index 223ac41..1eedb73 100644
--- a/dlls/msi/tests/install.c
+++ b/dlls/msi/tests/install.c
@@ -155,6 +155,74 @@ static const CHAR registry_dat[] = "Regi
                                    "Oranges\t2\tSOFTWARE\\Wine\\msitest\tnumber\t#314\tTwo\n"
                                    "regdata\t2\tSOFTWARE\\Wine\\msitest\tblah\tbad\tdangler";
 
+static const CHAR sd_comp_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
+                                  "s72\tS38\ts72\ti2\tS255\tS72\n"
+                                  "Component\tComponent\n"
+                                  "component\t\tTARGETDIR\t0\t1\tfile";
+
+static const CHAR sd_cust_act_dat[] = "Action\tType\tSource\tTarget\n"
+                                      "s72\ti2\tS72\tS255\n"
+                                      "CustomAction\tAction\n"
+                                      "SetMagicKey\t51\tMAGICKEY\t1";
+
+static const CHAR sd_dir_dat[] = "Directory\tDirectory_Parent\tDefaultDir\n"
+                                 "s72\tS72\tl255\n"
+                                 "Directory\tDirectory\n"
+                                 "TARGETDIR\t\tSourceDir";
+
+static const CHAR sd_feat_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
+                                  "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
+                                  "Feature\tFeature\n"
+                                  "feature\t\t\t\t2\t1\tTARGETDIR\t0";
+
+static const CHAR sd_feat_comp_dat[] = "Feature_\tComponent_\n"
+                                       "s38\ts72\n"
+                                       "FeatureComponents\tFeature_\tComponent_\n"
+                                       "feature\tcomponent";
+
+static const CHAR sd_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
+                                  "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
+                                  "File\tFile\n"
+                                  "file\tcomponent\tfilename\t100\t\t\t8192\t1";
+
+static const CHAR sd_inst_ex_seq_dat[] = "Action\tCondition\tSequence\n"
+                                         "s72\tS255\tI2\n"
+                                         "InstallExecuteSequence\tAction\n"
+                                         "CostFinalize\t\t1000\n"
+                                         "CostInitialize\t\t800\n"
+                                         "FileCost\t\t900\n"
+                                         "InstallFinalize\t\t6600\n"
+                                         "InstallInitialize\t\t1500\n"
+                                         "InstallValidate\t\t1400\n"
+                                         "ResolveSource\t\t850\n"
+                                         "WriteRegistryValues\tMAGICKEY\t6000";
+
+static const CHAR sd_inst_ui_seq_dat[] = "Action\tCondition\tSequence\n"
+                                         "s72\tS255\tI2\n"
+                                         "InstallUISequence\tAction\n"
+                                         "CostFinalize\t\t1000\n"
+                                         "CostInitialize\t\t800\n"
+                                         "ExecuteAction\t\t1300\n"
+                                         "FileCost\t\t900\n"
+                                         "ResolveSource\t\t960\n"
+                                         "SetMagicKey\tSOURCEDIR\t925";
+
+static const CHAR sd_prop_dat[] = "Property\tValue\n"
+                                  "s72\tl0\n"
+                                  "Property\tProperty\n"
+                                  "INSTALLLEVEL\t1\n"
+                                  "Manufacturer\tWine\n"
+                                  "ProductCode\t{F1C3AF50-8B56-4A69-A00C-00773FE42F30}\n"
+                                  "ProductLanguage\t1033\n"
+                                  "ProductName\tMSITEST\n"
+                                  "ProductVersion\t1.1.1\n"
+                                  "UILevel\t5";
+
+static const CHAR sd_reg_dat[] = "Registry\tRoot\tKey\tName\tValue\tComponent_\n"
+                                 "s72\ti2\tl255\tL255\tL0\ts7\n"
+                                 "Registry\tRegistry\n"
+                                 "OrderTest\t2\tSOFTWARE\\Wine\\msitest\tOrderTestName\tOrderTestValue\tcomponent";
+
 typedef struct _msi_table
 {
     const CHAR *filename;
@@ -179,6 +247,20 @@ static const msi_table tables[] =
     ADD_TABLE(registry)
 };
 
+static const msi_table sd_tables[] =
+{
+    ADD_TABLE(sd_comp),
+    ADD_TABLE(sd_cust_act),
+    ADD_TABLE(sd_dir),
+    ADD_TABLE(sd_feat),
+    ADD_TABLE(sd_feat_comp),
+    ADD_TABLE(sd_file),
+    ADD_TABLE(sd_inst_ex_seq),
+    ADD_TABLE(sd_inst_ui_seq),
+    ADD_TABLE(sd_prop),
+    ADD_TABLE(sd_reg)
+};
+
 /* cabinet definitions */
 
 /* make the max size large so there is only one cab file */
@@ -473,14 +555,6 @@ static void create_file(const CHAR *name
 
 static void create_test_files(void)
 {
-    int len;
-
-    GetCurrentDirectoryA(MAX_PATH, CURR_DIR);
-    len = lstrlenA(CURR_DIR);
-
-    if(len && (CURR_DIR[len-1] == '\\'))
-        CURR_DIR[len - 1] = 0;
-
     get_program_files_dir(PROG_FILES_DIR);
 
     CreateDirectoryA("msitest", NULL);
@@ -601,6 +675,9 @@ static void test_MsiInstallProduct(void)
     HKEY hkey;
     DWORD num, size, type;
 
+    create_test_files();
+    create_database(msifile, tables, sizeof(tables) / sizeof(msi_table));
+
     r = MsiInstallProductA(msifile, NULL);
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
 
@@ -642,6 +719,8 @@ static void test_MsiInstallProduct(void)
     ok(num == 314, "Expected 314, got %d\n", num);
 
     RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest");
+
+    delete_test_files();
 }
 
 static void test_MsiSetComponentState(void)
@@ -650,6 +729,8 @@ static void test_MsiSetComponentState(vo
     char path[MAX_PATH];
     UINT r;
 
+    create_database(msifile, tables, sizeof(tables) / sizeof(msi_table));
+
     CoInitialize(NULL);
 
     lstrcpy(path, CURR_DIR);
@@ -673,6 +754,8 @@ static void test_MsiSetComponentState(vo
 
     MsiCloseHandle(package);
     CoUninitialize();
+
+    DeleteFileA(msifile);
 }
 
 static void test_packagecoltypes(void)
@@ -682,6 +765,8 @@ static void test_packagecoltypes(void)
     LPCSTR query;
     UINT r, count;
 
+    create_database(msifile, tables, sizeof(tables) / sizeof(msi_table));
+
     CoInitialize(NULL);
 
     lstrcpy(path, CURR_DIR);
@@ -727,17 +812,57 @@ static void test_packagecoltypes(void)
     DeleteFile(msifile);
 }
 
+static void test_installsequence(void)
+{
+    CHAR path[MAX_PATH];
+    DWORD size, type;
+    HKEY hkey;
+    LONG res;
+    UINT r;
+
+    create_database(msifile, sd_tables, sizeof(sd_tables) / sizeof(msi_table));
+
+    MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
+
+    r = MsiInstallProductA(msifile, NULL);
+    ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
+
+    res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", &hkey);
+    todo_wine
+    {
+        ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
+    }
+
+    size = MAX_PATH;
+    type = REG_SZ;
+    res = RegQueryValueExA(hkey, "OrderTestName", NULL, &type, (LPBYTE)path, &size);
+    todo_wine
+    {
+        ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
+        ok(!lstrcmpA(path, "OrderTestValue"), "Expected OrderTestValue, got %s\n", path);
+    }
+
+    RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest");
+
+    delete_test_files();
+    DeleteFileA(msifile);
+}
+
 START_TEST(install)
 {
+    DWORD len;
+
     if (!init_function_pointers())
         return;
 
-    create_test_files();
-    create_database(msifile, tables, sizeof(tables) / sizeof(msi_table));
+    GetCurrentDirectoryA(MAX_PATH, CURR_DIR);
+    len = lstrlenA(CURR_DIR);
+
+    if(len && (CURR_DIR[len-1] == '\\'))
+        CURR_DIR[len - 1] = 0;
 
     test_MsiInstallProduct();
     test_MsiSetComponentState();
     test_packagecoltypes();
-
-    delete_test_files();
+    test_installsequence();
 }
-- 
1.4.2.1



More information about the wine-patches mailing list