diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2012-12-04 13:39:08 +0100 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2012-12-06 20:30:33 +0100 |
commit | b2015137b1af9aba2ffde189d3d9663e372a9c93 (patch) | |
tree | f3496df3e86cbf0067f6ae2069b3313553924660 /libmsi/msiquery.c | |
parent | 9cf89fe383cfc8c86a4b9d60a67aa85e1ba20402 (diff) | |
download | msitools-b2015137b1af9aba2ffde189d3d9663e372a9c93.tar.gz msitools-b2015137b1af9aba2ffde189d3d9663e372a9c93.tar.xz msitools-b2015137b1af9aba2ffde189d3d9663e372a9c93.zip |
delay writing storages to the outfile
Diffstat (limited to 'libmsi/msiquery.c')
-rw-r--r-- | libmsi/msiquery.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/libmsi/msiquery.c b/libmsi/msiquery.c index aa0c7f7..681cf3e 100644 --- a/libmsi/msiquery.c +++ b/libmsi/msiquery.c @@ -600,6 +600,33 @@ LibmsiResult libmsi_database_apply_transform( LibmsiDatabase *db, return r; } +static unsigned commit_storage( const WCHAR *name, IStorage *stg, void *opaque) +{ + LibmsiDatabase *db = opaque; + STATSTG stat; + IStream *outstg; + ULARGE_INTEGER cbRead, cbWritten; + unsigned ret = LIBMSI_RESULT_FUNCTION_FAILED; + HRESULT r; + + TRACE("%s %p %p\n", debugstr_w(name), stg, opaque); + + r = IStorage_CreateStorage( db->outfile, name, + STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &outstg); + if ( FAILED(r) ) + return LIBMSI_RESULT_FUNCTION_FAILED; + + r = IStorage_CopyTo( stg, 0, NULL, NULL, outstg ); + if ( FAILED(r) ) + goto end; + + ret = LIBMSI_RESULT_SUCCESS; + +end: + IStorage_Release(outstg); + return ret; +} + static unsigned commit_stream( const WCHAR *name, IStream *stm, void *opaque) { LibmsiDatabase *db = opaque; @@ -661,7 +688,7 @@ LibmsiResult libmsi_database_commit( LibmsiDatabase *db ) goto end; } - r = _libmsi_database_commit_storages( db ); + r = msi_enum_db_storages( db, commit_storage, db ); if (r != LIBMSI_RESULT_SUCCESS) { WARN("failed to save storages r=%08x\n",r); |