https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9d793f296e5f4fda2acb3…
commit 9d793f296e5f4fda2acb3e852ba906942bdcca3d
Author: winesync <ros-dev(a)reactos.org>
AuthorDate: Sun Mar 13 19:08:39 2022 +0100
Commit: Mark Jansen <mark.jansen(a)reactos.org>
CommitDate: Sun Mar 20 19:28:29 2022 +0100
[WINESYNC] msi: Support DROP when MSITRANSFORM_ERROR_VIEWTRANSFORM flag is used.
Signed-off-by: Piotr Caban <piotr(a)codeweavers.com>
Signed-off-by: Hans Leidekker <hans(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
wine commit id 6b6e1bd2c73ac23b03db0e656f895896936df5ba by Piotr Caban
<piotr(a)codeweavers.com>
---
dll/win32/msi/table.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 55 insertions(+)
diff --git a/dll/win32/msi/table.c b/dll/win32/msi/table.c
index e6b5a09375b..95da84a92dc 100644
--- a/dll/win32/msi/table.c
+++ b/dll/win32/msi/table.c
@@ -2554,8 +2554,63 @@ static UINT TransformView_insert_row( MSIVIEW *view, MSIRECORD
*rec, UINT row, B
return TransformView_set_row( view, row, rec, ~0 );
}
+static UINT TransformView_drop_table( MSITABLEVIEW *tv, UINT row )
+{
+ static const WCHAR query_pfx[] = L"INSERT INTO `_TransformView` ( `Table`,
`Column` ) VALUES ( '";
+ static const WCHAR query_sfx[] = L"', 'DROP' )";
+
+ WCHAR buf[256], *query = buf;
+ UINT r, table_id, len;
+ const WCHAR *table;
+ int table_len;
+ MSIQUERY *q;
+
+ r = TABLE_fetch_int( &tv->view, row, 1, &table_id );
+ if (r != ERROR_SUCCESS)
+ return r;
+
+ table = msi_string_lookup( tv->db->strings, table_id, &table_len );
+ if (!table)
+ return ERROR_INSTALL_TRANSFORM_FAILURE;
+
+ len = ARRAY_SIZE(query_pfx) - 1 + table_len + ARRAY_SIZE(query_sfx);
+ if (len > ARRAY_SIZE(buf))
+ {
+ query = msi_alloc( len * sizeof(WCHAR) );
+ if (!query)
+ return ERROR_OUTOFMEMORY;
+ }
+
+ memcpy( query, query_pfx, ARRAY_SIZE(query_pfx) * sizeof(WCHAR) );
+ len = ARRAY_SIZE(query_pfx) - 1;
+ memcpy( query + len, table, table_len * sizeof(WCHAR) );
+ len += table_len;
+ memcpy( query + len, query_sfx, ARRAY_SIZE(query_sfx) * sizeof(WCHAR) );
+
+ r = MSI_DatabaseOpenViewW( tv->db, query, &q );
+ if (query != buf)
+ msi_free( query );
+ if (r != ERROR_SUCCESS)
+ return r;
+
+ r = MSI_ViewExecute( q, NULL );
+ msiobj_release( &q->hdr );
+ return r;
+}
+
static UINT TransformView_delete_row( MSIVIEW *view, UINT row )
{
+ MSITABLEVIEW *tv = (MSITABLEVIEW*)view;
+
+ if (!wcscmp( tv->name, szColumns ))
+ {
+ ERR("trying to remove column\n");
+ return ERROR_INSTALL_TRANSFORM_FAILURE;
+ }
+
+ if (!wcscmp( tv->name, szTables ))
+ return TransformView_drop_table( tv, row );
+
FIXME("\n");
return ERROR_CALL_NOT_IMPLEMENTED;
}