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

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.
parent 7d9d6707
...@@ -344,7 +344,7 @@ static MSIEXTENSION *load_given_extension( MSIPACKAGE *package, LPCWSTR extensio ...@@ -344,7 +344,7 @@ static MSIEXTENSION *load_given_extension( MSIPACKAGE *package, LPCWSTR extensio
static MSIMIME *load_mime( MSIPACKAGE* package, MSIRECORD *row ) static MSIMIME *load_mime( MSIPACKAGE* package, MSIRECORD *row )
{ {
LPCWSTR buffer; LPCWSTR extension;
MSIMIME *mt; MSIMIME *mt;
/* fill in the data */ /* fill in the data */
...@@ -356,8 +356,9 @@ static MSIMIME *load_mime( MSIPACKAGE* package, MSIRECORD *row ) ...@@ -356,8 +356,9 @@ static MSIMIME *load_mime( MSIPACKAGE* package, MSIRECORD *row )
mt->ContentType = msi_dup_record_field( row, 1 ); mt->ContentType = msi_dup_record_field( row, 1 );
TRACE("loading mime %s\n", debugstr_w(mt->ContentType)); TRACE("loading mime %s\n", debugstr_w(mt->ContentType));
buffer = MSI_RecordGetString( row, 2 ); extension = MSI_RecordGetString( row, 2 );
mt->Extension = load_given_extension( package, buffer ); mt->Extension = load_given_extension( package, extension );
mt->suffix = strdupW( extension );
mt->clsid = msi_dup_record_field( row, 3 ); mt->clsid = msi_dup_record_field( row, 3 );
mt->Class = load_given_class( package, mt->clsid ); mt->Class = load_given_class( package, mt->clsid );
...@@ -1467,7 +1468,7 @@ UINT ACTION_RegisterMIMEInfo(MSIPACKAGE *package) ...@@ -1467,7 +1468,7 @@ UINT ACTION_RegisterMIMEInfo(MSIPACKAGE *package)
uirow = MSI_CreateRecord( 2 ); uirow = MSI_CreateRecord( 2 );
MSI_RecordSetStringW( uirow, 1, mt->ContentType ); MSI_RecordSetStringW( uirow, 1, mt->ContentType );
MSI_RecordSetStringW( uirow, 2, mt->Extension->Extension ); MSI_RecordSetStringW( uirow, 2, mt->suffix );
ui_actiondata( package, szRegisterMIMEInfo, uirow ); ui_actiondata( package, szRegisterMIMEInfo, uirow );
msiobj_release( &uirow->hdr ); msiobj_release( &uirow->hdr );
} }
...@@ -1512,7 +1513,7 @@ UINT ACTION_UnregisterMIMEInfo( MSIPACKAGE *package ) ...@@ -1512,7 +1513,7 @@ UINT ACTION_UnregisterMIMEInfo( MSIPACKAGE *package )
uirow = MSI_CreateRecord( 2 ); uirow = MSI_CreateRecord( 2 );
MSI_RecordSetStringW( uirow, 1, mime->ContentType ); MSI_RecordSetStringW( uirow, 1, mime->ContentType );
MSI_RecordSetStringW( uirow, 2, mime->Extension->Extension ); MSI_RecordSetStringW( uirow, 2, mime->suffix );
ui_actiondata( package, szUnregisterMIMEInfo, uirow ); ui_actiondata( package, szUnregisterMIMEInfo, uirow );
msiobj_release( &uirow->hdr ); msiobj_release( &uirow->hdr );
} }
......
...@@ -553,6 +553,7 @@ struct tagMSIMIME ...@@ -553,6 +553,7 @@ struct tagMSIMIME
struct list entry; struct list entry;
LPWSTR ContentType; /* Primary Key */ LPWSTR ContentType; /* Primary Key */
MSIEXTENSION *Extension; MSIEXTENSION *Extension;
LPWSTR suffix;
LPWSTR clsid; LPWSTR clsid;
MSICLASS *Class; MSICLASS *Class;
/* not in the table, set during installation */ /* not in the table, set during installation */
......
...@@ -214,6 +214,7 @@ static void free_package_structures( MSIPACKAGE *package ) ...@@ -214,6 +214,7 @@ static void free_package_structures( MSIPACKAGE *package )
MSIMIME *mt = LIST_ENTRY( item, MSIMIME, entry ); MSIMIME *mt = LIST_ENTRY( item, MSIMIME, entry );
list_remove( &mt->entry ); list_remove( &mt->entry );
msi_free( mt->suffix );
msi_free( mt->clsid ); msi_free( mt->clsid );
msi_free( mt->ContentType ); msi_free( mt->ContentType );
msi_free( mt ); msi_free( mt );
......
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