Hans Leidekker : msi: Support substorage transforms in MsiDatabaseApplyTransform.
Alexandre Julliard
julliard at winehq.org
Sun Mar 3 13:21:30 CST 2019
Module: wine
Branch: oldstable
Commit: 4228dd1767e9b033ad5d2605cd3893e2cdeb222c
URL: https://source.winehq.org/git/wine.git/?a=commit;h=4228dd1767e9b033ad5d2605cd3893e2cdeb222c
Author: Hans Leidekker <hans at codeweavers.com>
Date: Fri Nov 9 14:50:34 2018 +0100
msi: Support substorage transforms in MsiDatabaseApplyTransform.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=40206
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
(cherry picked from commit ef86011ba40ef90eefb5e54059d907753ec8d694)
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
---
dlls/msi/msiquery.c | 68 +++++++++++++++++++++++++++--------------------------
1 file changed, 35 insertions(+), 33 deletions(-)
diff --git a/dlls/msi/msiquery.c b/dlls/msi/msiquery.c
index d73e5fe..2e84449 100644
--- a/dlls/msi/msiquery.c
+++ b/dlls/msi/msiquery.c
@@ -713,50 +713,55 @@ MSIHANDLE WINAPI MsiGetLastErrorRecord( void )
return 0;
}
-UINT MSI_DatabaseApplyTransformW( MSIDATABASE *db,
- LPCWSTR szTransformFile, int iErrorCond )
+UINT MSI_DatabaseApplyTransformW( MSIDATABASE *db, const WCHAR *transform, int error_cond )
{
- HRESULT r;
+ HRESULT hr;
UINT ret = ERROR_FUNCTION_FAILED;
- IStorage *stg = NULL;
+ IStorage *stg;
STATSTG stat;
- TRACE("%p %s %d\n", db, debugstr_w(szTransformFile), iErrorCond);
+ TRACE( "%p %s %08x\n", db, debugstr_w(transform), error_cond );
- r = StgOpenStorage( szTransformFile, NULL,
- STGM_DIRECT|STGM_READ|STGM_SHARE_DENY_WRITE, NULL, 0, &stg);
- if ( FAILED(r) )
+ if (*transform == ':')
{
- WARN("failed to open transform 0x%08x\n", r);
- return ret;
+ hr = IStorage_OpenStorage( db->storage, transform + 1, NULL, STGM_SHARE_EXCLUSIVE, NULL, 0, &stg );
+ if (FAILED( hr ))
+ {
+ WARN( "failed to open substorage transform 0x%08x\n", hr );
+ return ERROR_FUNCTION_FAILED;
+ }
+ }
+ else
+ {
+ hr = StgOpenStorage( transform, NULL, STGM_DIRECT|STGM_READ|STGM_SHARE_DENY_WRITE, NULL, 0, &stg );
+ if (FAILED( hr ))
+ {
+ WARN( "failed to open file transform 0x%08x\n", hr );
+ return ERROR_FUNCTION_FAILED;
+ }
}
- r = IStorage_Stat( stg, &stat, STATFLAG_NONAME );
- if ( FAILED( r ) )
- goto end;
-
- if ( !IsEqualGUID( &stat.clsid, &CLSID_MsiTransform ) )
- goto end;
-
- if( TRACE_ON( msi ) )
- enum_stream_names( stg );
+ hr = IStorage_Stat( stg, &stat, STATFLAG_NONAME );
+ if (FAILED( hr )) goto end;
+ if (!IsEqualGUID( &stat.clsid, &CLSID_MsiTransform )) goto end;
+ if (TRACE_ON( msi )) enum_stream_names( stg );
ret = msi_table_apply_transform( db, stg );
end:
IStorage_Release( stg );
-
return ret;
}
-UINT WINAPI MsiDatabaseApplyTransformW( MSIHANDLE hdb,
- LPCWSTR szTransformFile, int iErrorCond)
+UINT WINAPI MsiDatabaseApplyTransformW( MSIHANDLE hdb, const WCHAR *transform, int error_cond )
{
MSIDATABASE *db;
UINT r;
+ if (error_cond) FIXME( "ignoring error conditions\n" );
+
db = msihandle2msiinfo( hdb, MSIHANDLETYPE_DATABASE );
- if( !db )
+ if (!db)
{
IWineMsiRemoteDatabase *remote_database;
@@ -770,27 +775,24 @@ UINT WINAPI MsiDatabaseApplyTransformW( MSIHANDLE hdb,
return ERROR_SUCCESS;
}
- r = MSI_DatabaseApplyTransformW( db, szTransformFile, iErrorCond );
+ r = MSI_DatabaseApplyTransformW( db, transform, error_cond );
msiobj_release( &db->hdr );
return r;
}
-UINT WINAPI MsiDatabaseApplyTransformA( MSIHANDLE hdb,
- LPCSTR szTransformFile, int iErrorCond)
+UINT WINAPI MsiDatabaseApplyTransformA( MSIHANDLE hdb, const char *transform, int error_cond )
{
- LPWSTR wstr;
+ WCHAR *wstr;
UINT ret;
- TRACE("%d %s %d\n", hdb, debugstr_a(szTransformFile), iErrorCond);
+ TRACE( "%d %s %08x\n", hdb, debugstr_a(transform), error_cond );
- wstr = strdupAtoW( szTransformFile );
- if( szTransformFile && !wstr )
+ wstr = strdupAtoW( transform );
+ if (transform && !wstr)
return ERROR_NOT_ENOUGH_MEMORY;
- ret = MsiDatabaseApplyTransformW( hdb, wstr, iErrorCond);
-
+ ret = MsiDatabaseApplyTransformW( hdb, wstr, error_cond );
msi_free( wstr );
-
return ret;
}
More information about the wine-cvs
mailing list