msi: Remove stream from streams cache before destroying it.
This commit is contained in:
parent
367c2048a1
commit
faf750f2f7
|
@ -176,6 +176,37 @@ static void free_transforms( MSIDATABASE *db )
|
|||
}
|
||||
}
|
||||
|
||||
void db_destroy_stream( MSIDATABASE *db, LPCWSTR stname )
|
||||
{
|
||||
MSISTREAM *stream, *stream2;
|
||||
|
||||
LIST_FOR_EACH_ENTRY_SAFE( stream, stream2, &db->streams, MSISTREAM, entry )
|
||||
{
|
||||
HRESULT r;
|
||||
STATSTG stat;
|
||||
|
||||
r = IStream_Stat( stream->stm, &stat, 0 );
|
||||
if (FAILED(r))
|
||||
{
|
||||
WARN("failed to stat stream r = %08x\n", r);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!strcmpW( stname, stat.pwcsName ))
|
||||
{
|
||||
TRACE("destroying %s\n", debugstr_w(stname));
|
||||
|
||||
list_remove( &stream->entry );
|
||||
IStream_Release( stream->stm );
|
||||
msi_free( stream );
|
||||
IStorage_DestroyElement( db->storage, stname );
|
||||
CoTaskMemFree( stat.pwcsName );
|
||||
break;
|
||||
}
|
||||
CoTaskMemFree( stat.pwcsName );
|
||||
}
|
||||
}
|
||||
|
||||
static void free_streams( MSIDATABASE *db )
|
||||
{
|
||||
while( !list_empty( &db->streams ) )
|
||||
|
|
|
@ -722,6 +722,7 @@ extern BOOL decode_streamname(LPCWSTR in, LPWSTR out);
|
|||
|
||||
/* database internals */
|
||||
extern UINT db_get_raw_stream( MSIDATABASE *, LPCWSTR, IStream ** );
|
||||
void db_destroy_stream( MSIDATABASE *, LPCWSTR );
|
||||
extern UINT MSI_OpenDatabaseW( LPCWSTR, LPCWSTR, MSIDATABASE ** );
|
||||
extern UINT MSI_DatabaseOpenViewW(MSIDATABASE *, LPCWSTR, MSIQUERY ** );
|
||||
extern UINT MSI_OpenQuery( MSIDATABASE *, MSIQUERY **, LPCWSTR, ... );
|
||||
|
|
|
@ -183,7 +183,7 @@ static UINT STREAMS_set_row(struct tagMSIVIEW *view, UINT row, MSIRECORD *rec, U
|
|||
}
|
||||
|
||||
encname = encode_streamname(FALSE, name);
|
||||
IStorage_DestroyElement(sv->db->storage, encname);
|
||||
db_destroy_stream(sv->db, encname);
|
||||
|
||||
r = write_stream_data(sv->db->storage, name, data, count, FALSE);
|
||||
if (r != ERROR_SUCCESS)
|
||||
|
|
Loading…
Reference in New Issue