Mike McCormack : msi: Check transforms have the correct storage guid.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Oct 11 05:52:30 CDT 2006


Module: wine
Branch: master
Commit: eb18bd9403e1054bd071c0939da69823d7d32744
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=eb18bd9403e1054bd071c0939da69823d7d32744

Author: Mike McCormack <mike at codeweavers.com>
Date:   Wed Oct 11 16:27:15 2006 +0900

msi: Check transforms have the correct storage guid.

---

 dlls/msi/msiquery.c |   28 ++++++++++++++++++++--------
 1 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/dlls/msi/msiquery.c b/dlls/msi/msiquery.c
index 824a5be..1346969 100644
--- a/dlls/msi/msiquery.c
+++ b/dlls/msi/msiquery.c
@@ -37,6 +37,8 @@ #include "winnls.h"
 
 #include "query.h"
 
+#include "initguid.h"
+
 WINE_DEFAULT_DEBUG_CHANNEL(msi);
 
 static void MSI_CloseView( MSIOBJECTHDR *arg )
@@ -737,30 +739,40 @@ MSIHANDLE WINAPI MsiGetLastErrorRecord( 
 
 DEFINE_GUID( CLSID_MsiTransform, 0x000c1082, 0x0000, 0x0000, 0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
 
-UINT MSI_DatabaseApplyTransformW( MSIDATABASE *db, 
+UINT MSI_DatabaseApplyTransformW( MSIDATABASE *db,
                  LPCWSTR szTransformFile, int iErrorCond )
 {
-    UINT r;
+    HRESULT r;
+    UINT ret = ERROR_FUNCTION_FAILED;
     IStorage *stg = NULL;
- 
+    STATSTG stat;
+
     TRACE("%p %s %d\n", db, debugstr_w(szTransformFile), iErrorCond);
 
     r = StgOpenStorage( szTransformFile, NULL,
            STGM_DIRECT|STGM_READ|STGM_SHARE_DENY_WRITE, NULL, 0, &stg);
-    if( r )
-        return r;
+    if ( FAILED(r) )
+        return ret;
+
+    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 );
 
-    r = msi_table_apply_transform( db, stg );
+    ret = msi_table_apply_transform( db, stg );
 
+end:
     IStorage_Release( stg );
 
-    return r;
+    return ret;
 }
 
-UINT WINAPI MsiDatabaseApplyTransformW( MSIHANDLE hdb, 
+UINT WINAPI MsiDatabaseApplyTransformW( MSIHANDLE hdb,
                  LPCWSTR szTransformFile, int iErrorCond)
 {
     MSIDATABASE *db;




More information about the wine-cvs mailing list