Skip to content

Commit 5c718f5

Browse files
winesynclearn-more
authored andcommitted
[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]>
1 parent f78dfea commit 5c718f5

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

dll/win32/msi/table.c

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1966,6 +1966,20 @@ static UINT TABLE_remove_column(struct tagMSIVIEW *view, LPCWSTR table, UINT num
19661966
MSIVIEW *columns = NULL;
19671967
UINT row, r;
19681968

1969+
if (tv->table->col_count != number)
1970+
return ERROR_BAD_QUERY_SYNTAX;
1971+
1972+
if (tv->table->colinfo[number-1].temporary)
1973+
{
1974+
UINT size = tv->table->colinfo[number-1].offset;
1975+
tv->table->col_count--;
1976+
tv->table->colinfo = msi_realloc( tv->table->colinfo, sizeof(*tv->table->colinfo) * tv->table->col_count );
1977+
1978+
for (row = 0; row < tv->table->row_count; row++)
1979+
tv->table->data[row] = msi_realloc( tv->table->data[row], size );
1980+
return ERROR_SUCCESS;
1981+
}
1982+
19691983
rec = MSI_CreateRecord(2);
19701984
if (!rec)
19711985
return ERROR_OUTOFMEMORY;
@@ -2000,11 +2014,12 @@ static UINT TABLE_release(struct tagMSIVIEW *view)
20002014
{
20012015
MSITABLEVIEW *tv = (MSITABLEVIEW*)view;
20022016
INT ref = tv->table->ref_count;
2003-
UINT i, r;
2017+
UINT r;
2018+
INT i;
20042019

20052020
TRACE("%p %d\n", view, ref);
20062021

2007-
for (i = 0; i < tv->table->col_count; i++)
2022+
for (i = tv->table->col_count - 1; i >= 0; i--)
20082023
{
20092024
if (tv->table->colinfo[i].type & MSITYPE_TEMPORARY)
20102025
{

0 commit comments

Comments
 (0)