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
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 );
}
......
......@@ -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 */
......
......@@ -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 );
......
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