msi 5: Add initial implementation of the DirectoryListUp event
James Hawkins
truiken at gmail.com
Thu Aug 24 21:30:20 CDT 2006
Hi,
The following two patches are more fixes for bug 4403.
http://bugs.winehq.org/show_bug.cgi?id=4403
Changelog:
* Add initial implementation of the DirectoryListUp event.
dlls/msi/dialog.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++++
dlls/msi/events.c | 8 ++++++++
2 files changed, 62 insertions(+), 0 deletions(-)
--
James Hawkins
-------------- next part --------------
diff --git a/dlls/msi/dialog.c b/dlls/msi/dialog.c
index 995b5ba..53e3fb9 100644
--- a/dlls/msi/dialog.c
+++ b/dlls/msi/dialog.c
@@ -186,6 +186,21 @@ static msi_control *msi_dialog_find_cont
return NULL;
}
+static msi_control *msi_dialog_find_control_by_class( msi_dialog *dialog, LPCWSTR class )
+{
+ msi_control *control;
+ WCHAR buf[MAX_PATH];
+
+ LIST_FOR_EACH_ENTRY( control, &dialog->controls, msi_control, entry )
+ {
+ GetClassNameW( control->hwnd, buf, MAX_PATH );
+ if (!lstrcmpW( buf, class ))
+ return control;
+ }
+
+ return NULL;
+}
+
static LPWSTR msi_get_deformatted_field( MSIPACKAGE *package, MSIRECORD *rec, int field )
{
LPCWSTR str = MSI_RecordGetString( rec, field );
@@ -1947,6 +1962,14 @@ static UINT msi_dialog_list_box( msi_dia
/******************** Directory Combo ***************************************/
+static LPWSTR msi_dialog_dup_property( msi_dialog *dialog, LPCWSTR property, BOOL indirect )
+{
+ if (indirect)
+ return msi_dup_property( dialog->package, property );
+
+ return strdupW( property );
+}
+
static UINT msi_dialog_directory_combo( msi_dialog *dialog, MSIRECORD *rec )
{
msi_control *control;
@@ -1988,18 +2011,49 @@ static UINT msi_dialog_directory_combo(
/******************** Directory List ***************************************/
+UINT msi_dialog_directorylist_up( msi_dialog *dialog )
+{
+ msi_control *control;
+ BOOL indirect;
+ LPWSTR prop, path, ptr;
+
+ control = msi_dialog_find_control_by_class( dialog, WC_LISTVIEWW );
+ indirect = control->attributes & msidbControlAttributesIndirect;
+ prop = msi_dialog_dup_property( dialog, control->property, indirect );
+
+ path = msi_dup_property( dialog->package, prop );
+
+ /* strip off the last directory */
+ ptr = PathFindFileNameW( path );
+ if (ptr != path) *(ptr - 1) = '\0';
+ PathAddBackslashW( path );
+
+ MSI_SetPropertyW( dialog->package, prop, path );
+
+ msi_free( path );
+ msi_free( prop );
+
+ return ERROR_SUCCESS;
+}
+
static UINT msi_dialog_directory_list( msi_dialog *dialog, MSIRECORD *rec )
{
msi_control *control;
+ LPCWSTR prop;
DWORD style;
style = LVS_LIST | LVS_EDITLABELS | WS_VSCROLL | LVS_SHAREIMAGELISTS |
LVS_AUTOARRANGE | LVS_SINGLESEL | WS_BORDER |
LVS_SORTASCENDING | WS_CHILD | WS_GROUP | WS_TABSTOP;
control = msi_dialog_add_control( dialog, rec, WC_LISTVIEWW, style );
+ control->attributes = MSI_RecordGetInteger( rec, 8 );
if (!control)
return ERROR_FUNCTION_FAILED;
+ prop = MSI_RecordGetString( rec, 9 );
+ if ( prop )
+ control->property = strdupW( prop );
+
return ERROR_SUCCESS;
}
diff --git a/dlls/msi/events.c b/dlls/msi/events.c
index 4d1525a..8c49ac9 100644
--- a/dlls/msi/events.c
+++ b/dlls/msi/events.c
@@ -54,6 +54,7 @@ struct subscriber {
};
UINT ControlEvent_HandleControlEvent(MSIPACKAGE *, LPCWSTR, LPCWSTR, msi_dialog*);
+UINT msi_dialog_directorylist_up( msi_dialog *dialog );
/*
* Create a dialog box and run it if it's modal
@@ -379,6 +380,12 @@ static UINT ControlEvent_SetInstallLevel
return MSI_SetInstallLevel( package, iInstallLevel );
}
+static UINT ControlEvent_DirectoryListUp(MSIPACKAGE *package, LPCWSTR argument,
+ msi_dialog *dialog)
+{
+ return msi_dialog_directorylist_up( dialog );
+}
+
static const struct _events Events[] = {
{ "EndDialog",ControlEvent_EndDialog },
{ "NewDialog",ControlEvent_NewDialog },
@@ -391,6 +398,7 @@ static const struct _events Events[] = {
{ "SetTargetPath",ControlEvent_SetTargetPath },
{ "Reset",ControlEvent_Reset },
{ "SetInstallLevel",ControlEvent_SetInstallLevel },
+ { "DirectoryListUp",ControlEvent_DirectoryListUp },
{ NULL,NULL },
};
--
1.4.2
More information about the wine-patches
mailing list