[PATCH resend 5/5] msi: Add support for ActionText table.

Zebediah Figura z.figura12 at gmail.com
Sun Jul 23 20:49:05 CDT 2017


Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
Seems I accidentally submitted this one before I was done with it...
 dlls/msi/action.c        | 15 ++++++++++++++-
 dlls/msi/tests/package.c | 25 +++++++++++++++++++++++--
 2 files changed, 37 insertions(+), 3 deletions(-)

diff --git a/dlls/msi/action.c b/dlls/msi/action.c
index b521925..64e01c4 100644
--- a/dlls/msi/action.c
+++ b/dlls/msi/action.c
@@ -160,13 +160,26 @@ static const WCHAR szWriteEnvironmentStrings[] =
 
 static INT ui_actionstart(MSIPACKAGE *package, LPCWSTR action, LPCWSTR description, LPCWSTR template)
 {
-    MSIRECORD *row = MSI_CreateRecord(3);
+    WCHAR query[] = {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
+        '`','A','c','t','i','o','n','T','e','x','t','`',' ','W','H','E','R','E',' ',
+        '`','A','c','t','i','o','n','`',' ','=',' ','\'','%','s','\'',0};
+    MSIRECORD *row, *textrow;
     INT rc;
+
+    textrow = MSI_QueryGetRecord(package->db, query, action);
+    if (textrow)
+    {
+        description = MSI_RecordGetString(textrow, 2);
+        template = MSI_RecordGetString(textrow, 3);
+    }
+
+    row = MSI_CreateRecord(3);
     if (!row) return -1;
     MSI_RecordSetStringW(row, 1, action);
     MSI_RecordSetStringW(row, 2, description);
     MSI_RecordSetStringW(row, 3, template);
     rc = MSI_ProcessMessage(package, INSTALLMESSAGE_ACTIONSTART, row);
+    if (textrow) msiobj_release(&textrow->hdr);
     msiobj_release(&row->hdr);
     return rc;
 }
diff --git a/dlls/msi/tests/package.c b/dlls/msi/tests/package.c
index ef37f8b..5357257 100644
--- a/dlls/msi/tests/package.c
+++ b/dlls/msi/tests/package.c
@@ -687,6 +687,16 @@ static UINT create_controlevent_table( MSIHANDLE hdb )
             "PRIMARY KEY `Dialog_`, `Control_`, `Event`, `Argument`, `Condition`)");
 }
 
+static UINT create_actiontext_table( MSIHANDLE hdb )
+{
+    return run_query(hdb,
+            "CREATE TABLE `ActionText` ("
+            "`Action` CHAR(72) NOT NULL, "
+            "`Description` CHAR(64) LOCALIZABLE, "
+            "`Template` CHAR(128) LOCALIZABLE "
+            "PRIMARY KEY `Action`)");
+}
+
 #define make_add_entry(type, qtext) \
     static UINT add##_##type##_##entry( MSIHANDLE hdb, const char *values ) \
     { \
@@ -782,6 +792,10 @@ make_add_entry(controlevent,
                "INSERT INTO `ControlEvent` "
                "(`Dialog_`, `Control_`, `Event`, `Argument`, `Condition`, `Ordering`) VALUES( %s )");
 
+make_add_entry(actiontext,
+               "INSERT INTO `ActionText` "
+               "(`Action`, `Description`, `Template`) VALUES( %s )");
+
 static UINT add_reglocator_entry( MSIHANDLE hdb, const char *sig, UINT root, const char *path,
                                   const char *name, UINT type )
 {
@@ -9394,14 +9408,14 @@ static const struct externalui_message processmessage_error_format_sequence[] =
 };
 
 static const struct externalui_message doaction_costinitialize_sequence[] = {
-    {INSTALLMESSAGE_ACTIONSTART, 3, {"", "CostInitialize", "", ""}, {0, 1, 0, 1}},
+    {INSTALLMESSAGE_ACTIONSTART, 3, {"", "CostInitialize", "cost description", "cost template"}, {0, 1, 1, 1}},
     {INSTALLMESSAGE_INFO, 2, {"", "CostInitialize", ""}, {0, 1, 1}},
     {INSTALLMESSAGE_INFO, 2, {"", "CostInitialize", "1"}, {0, 1, 1}},
     {0}
 };
 
 static const struct externalui_message doaction_custom_sequence[] = {
-    {INSTALLMESSAGE_ACTIONSTART, 3, {"", "custom", "", ""}, {0, 1, 1, 1}},
+    {INSTALLMESSAGE_ACTIONSTART, 3, {"", "custom", "description", "template"}, {0, 1, 1, 1}},
     {INSTALLMESSAGE_INFO, 2, {"", "custom", "1"}, {0, 1, 1}},
     {INSTALLMESSAGE_INFO, 2, {"", "custom", "0"}, {0, 1, 1}},
     {0}
@@ -9540,6 +9554,13 @@ static void test_externalui_message(void)
     r = run_query(hdb, "INSERT INTO `Error` (`Error`, `Message`) VALUES (5, 'internal error')");
     ok(r == ERROR_SUCCESS, "Failed to insert into Error table: %u\n", r);
 
+    r = create_actiontext_table(hdb);
+    ok(r == ERROR_SUCCESS, "Failed to create ActionText table: %u\n", r);
+    r = add_actiontext_entry(hdb, "'custom', 'description', 'template'");
+    ok(r == ERROR_SUCCESS, "Failed to insert into ActionText table: %u\n", r);
+    r = add_actiontext_entry(hdb, "'CostInitialize', 'cost description', 'cost template'");
+    ok(r == ERROR_SUCCESS, "Failed to insert into ActionText table: %u\n", r);
+
     r = MsiOpenPackageA(NULL, &hpkg);
     ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
     ok_sequence(empty_sequence, "MsiOpenPackage with NULL db", FALSE);
-- 
2.7.4




More information about the wine-patches mailing list