msi: Perform button control events in greatest to least order

James Hawkins truiken at gmail.com
Wed Oct 4 17:06:17 CDT 2006


Hi,

This fixes bug 6379.  http://bugs.winehq.org/show_bug.cgi?id=6379

Changelog:
* Perform button control events in greatest to least order.

 dlls/msi/dialog.c   |   10 +++++++++-
 dlls/msi/msipriv.h  |    1 +
 dlls/msi/msiquery.c |   28 ++++++++++++++++++++++++++++
 3 files changed, 38 insertions(+), 1 deletions(-)

-- 
James Hawkins
-------------- next part --------------
diff --git a/dlls/msi/dialog.c b/dlls/msi/dialog.c
index 55743ca..ed88494 100644
--- a/dlls/msi/dialog.c
+++ b/dlls/msi/dialog.c
@@ -2924,7 +2924,15 @@ static UINT msi_dialog_button_handler( m
         return 0;
     }
 
-    r = MSI_IterateRecords( view, 0, msi_dialog_control_event, dialog );
+    r = MSI_ViewExecute( view, NULL );
+    if ( r != ERROR_SUCCESS )
+    {
+        msiobj_release( &view->hdr );
+        return r;
+    }
+
+    r = MSI_ReverseRecords( view, 0, msi_dialog_control_event, dialog );
+    MSI_ViewClose( view );
     msiobj_release( &view->hdr );
 
     return r;
diff --git a/dlls/msi/msipriv.h b/dlls/msi/msipriv.h
index cc3b88b..23caf15 100644
--- a/dlls/msi/msipriv.h
+++ b/dlls/msi/msipriv.h
@@ -386,6 +386,7 @@ extern UINT MSI_OpenDatabaseW( LPCWSTR, 
 extern UINT MSI_DatabaseOpenViewW(MSIDATABASE *, LPCWSTR, MSIQUERY ** );
 extern UINT MSI_OpenQuery( MSIDATABASE *, MSIQUERY **, LPCWSTR, ... );
 typedef UINT (*record_func)( MSIRECORD *, LPVOID );
+extern UINT MSI_ReverseRecords( MSIQUERY *, DWORD *, record_func, LPVOID );
 extern UINT MSI_IterateRecords( MSIQUERY *, DWORD *, record_func, LPVOID );
 extern MSIRECORD *MSI_QueryGetRecord( MSIDATABASE *db, LPCWSTR query, ... );
 extern UINT MSI_DatabaseImport( MSIDATABASE *, LPCWSTR, LPCWSTR );
diff --git a/dlls/msi/msiquery.c b/dlls/msi/msiquery.c
index e146cc8..8a4aa3a 100644
--- a/dlls/msi/msiquery.c
+++ b/dlls/msi/msiquery.c
@@ -164,6 +164,34 @@ UINT MSI_OpenQuery( MSIDATABASE *db, MSI
     return r;
 }
 
+/* execute record_func on records in reverse order */
+UINT MSI_ReverseRecords( MSIQUERY *view, DWORD *count,
+                         record_func func, LPVOID param )
+{
+    MSIRECORD *rec = NULL;
+    UINT r;
+
+    r = MSI_ViewFetch( view, &rec );
+    if ( r != ERROR_SUCCESS )
+        return (r == ERROR_NO_MORE_ITEMS) ? ERROR_SUCCESS : r;
+
+    if (count) (*count)--;
+    r = MSI_ReverseRecords( view, count, func, param );
+    if ( r != ERROR_SUCCESS )
+        goto done;
+
+    if ( func )
+        r = func( rec, param );
+
+done:
+    msiobj_release( &rec->hdr );
+
+    if ( count )
+        (*count)++;
+
+    return r;
+}
+
 UINT MSI_IterateRecords( MSIQUERY *view, DWORD *count,
                          record_func func, LPVOID param )
 {
-- 
1.4.2.1


More information about the wine-patches mailing list