msi: Initialize the summary information from a storage interface, not a db.

This commit is contained in:
Mike McCormack 2006-10-24 01:11:30 +09:00 committed by Alexandre Julliard
parent fd7f9b735d
commit 7f98f1d086
4 changed files with 13 additions and 16 deletions

View File

@ -460,7 +460,7 @@ static UINT msi_parse_patch_summary( MSIPACKAGE *package, MSIDATABASE *patch_db
LPWSTR str, *substorage;
UINT i, r = ERROR_SUCCESS;
si = MSI_GetSummaryInformationW( patch_db, 0 );
si = MSI_GetSummaryInformationW( patch_db->storage, 0 );
if (!si)
return ERROR_FUNCTION_FAILED;

View File

@ -57,15 +57,12 @@ DEFINE_GUID( CLSID_MsiPatch, 0x000c1086, 0x0000, 0x0000,
static VOID MSI_CloseDatabase( MSIOBJECTHDR *arg )
{
MSIDATABASE *db = (MSIDATABASE *) arg;
DWORD r;
msi_free(db->path);
free_cached_tables( db );
msi_free_transforms( db );
msi_destroy_stringtable( db->strings );
r = IStorage_Release( db->storage );
if( r )
ERR("database reference count was not zero (%d)\n", r);
IStorage_Release( db->storage );
if (db->deletefile)
{
DeleteFileW( db->deletefile );

View File

@ -256,7 +256,7 @@ typedef struct tagMSIPREVIEW
typedef struct tagMSISUMMARYINFO
{
MSIOBJECTHDR hdr;
MSIDATABASE *db;
IStorage *storage;
DWORD update_count;
PROPVARIANT property[MSI_MAX_PROPS];
} MSISUMMARYINFO;
@ -686,7 +686,7 @@ extern MSIPREVIEW *MSI_EnableUIPreview( MSIDATABASE * );
extern UINT MSI_PreviewDialogW( MSIPREVIEW *, LPCWSTR );
/* summary information */
extern MSISUMMARYINFO *MSI_GetSummaryInformationW( MSIDATABASE *db, UINT uiUpdateCount );
extern MSISUMMARYINFO *MSI_GetSummaryInformationW( IStorage *stg, UINT uiUpdateCount );
extern LPWSTR msi_suminfo_dup_string( MSISUMMARYINFO *si, UINT uiProperty );
/* undocumented functions */

View File

@ -96,7 +96,7 @@ static void MSI_CloseSummaryInfo( MSIOBJECTHDR *arg )
for( i = 0; i < MSI_MAX_PROPS; i++ )
free_prop( &si->property[i] );
msiobj_release( &si->db->hdr );
IStorage_Release( si->storage );
}
static UINT get_type( UINT uiProperty )
@ -105,7 +105,7 @@ static UINT get_type( UINT uiProperty )
{
case PID_CODEPAGE:
return VT_I2;
case PID_SUBJECT:
case PID_AUTHOR:
case PID_KEYWORDS:
@ -405,28 +405,28 @@ static UINT save_summary_info( MSISUMMARYINFO * si, IStream *stm )
return ERROR_SUCCESS;
}
MSISUMMARYINFO *MSI_GetSummaryInformationW( MSIDATABASE *db, UINT uiUpdateCount )
MSISUMMARYINFO *MSI_GetSummaryInformationW( IStorage *stg, UINT uiUpdateCount )
{
IStream *stm = NULL;
MSISUMMARYINFO *si;
DWORD grfMode;
HRESULT r;
TRACE("%p %d\n", db, uiUpdateCount );
TRACE("%p %d\n", stg, uiUpdateCount );
si = alloc_msiobject( MSIHANDLETYPE_SUMMARYINFO,
sizeof (MSISUMMARYINFO), MSI_CloseSummaryInfo );
if( !si )
return si;
msiobj_addref( &db->hdr );
si->db = db;
memset( &si->property, 0, sizeof si->property );
si->update_count = uiUpdateCount;
IStorage_AddRef( stg );
si->storage = stg;
/* read the stream... if we fail, we'll start with an empty property set */
grfMode = STGM_READ | STGM_SHARE_EXCLUSIVE;
r = IStorage_OpenStream( si->db->storage, szSumInfo, 0, grfMode, 0, &stm );
r = IStorage_OpenStream( si->storage, szSumInfo, 0, grfMode, 0, &stm );
if( SUCCEEDED(r) )
{
load_summary_info( si, stm );
@ -462,7 +462,7 @@ UINT WINAPI MsiGetSummaryInformationW( MSIHANDLE hDatabase,
return ERROR_INVALID_PARAMETER;
}
si = MSI_GetSummaryInformationW( db, uiUpdateCount );
si = MSI_GetSummaryInformationW( db->storage, uiUpdateCount );
if (si)
{
*pHandle = alloc_msihandle( &si->hdr );
@ -749,7 +749,7 @@ UINT WINAPI MsiSummaryInfoPersist( MSIHANDLE handle )
return ERROR_INVALID_HANDLE;
grfMode = STGM_CREATE | STGM_READWRITE | STGM_SHARE_EXCLUSIVE;
r = IStorage_CreateStream( si->db->storage, szSumInfo, grfMode, 0, 0, &stm );
r = IStorage_CreateStream( si->storage, szSumInfo, grfMode, 0, 0, &stm );
if( SUCCEEDED(r) )
{
ret = save_summary_info( si, stm );