Hans Leidekker : msi: Subscribe to all control events instead of just the first.

Alexandre Julliard julliard at winehq.org
Sat Jul 27 13:23:35 CDT 2013


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

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Fri Jul 26 17:20:04 2013 +0200

msi: Subscribe to all control events instead of just the first.

---

 dlls/msi/dialog.c |   46 ++++++++++++++++++++++++++++++----------------
 1 files changed, 30 insertions(+), 16 deletions(-)

diff --git a/dlls/msi/dialog.c b/dlls/msi/dialog.c
index 943b631..1e02467 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 */




More information about the wine-cvs mailing list