From 4759dcc3c1f24b19ef08adce48656d9d148bab8b Mon Sep 17 00:00:00 2001 From: Hans Leidekker Date: Fri, 26 Jul 2013 17:20:04 +0200 Subject: [PATCH] msi: Subscribe to all control events instead of just the first. --- dlls/msi/dialog.c | 46 ++++++++++++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/dlls/msi/dialog.c b/dlls/msi/dialog.c index 943b6312dc8..1e02467da3f 100644 --- a/dlls/msi/dialog.c +++ b/dlls/msi/dialog.c @@ -735,27 +735,41 @@ static void event_subscribe( msi_dialog *dialog, const WCHAR *event, const WCHAR list_add_tail( &dialog->package->subscriptions, &sub->entry ); } +struct dialog_control +{ + msi_dialog *dialog; + const WCHAR *control; +}; + +static UINT map_event( MSIRECORD *row, void *param ) +{ + struct dialog_control *dc = param; + const WCHAR *event = MSI_RecordGetString( row, 3 ); + const WCHAR *attribute = MSI_RecordGetString( row, 4 ); + + event_subscribe( dc->dialog, event, dc->control, attribute ); + return ERROR_SUCCESS; +} + static void dialog_map_events( msi_dialog *dialog, const WCHAR *control ) { - static const WCHAR Query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', + static const WCHAR queryW[] = + {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', '`','E','v','e','n','t','M','a','p','p','i','n','g','`',' ', - 'W','H','E','R','E',' ', - '`','D','i','a','l','o','g','_','`',' ','=',' ','\'','%','s','\'',' ', - 'A','N','D',' ', - '`','C','o','n','t','r','o','l','_','`',' ','=',' ','\'','%','s','\'',0 + 'W','H','E','R','E',' ','`','D','i','a','l','o','g','_','`',' ','=',' ','\'','%','s','\'',' ', + 'A','N','D',' ','`','C','o','n','t','r','o','l','_','`',' ','=',' ','\'','%','s','\'',0}; + MSIQUERY *view; + struct dialog_control dialog_control = + { + dialog, + control }; - MSIRECORD *row; - LPCWSTR event, attribute; - row = MSI_QueryGetRecord( dialog->package->db, Query, dialog->name, control ); - if (!row) - return; - - event = MSI_RecordGetString( row, 3 ); - attribute = MSI_RecordGetString( row, 4 ); - event_subscribe( dialog, event, control, attribute ); - msiobj_release( &row->hdr ); + if (!MSI_OpenQuery( dialog->package->db, &view, queryW, dialog->name, control )) + { + MSI_IterateRecords( view, NULL, map_event, &dialog_control ); + msiobj_release( &view->hdr ); + } } /* everything except radio buttons */