Module: wine Branch: master Commit: c8e8f44168bfb6c47674ae06ba2ae1823d52b496 URL: http://source.winehq.org/git/wine.git/?a=commit;h=c8e8f44168bfb6c47674ae06ba...
Author: Hans Leidekker hans@codeweavers.com Date: Tue Jan 24 10:03:59 2012 +0100
msi: Use the column count specified in the table transform data.
It can be smaller than the number of columns found in the table meta data.
---
dlls/msi/table.c | 27 +++++++++++++-------------- 1 files changed, 13 insertions(+), 14 deletions(-)
diff --git a/dlls/msi/table.c b/dlls/msi/table.c index d3c6714..d37947e 100644 --- a/dlls/msi/table.c +++ b/dlls/msi/table.c @@ -2501,14 +2501,12 @@ static UINT msi_table_load_transform( MSIDATABASE *db, IStorage *stg, string_table *st, TRANSFORMDATA *transform, UINT bytes_per_strref ) { - UINT rawsize = 0; BYTE *rawdata = NULL; MSITABLEVIEW *tv = NULL; - UINT r, n, sz, i, mask; + UINT r, n, sz, i, mask, num_cols, colcol = 0, rawsize = 0; MSIRECORD *rec = NULL; - UINT colcol = 0; WCHAR coltable[32]; - LPWSTR name; + const WCHAR *name;
if (!transform) return ERROR_SUCCESS; @@ -2539,18 +2537,18 @@ static UINT msi_table_load_transform( MSIDATABASE *db, IStorage *stg, debugstr_w(name), tv->num_cols, tv->row_size, rawsize );
/* interpret the data */ - for( n=0; n < rawsize; ) + for (n = 0; n < rawsize;) { - mask = rawdata[n] | (rawdata[n+1] << 8); - - if (mask&1) + mask = rawdata[n] | (rawdata[n + 1] << 8); + if (mask & 1) { /* * if the low bit is set, columns are continuous and * the number of columns is specified in the high byte */ sz = 2; - for( i=0; i<tv->num_cols; i++ ) + num_cols = mask >> 8; + for (i = 0; i < num_cols; i++) { if( (tv->columns[i].type & MSITYPE_STRING) && ! MSITYPE_IS_BINARY(tv->columns[i].type) ) @@ -2570,12 +2568,13 @@ static UINT msi_table_load_transform( MSIDATABASE *db, IStorage *stg, * and it means that this row should be deleted. */ sz = 2; - for( i=0; i<tv->num_cols; i++ ) + num_cols = tv->num_cols; + for (i = 0; i < num_cols; i++) { - if( (tv->columns[i].type & MSITYPE_KEY) || ((1<<i)&mask)) + if ((tv->columns[i].type & MSITYPE_KEY) || ((1 << i) & mask)) { - if( (tv->columns[i].type & MSITYPE_STRING) && - ! MSITYPE_IS_BINARY(tv->columns[i].type) ) + if ((tv->columns[i].type & MSITYPE_STRING) && + !MSITYPE_IS_BINARY(tv->columns[i].type)) sz += bytes_per_strref; else sz += bytes_per_column( tv->db, &tv->columns[i], bytes_per_strref ); @@ -2584,7 +2583,7 @@ static UINT msi_table_load_transform( MSIDATABASE *db, IStorage *stg, }
/* check we didn't run of the end of the table */ - if ( (n+sz) > rawsize ) + if (n + sz > rawsize) { ERR("borked.\n"); dump_table( st, (USHORT *)rawdata, rawsize );