msi 2: Search for the browse dialog controls by type instead of name

James Hawkins truiken at gmail.com
Thu Aug 31 15:42:54 CDT 2006


Hi,

This fixes the case when the control name is different than the
control type in the database.

Changelog:
* Search for the browse dialog controls by type instead of name.

 dlls/msi/dialog.c |   21 ++++++++++++++++++---
 1 files changed, 18 insertions(+), 3 deletions(-)

-- 
James Hawkins
-------------- next part --------------
diff --git a/dlls/msi/dialog.c b/dlls/msi/dialog.c
index 6c1123b..ab58219 100644
--- a/dlls/msi/dialog.c
+++ b/dlls/msi/dialog.c
@@ -63,6 +63,7 @@ struct msi_control_tag
     HBITMAP hBitmap;
     HICON hIcon;
     LPWSTR tabnext;
+    LPWSTR type;
     HMODULE hDll;
     float progress_current;
     float progress_max;
@@ -177,6 +178,18 @@ static msi_control *msi_dialog_find_cont
     return NULL;
 }
 
+static msi_control *msi_dialog_find_control_by_type( msi_dialog *dialog, LPCWSTR type )
+{
+    msi_control *control;
+
+    if( !type )
+        return NULL;
+    LIST_FOR_EACH_ENTRY( control, &dialog->controls, msi_control, entry )
+        if( !strcmpW( control->type, type ) ) /* FIXME: case sensitive? */
+            return control;
+    return NULL;
+}
+
 static msi_control *msi_dialog_find_control_by_hwnd( msi_dialog *dialog, HWND hwnd )
 {
     msi_control *control;
@@ -359,6 +372,7 @@ static msi_control *msi_dialog_create_wi
     control->hIcon = NULL;
     control->hDll = NULL;
     control->tabnext = strdupW( MSI_RecordGetString( rec, 11) );
+    control->type = strdupW( MSI_RecordGetString( rec, 3 ) );
     control->progress_current = 0;
     control->progress_max = 100;
 
@@ -1423,7 +1437,7 @@ static void msi_dialog_update_pathedit( 
     LPWSTR prop, path;
     BOOL indirect;
 
-    if (!control && !(control = msi_dialog_find_control( dialog, szPathEdit ) ))
+    if (!control && !(control = msi_dialog_find_control_by_type( dialog, szPathEdit ) ))
         return;
 
     indirect = control->attributes & msidbControlAttributesIndirect;
@@ -1967,7 +1981,7 @@ static void msi_dialog_update_directory_
     LPWSTR prop, path;
     BOOL indirect;
 
-    if (!control && !(control = msi_dialog_find_control( dialog, szDirectoryCombo )))
+    if (!control && !(control = msi_dialog_find_control_by_type( dialog, szDirectoryCombo )))
         return;
 
     indirect = control->attributes & msidbControlAttributesIndirect;
@@ -2014,7 +2028,7 @@ UINT msi_dialog_directorylist_up( msi_di
     LPWSTR prop, path, ptr;
     BOOL indirect;
 
-    control = msi_dialog_find_control( dialog, szDirectoryList );
+    control = msi_dialog_find_control_by_type( dialog, szDirectoryList );
     indirect = control->attributes & msidbControlAttributesIndirect;
     prop = msi_dialog_dup_property( dialog, control->property, indirect );
 
@@ -2863,6 +2877,7 @@ void msi_dialog_destroy( msi_dialog *dia
         if( t->hIcon )
             DestroyIcon( t->hIcon );
         msi_free( t->tabnext );
+        msi_free( t->type );
         msi_free( t );
         if (t->hDll)
             FreeLibrary( t->hDll );
-- 
1.4.2


More information about the wine-patches mailing list