https://git.reactos.org/?p=reactos.git;a=commitdiff;h=4048c060fc2c33358dd8a…
commit 4048c060fc2c33358dd8ae6c5bcb251d86060a92
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:30 2022 +0100
[WINESYNC] msi: Support DELETE 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 b1f9f4ccee6f7d42dbeaf457e81db462a1b526af by Piotr Caban
<piotr(a)codeweavers.com>
---
dll/win32/msi/table.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 51 insertions(+), 2 deletions(-)
diff --git a/dll/win32/msi/table.c b/dll/win32/msi/table.c
index 95da84a92dc..a413808e8a3 100644
--- a/dll/win32/msi/table.c
+++ b/dll/win32/msi/table.c
@@ -2600,7 +2600,15 @@ static UINT TransformView_drop_table( MSITABLEVIEW *tv, UINT row )
static UINT TransformView_delete_row( MSIVIEW *view, UINT row )
{
+ static const WCHAR query_pfx[] = L"INSERT INTO `_TransformView` ( `Table`,
`Column`, `Row`) VALUES ( '";
+ static const WCHAR query_column[] = L"', 'DELETE', '";
+ static const WCHAR query_sfx[] = L"')";
+
MSITABLEVIEW *tv = (MSITABLEVIEW*)view;
+ WCHAR *key, buf[256], *query = buf;
+ UINT r, len, name_len, key_len;
+ MSIRECORD *rec;
+ MSIQUERY *q;
if (!wcscmp( tv->name, szColumns ))
{
@@ -2611,8 +2619,49 @@ static UINT TransformView_delete_row( MSIVIEW *view, UINT row )
if (!wcscmp( tv->name, szTables ))
return TransformView_drop_table( tv, row );
- FIXME("\n");
- return ERROR_CALL_NOT_IMPLEMENTED;
+ r = msi_view_get_row( tv->db, view, row, &rec );
+ if (r != ERROR_SUCCESS)
+ return r;
+
+ key = create_key_string( tv, rec );
+ msiobj_release( &rec->hdr );
+ if (!key)
+ return ERROR_OUTOFMEMORY;
+
+ name_len = wcslen( tv->name );
+ key_len = wcslen( key );
+ len = ARRAY_SIZE(query_pfx) + name_len + ARRAY_SIZE(query_column) + key_len +
ARRAY_SIZE(query_sfx) - 2;
+ if (len > ARRAY_SIZE(buf))
+ {
+ query = msi_alloc( len * sizeof(WCHAR) );
+ if (!query)
+ {
+ msi_free( tv );
+ msi_free( key );
+ return ERROR_OUTOFMEMORY;
+ }
+ }
+
+ memcpy( query, query_pfx, ARRAY_SIZE(query_pfx) * sizeof(WCHAR) );
+ len = ARRAY_SIZE(query_pfx) - 1;
+ memcpy( query + len, tv->name, name_len * sizeof(WCHAR) );
+ len += name_len;
+ memcpy( query + len, query_column, ARRAY_SIZE(query_column) * sizeof(WCHAR) );
+ len += ARRAY_SIZE(query_column) - 1;
+ memcpy( query + len, key, key_len * sizeof(WCHAR) );
+ len += key_len;
+ memcpy( query + len, query_sfx, ARRAY_SIZE(query_sfx) * sizeof(WCHAR) );
+ msi_free( key );
+
+ 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_execute( MSIVIEW *view, MSIRECORD *record )