Commit ef86011b authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

msi: Support substorage transforms in MsiDatabaseApplyTransform.

parent fb5d6c67
...@@ -824,50 +824,55 @@ MSIHANDLE WINAPI MsiGetLastErrorRecord( void ) ...@@ -824,50 +824,55 @@ MSIHANDLE WINAPI MsiGetLastErrorRecord( void )
return 0; return 0;
} }
UINT MSI_DatabaseApplyTransformW( MSIDATABASE *db, UINT MSI_DatabaseApplyTransformW( MSIDATABASE *db, const WCHAR *transform, int error_cond )
LPCWSTR szTransformFile, int iErrorCond )
{ {
HRESULT r; HRESULT hr;
UINT ret = ERROR_FUNCTION_FAILED; UINT ret = ERROR_FUNCTION_FAILED;
IStorage *stg = NULL; IStorage *stg;
STATSTG stat; 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, if (*transform == ':')
STGM_DIRECT|STGM_READ|STGM_SHARE_DENY_WRITE, NULL, 0, &stg);
if ( FAILED(r) )
{ {
WARN("failed to open transform 0x%08x\n", r); hr = IStorage_OpenStorage( db->storage, transform + 1, NULL, STGM_SHARE_EXCLUSIVE, NULL, 0, &stg );
return ret; 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 ); hr = IStorage_Stat( stg, &stat, STATFLAG_NONAME );
if ( FAILED( r ) ) if (FAILED( hr )) goto end;
goto end; if (!IsEqualGUID( &stat.clsid, &CLSID_MsiTransform )) goto end;
if (TRACE_ON( msi )) enum_stream_names( stg );
if ( !IsEqualGUID( &stat.clsid, &CLSID_MsiTransform ) )
goto end;
if( TRACE_ON( msi ) )
enum_stream_names( stg );
ret = msi_table_apply_transform( db, stg ); ret = msi_table_apply_transform( db, stg );
end: end:
IStorage_Release( stg ); IStorage_Release( stg );
return ret; return ret;
} }
UINT WINAPI MsiDatabaseApplyTransformW( MSIHANDLE hdb, UINT WINAPI MsiDatabaseApplyTransformW( MSIHANDLE hdb, const WCHAR *transform, int error_cond )
LPCWSTR szTransformFile, int iErrorCond)
{ {
MSIDATABASE *db; MSIDATABASE *db;
UINT r; UINT r;
if (error_cond) FIXME( "ignoring error conditions\n" );
db = msihandle2msiinfo( hdb, MSIHANDLETYPE_DATABASE ); db = msihandle2msiinfo( hdb, MSIHANDLETYPE_DATABASE );
if( !db ) if (!db)
{ {
MSIHANDLE remote; MSIHANDLE remote;
...@@ -879,27 +884,24 @@ UINT WINAPI MsiDatabaseApplyTransformW( MSIHANDLE hdb, ...@@ -879,27 +884,24 @@ UINT WINAPI MsiDatabaseApplyTransformW( MSIHANDLE hdb,
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
r = MSI_DatabaseApplyTransformW( db, szTransformFile, iErrorCond ); r = MSI_DatabaseApplyTransformW( db, transform, error_cond );
msiobj_release( &db->hdr ); msiobj_release( &db->hdr );
return r; return r;
} }
UINT WINAPI MsiDatabaseApplyTransformA( MSIHANDLE hdb, UINT WINAPI MsiDatabaseApplyTransformA( MSIHANDLE hdb, const char *transform, int error_cond )
LPCSTR szTransformFile, int iErrorCond)
{ {
LPWSTR wstr; WCHAR *wstr;
UINT ret; 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 ); wstr = strdupAtoW( transform );
if( szTransformFile && !wstr ) if (transform && !wstr)
return ERROR_NOT_ENOUGH_MEMORY; return ERROR_NOT_ENOUGH_MEMORY;
ret = MsiDatabaseApplyTransformW( hdb, wstr, iErrorCond); ret = MsiDatabaseApplyTransformW( hdb, wstr, error_cond );
msi_free( wstr ); msi_free( wstr );
return ret; return ret;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment