Commit f53ba3ca authored by Mike McCormack's avatar Mike McCormack Committed by Alexandre Julliard

msi: Transform the _Columns and _Tables tables first so the table metadata is…

msi: Transform the _Columns and _Tables tables first so the table metadata is present for new tables.
parent 2c626c9d
......@@ -1833,6 +1833,13 @@ static UINT msi_table_load_transform( MSIDATABASE *db, IStorage *stg,
TRACE("%p %p %p %s\n", db, stg, st, debugstr_w(name) );
read_stream_data( stg, name, &rawdata, &rawsize );
if ( !rawdata )
{
TRACE("table %s empty\n", debugstr_w(name) );
return ERROR_INVALID_TABLE;
}
/* create a table view */
r = TABLE_CreateView( db, name, (MSIVIEW**) &tv );
if( r != ERROR_SUCCESS )
......@@ -1958,6 +1965,18 @@ UINT msi_table_apply_transform( MSIDATABASE *db, IStorage *stg )
if( FAILED( r ) )
goto end;
/*
* Apply _Tables and _Coluimns transforms first so that
* the table metadata is correct, and empty tables exist.
*/
ret = msi_table_load_transform( db, stg, strings, szTables );
if (ret != ERROR_SUCCESS && ret != ERROR_INVALID_TABLE)
goto end;
ret = msi_table_load_transform( db, stg, strings, szColumns );
if (ret != ERROR_SUCCESS && ret != ERROR_INVALID_TABLE)
goto end;
ret = ERROR_SUCCESS;
while( r == ERROR_SUCCESS )
......@@ -1968,12 +1987,15 @@ UINT msi_table_apply_transform( MSIDATABASE *db, IStorage *stg )
break;
decode_streamname( stat.pwcsName, name );
TRACE("transform contains stream %s\n", debugstr_w(name));
if ( name[0] != 0x4840 )
continue;
if ( !lstrcmpW(name+1, szStringPool ) || !lstrcmpW(name+1, szStringData) )
TRACE("transform contains stream %s\n", debugstr_w(name));
if ( !lstrcmpW( name+1, szStringPool ) ||
!lstrcmpW( name+1, szStringData ) ||
!lstrcmpW( name+1, szColumns ) ||
!lstrcmpW( name+1, szTables ) )
continue;
ret = msi_table_load_transform( db, stg, strings, name+1 );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment