summaryrefslogtreecommitdiffstats
path: root/libmsi
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2012-12-04 13:39:08 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2012-12-06 20:30:33 +0100
commitb2015137b1af9aba2ffde189d3d9663e372a9c93 (patch)
treef3496df3e86cbf0067f6ae2069b3313553924660 /libmsi
parent9cf89fe383cfc8c86a4b9d60a67aa85e1ba20402 (diff)
downloadmsitools-b2015137b1af9aba2ffde189d3d9663e372a9c93.tar.gz
msitools-b2015137b1af9aba2ffde189d3d9663e372a9c93.tar.xz
msitools-b2015137b1af9aba2ffde189d3d9663e372a9c93.zip
delay writing storages to the outfile
Diffstat (limited to 'libmsi')
-rw-r--r--libmsi/database.c20
-rw-r--r--libmsi/msiquery.c29
-rw-r--r--libmsi/storages.c5
3 files changed, 28 insertions, 26 deletions
diff --git a/libmsi/database.c b/libmsi/database.c
index 1ea1eda..b3f1887 100644
--- a/libmsi/database.c
+++ b/libmsi/database.c
@@ -169,7 +169,6 @@ unsigned msi_create_storage( LibmsiDatabase *db, const WCHAR *stname, IStream *s
{
LibmsiStorage *storage;
IStorage *origstg = NULL;
- IStorage *substg = NULL;
bool found = false;
HRESULT hr;
unsigned r;
@@ -201,22 +200,6 @@ unsigned msi_create_storage( LibmsiDatabase *db, const WCHAR *stname, IStream *s
if (r != LIBMSI_RESULT_SUCCESS)
goto done;
- hr = IStorage_CreateStorage(db->outfile, stname,
- STGM_WRITE | STGM_SHARE_EXCLUSIVE,
- 0, 0, &substg);
- if (FAILED(hr))
- {
- r = LIBMSI_RESULT_FUNCTION_FAILED;
- goto done;
- }
-
- hr = IStorage_CopyTo(origstg, 0, NULL, NULL, substg);
- if (FAILED(hr))
- {
- r = LIBMSI_RESULT_FUNCTION_FAILED;
- goto done;
- }
-
if (found) {
if (storage->stg)
IStorage_Release(storage->stg);
@@ -237,8 +220,6 @@ done:
}
}
- if (substg)
- IStorage_Release(substg);
if (origstg)
IStorage_Release(origstg);
@@ -257,7 +238,6 @@ void msi_destroy_storage( LibmsiDatabase *db, const WCHAR *stname )
list_remove( &storage->entry );
IStorage_Release( storage->stg );
- IStorage_DestroyElement( storage->stg, stname );
msi_free( storage );
break;
}
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);
diff --git a/libmsi/storages.c b/libmsi/storages.c
index 6da08ed..a81bce0 100644
--- a/libmsi/storages.c
+++ b/libmsi/storages.c
@@ -373,8 +373,3 @@ unsigned storages_view_create(LibmsiDatabase *db, LibmsiView **view)
return LIBMSI_RESULT_SUCCESS;
}
-
-unsigned _libmsi_database_commit_storages( LibmsiDatabase *db )
-{
- return LIBMSI_RESULT_SUCCESS;
-}