Hans Leidekker : msi: Store a copy of the file extension in the MSIMIME structure.

Alexandre Julliard julliard at winehq.org
Thu Apr 29 14:45:05 CDT 2010


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

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Thu Apr 29 09:38:08 2010 +0200

msi: Store a copy of the file extension in the MSIMIME structure.

Fixes a crash that occurs when the extension foreign key points to nowhere.
Reported by Vincent Pelletier.

---

 dlls/msi/classes.c |   11 ++++++-----
 dlls/msi/msipriv.h |    1 +
 dlls/msi/package.c |    1 +
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/dlls/msi/classes.c b/dlls/msi/classes.c
index ce2325d..22d11c1 100644
--- a/dlls/msi/classes.c
+++ b/dlls/msi/classes.c
@@ -344,7 +344,7 @@ static MSIEXTENSION *load_given_extension( MSIPACKAGE *package, LPCWSTR extensio
 
 static MSIMIME *load_mime( MSIPACKAGE* package, MSIRECORD *row )
 {
-    LPCWSTR buffer;
+    LPCWSTR extension;
     MSIMIME *mt;
 
     /* fill in the data */
@@ -356,8 +356,9 @@ static MSIMIME *load_mime( MSIPACKAGE* package, MSIRECORD *row )
     mt->ContentType = msi_dup_record_field( row, 1 ); 
     TRACE("loading mime %s\n", debugstr_w(mt->ContentType));
 
-    buffer = MSI_RecordGetString( row, 2 );
-    mt->Extension = load_given_extension( package, buffer );
+    extension = MSI_RecordGetString( row, 2 );
+    mt->Extension = load_given_extension( package, extension );
+    mt->suffix = strdupW( extension );
 
     mt->clsid = msi_dup_record_field( row, 3 );
     mt->Class = load_given_class( package, mt->clsid );
@@ -1467,7 +1468,7 @@ UINT ACTION_RegisterMIMEInfo(MSIPACKAGE *package)
 
         uirow = MSI_CreateRecord( 2 );
         MSI_RecordSetStringW( uirow, 1, mt->ContentType );
-        MSI_RecordSetStringW( uirow, 2, mt->Extension->Extension );
+        MSI_RecordSetStringW( uirow, 2, mt->suffix );
         ui_actiondata( package, szRegisterMIMEInfo, uirow );
         msiobj_release( &uirow->hdr );
     }
@@ -1512,7 +1513,7 @@ UINT ACTION_UnregisterMIMEInfo( MSIPACKAGE *package )
 
         uirow = MSI_CreateRecord( 2 );
         MSI_RecordSetStringW( uirow, 1, mime->ContentType );
-        MSI_RecordSetStringW( uirow, 2, mime->Extension->Extension );
+        MSI_RecordSetStringW( uirow, 2, mime->suffix );
         ui_actiondata( package, szUnregisterMIMEInfo, uirow );
         msiobj_release( &uirow->hdr );
     }
diff --git a/dlls/msi/msipriv.h b/dlls/msi/msipriv.h
index 6e7829a..06a4367 100644
--- a/dlls/msi/msipriv.h
+++ b/dlls/msi/msipriv.h
@@ -553,6 +553,7 @@ struct tagMSIMIME
     struct list entry;
     LPWSTR ContentType;  /* Primary Key */
     MSIEXTENSION *Extension;
+    LPWSTR suffix;
     LPWSTR clsid;
     MSICLASS *Class;
     /* not in the table, set during installation */
diff --git a/dlls/msi/package.c b/dlls/msi/package.c
index 0fdce76..0c06088 100644
--- a/dlls/msi/package.c
+++ b/dlls/msi/package.c
@@ -214,6 +214,7 @@ static void free_package_structures( MSIPACKAGE *package )
         MSIMIME *mt = LIST_ENTRY( item, MSIMIME, entry );
 
         list_remove( &mt->entry );
+        msi_free( mt->suffix );
         msi_free( mt->clsid );
         msi_free( mt->ContentType );
         msi_free( mt );




More information about the wine-cvs mailing list