msi: Test the Installed property.
authorHans Leidekker <hans@codeweavers.com>
Tue, 29 Sep 2009 12:56:26 +0000 (14:56 +0200)
committerAlexandre Julliard <julliard@winehq.org>
Tue, 29 Sep 2009 14:06:22 +0000 (16:06 +0200)
dlls/msi/custom.c
dlls/msi/tests/install.c

index 7fcb09a0df2792425ee7b9d892e0c4e5c4a7782a..5ac9c1b24d300951ff328e55f7a3d3d1e9ece4e7 100644 (file)
@@ -1055,7 +1055,7 @@ static UINT HANDLE_CustomType19(MSIPACKAGE *package, LPCWSTR source,
 
     msi_free( deformated );
 
-    return ERROR_FUNCTION_FAILED;
+    return ERROR_INSTALL_FAILURE;
 }
 
 static UINT HANDLE_CustomType50(MSIPACKAGE *package, LPCWSTR source,
index 9a33b7919c0623ab349058f62ee6fe8170542bd1..627b81c47eeab9af36e4559ffd8900f84162059b 100644 (file)
@@ -886,6 +886,32 @@ static const CHAR ai_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion
                                   "file\tcomponent\tfilename\t100\t\t\t8192\t1\n"
                                   "service_file\tservice_comp\tservice.exe\t100\t\t\t8192\t1";
 
+static const CHAR ip_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"
+                                              "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"
+                                              "TestInstalledProp\tInstalled AND NOT REMOVE\t950\n";
+
+static const CHAR ip_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
+                                           "s72\ti2\tS64\tS0\tS255\n"
+                                           "CustomAction\tAction\n"
+                                           "TestInstalledProp\t19\t\tTest failed\t\n";
+
 typedef struct _msi_table
 {
     const CHAR *filename;
@@ -1500,6 +1526,19 @@ static const msi_table pc_tables[] =
     ADD_TABLE(property)
 };
 
+static const msi_table ip_tables[] =
+{
+    ADD_TABLE(component),
+    ADD_TABLE(directory),
+    ADD_TABLE(feature),
+    ADD_TABLE(feature_comp),
+    ADD_TABLE(file),
+    ADD_TABLE(ip_install_exec_seq),
+    ADD_TABLE(ip_custom_action),
+    ADD_TABLE(media),
+    ADD_TABLE(property)
+};
+
 /* cabinet definitions */
 
 /* make the max size large so there is only one cab file */
@@ -6600,6 +6639,44 @@ static void test_preselected(void)
     delete_test_files();
 }
 
+static void test_installed_prop(void)
+{
+    static char prodcode[] = "{7df88a48-996f-4ec8-a022-bf956f9b2cbb}";
+    UINT r;
+
+    create_test_files();
+    create_database(msifile, ip_tables, sizeof(ip_tables) / sizeof(msi_table));
+
+    MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
+
+    r = MsiInstallProductA(msifile, "FULL=1");
+    ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
+
+    r = MsiInstallProductA(msifile, "FULL=1");
+    ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
+
+    r = MsiConfigureProductExA(prodcode, INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT, "FULL=1");
+    ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
+
+    ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
+    ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
+    ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
+    ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
+    ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
+    ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
+    ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
+    ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
+    ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
+    ok(delete_pf("msitest\\one.txt", TRUE), "File installed\n");
+    ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
+    ok(delete_pf("msitest", FALSE), "File not installed\n");
+
+    r = MsiInstallProductA(msifile, "REMOVE=ALL");
+    ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
+
+    delete_test_files();
+}
+
 START_TEST(install)
 {
     DWORD len;
@@ -6685,6 +6762,7 @@ START_TEST(install)
     test_envvar();
     test_lastusedsource();
     test_preselected();
+    test_installed_prop();
 
     DeleteFileA(log_file);