https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5c718f5f5ccfdbba923626d6151c7d1b2744597a

commit 5c718f5f5ccfdbba923626d6151c7d1b2744597a
Author:     winesync <[email protected]>
AuthorDate: Sun Mar 13 19:08:40 2022 +0100
Commit:     Mark Jansen <[email protected]>
CommitDate: Sun Mar 20 19:28:30 2022 +0100

    [WINESYNC] msi: Support removing temporary columns in TABLE_remove_column.
    
    Signed-off-by: Piotr Caban <[email protected]>
    Signed-off-by: Hans Leidekker <[email protected]>
    Signed-off-by: Alexandre Julliard <[email protected]>
    
    wine commit id 5d568279dc0b842206918ba87a955298e72973ae by Piotr Caban 
<[email protected]>
---
 dll/win32/msi/table.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/dll/win32/msi/table.c b/dll/win32/msi/table.c
index a413808e8a3..db4dd59f958 100644
--- a/dll/win32/msi/table.c
+++ b/dll/win32/msi/table.c
@@ -1966,6 +1966,20 @@ static UINT TABLE_remove_column(struct tagMSIVIEW *view, 
LPCWSTR table, UINT num
     MSIVIEW *columns = NULL;
     UINT row, r;
 
+    if (tv->table->col_count != number)
+        return ERROR_BAD_QUERY_SYNTAX;
+
+    if (tv->table->colinfo[number-1].temporary)
+    {
+        UINT size = tv->table->colinfo[number-1].offset;
+        tv->table->col_count--;
+        tv->table->colinfo = msi_realloc( tv->table->colinfo, 
sizeof(*tv->table->colinfo) * tv->table->col_count );
+
+        for (row = 0; row < tv->table->row_count; row++)
+            tv->table->data[row] = msi_realloc( tv->table->data[row], size );
+        return ERROR_SUCCESS;
+    }
+
     rec = MSI_CreateRecord(2);
     if (!rec)
         return ERROR_OUTOFMEMORY;
@@ -2000,11 +2014,12 @@ static UINT TABLE_release(struct tagMSIVIEW *view)
 {
     MSITABLEVIEW *tv = (MSITABLEVIEW*)view;
     INT ref = tv->table->ref_count;
-    UINT i, r;
+    UINT r;
+    INT i;
 
     TRACE("%p %d\n", view, ref);
 
-    for (i = 0; i < tv->table->col_count; i++)
+    for (i = tv->table->col_count - 1; i >= 0; i--)
     {
         if (tv->table->colinfo[i].type & MSITYPE_TEMPORARY)
         {

Reply via email to