msi: Conformance test, check that INSTALLUILEVEL flags do not trigger full UI install.

Misha Koshelev mk144210 at bcm.tmc.edu
Thu Feb 8 00:33:23 CST 2007


Thanks to James Hawkins for numerous emails and help. This patch is a
conformance test that tickles bug #6992 which is now fixed, where MSI
was comparing whether the UI level requested was greater than or equal
to a certain value to determine whether or not to do a graphical
install, but was ignoring the fact that flags could be set in the higher
bits that should not affect the UI level, and this, in turn, caused a
problem with the Vector NTI installer. This conformance test makes an
MSI with three files, one that is always created (this is a check for
installer working), one that is created only in full UI install (thus
the function can know that a full UI install occurred), and one that is
never created (I guess this would be making sure that the installer is
not completely ignoring conditions for file installation). It then
installs it, checks which ones were created, and gives the user
appropriate, verbose error messages.

I tested this conformance test and it is able to detect a UI versus
execute-only install in wine and in VMWared WinXP and Win98. It
successfully passes in its final form on all three platforms, and fails
if I revert the Wine behavior so that it does not take INSTALLUILEVEL
flags into account, telling the user that a full UI install occurred 
even though only an execute one was requested.

Changelog:

	* msi: Conformance test, check that INSTALLUILEVEL flags do not trigger
full UI install.
-------------- next part --------------
From bdb52c1d61fc330f681455508d4aa3fc229a4852 Mon Sep 17 00:00:00 2001
From: Misha Koshelev <mk144210 at bcm.tmc.edu>
Date: Thu, 8 Feb 2007 00:25:17 -0600
Subject: msi: Conformance test, check that INSTALLUILEVEL flags do not trigger full UI install.
---
 dlls/msi/tests/install.c |  112 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 112 insertions(+), 0 deletions(-)

diff --git a/dlls/msi/tests/install.c b/dlls/msi/tests/install.c
index 00b7763..7f94baa 100644
--- a/dlls/msi/tests/install.c
+++ b/dlls/msi/tests/install.c
@@ -214,6 +214,67 @@ static const CHAR mm_media_dat[] = "Disk
                                    "Media\tDiskId\n"
                                    "1\t3\t\ttest1.cab\tDISK1\t\n";
 
+/* tables for test_uiLevelFlags */
+static const CHAR ui_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
+                                    "s72\tS38\ts72\ti2\tS255\tS72\n"
+                                    "Component\tComponent\n"
+                                    "AlwaysInstall\t\tMSITESTDIR\t0\t1\tAlwaysInstall\n"
+                                    "NeverInstall\t\tMSITESTDIR\t0\t0\tNeverInstall\n"
+                                    "InstallFullUIOnly\t\tMSITESTDIR\t0\tISFULLUI=1\tInstallFullUIOnly";
+
+static const CHAR ui_feature_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 ui_feature_comp_dat[] = "Feature_\tComponent_\n"
+                                          "s38\ts72\n"
+                                          "FeatureComponents\tFeature_\tComponent_\n"
+                                          "feature\tAlwaysInstall\n"
+                                          "feature\tNeverInstall\n"
+                                          "feature\tInstallFullUIOnly\n";
+
+static const CHAR ui_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
+                               "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
+                               "File\tFile\n"
+                               "AlwaysInstall.txt\tAlwaysInstall\tAlwaysInstall.txt\t1000\t\t\t0\t1\n"
+                               "NeverInstall.txt\tNeverInstall\tNeverInstall.txt\t1000\t\t\t0\t2\n"
+                               "InstallFullUIOnly.txt\tInstallFullUIOnly\tInstallFullUIOnly.txt\t1000\t\t\t0\t3\n";
+
+static const CHAR ui_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
+                                "i2\ti4\tL64\tS255\tS32\tS72\n"
+                                "Media\tDiskId\n"
+                                "1\t3\t\t\tDISK1\t\n";
+
+static const CHAR ui_property_dat[] = "Property\tValue\n"
+                                   "s72\tl0\n"
+                                   "Property\tProperty\n"
+                                   "DefaultUIFont\tDlgFont8\n"
+                                   "INSTALLLEVEL\t3\n"
+                                   "ISFULLUI\t0\n"
+                                   "InstallMode\tTypical\n"
+                                   "Manufacturer\tWine\n"
+                                   "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
+                                   "ProductCode\t{F1C3AF50-8B56-4A69-A00C-00773FE42F30}\n"
+                                   "ProductID\tnone\n"
+                                   "ProductLanguage\t1033\n"
+                                   "ProductName\tMSITEST\n"
+                                   "ProductVersion\t1.1.1\n"
+                                   "PROMPTROLLBACKCOST\tP\n"
+                                   "Setup\tSetup\n"
+                                   "UpgradeCode\t{CE067E8D-2E1A-4367-B734-4EB2BDAD6565}";
+
+static const CHAR ui_install_ui_seq_dat[] = "Action\tCondition\tSequence\n"
+                                           "s72\tS255\tI2\n"
+                                           "InstallUISequence\tAction\n"
+                                           "SetFullUIProperty\t\t5\n"
+                                           "ExecuteAction\t\t1100\n";
+
+static const CHAR ui_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
+                                           "s72\ti2\tS64\tS0\tS255\n"
+                                           "CustomAction\tAction\n" 
+                                           "SetFullUIProperty\t51\tISFULLUI\t1\t\n";
+
 typedef struct _msi_table
 {
     const CHAR *filename;
@@ -286,6 +347,20 @@ static const msi_table mm_tables[] =
     ADD_TABLE(property),
 };
 
+static const msi_table ui_tables[] =
+{
+    ADD_TABLE(ui_component),
+    ADD_TABLE(directory),
+    ADD_TABLE(ui_feature),
+    ADD_TABLE(ui_feature_comp),
+    ADD_TABLE(ui_file),
+    ADD_TABLE(install_exec_seq),
+    ADD_TABLE(ui_install_ui_seq),
+    ADD_TABLE(ui_custom_action),
+    ADD_TABLE(ui_media),
+    ADD_TABLE(ui_property),
+};
+
 /* cabinet definitions */
 
 /* make the max size large so there is only one cab file */
@@ -1021,6 +1096,42 @@ static void test_mixedmedia(void)
     DeleteFile(msifile);
 }
 
+/* This test detects whether we are properly taking into account INSTALL_UILEVEL flags when
+ * MsiInstallProduct is deciding whether to start an execute-only or graphical UI install (bug
+ * 6992). We will request an execute-only test with a high flag set, and if the code is not
+ * properly screening out the flag, we will get a full UI install. One file will be installed
+ * both ways, which tells us the installer code is working. One file is installed only if a
+ * full UI install occurs. Tested for success and for ability to resolve UI vs execute-only
+ * install in Wine, Win98, and WinXP. */
+static void test_uiLevelFlags(void)
+{
+    UINT r;
+
+    /* Create test files */
+    CreateDirectoryA("msitest", NULL);
+    create_file("msitest\\AlwaysInstall.txt", 100);
+    create_file("msitest\\NeverInstall.txt", 100);
+    create_file("msitest\\InstallFullUIOnly.txt", 100);
+
+    create_database(msifile, ui_tables, sizeof(ui_tables) / sizeof(msi_table));
+
+    /* Set UI level */
+    MsiSetInternalUI(INSTALLUILEVEL_NONE | INSTALLUILEVEL_SOURCERESONLY, NULL);
+
+    r = MsiInstallProductA(msifile, NULL);
+    ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
+
+    ok(delete_pf("msitest\\AlwaysInstall.txt", TRUE), "File installed regardless of UI level was not installed.\n");
+    ok(!delete_pf("msitest\\NeverInstall.txt", TRUE), "File that should not have been installed was installed.\n");
+    ok(!delete_pf("msitest\\InstallFullUIOnly.txt", TRUE), "Full UI install occurred, but execute-only was requested.\n");
+
+    /* Delete test files */
+    DeleteFileA("msitest\\InstallFullUIOnly.txt");
+    DeleteFileA("msitest\\NeverInstall.txt");
+    DeleteFileA("msitest\\AlwaysInstall.txt");
+    RemoveDirectoryA("msitest");
+}
+
 START_TEST(install)
 {
     DWORD len;
@@ -1044,6 +1155,7 @@ START_TEST(install)
     test_continuouscabs();
     test_caborder();
     test_mixedmedia();
+    test_uiLevelFlags();
 
     SetCurrentDirectoryA(prev_path);
 }
-- 
1.4.1



More information about the wine-patches mailing list