Commit 3d812659 authored by James Hawkins's avatar James Hawkins Committed by Alexandre Julliard

msi: Return to the parent dialog when the argument to the EndDialog event is Return.

parent 29ce6b37
......@@ -82,6 +82,7 @@ typedef struct msi_font_tag
struct msi_dialog_tag
{
MSIPACKAGE *package;
msi_dialog *parent;
msi_dialog_event_handler event_handler;
BOOL finished;
INT scale;
......@@ -222,6 +223,16 @@ static LPWSTR msi_dialog_dup_property( msi_dialog *dialog, LPCWSTR property, BOO
return strdupW( property );
}
msi_dialog *msi_dialog_get_parent( msi_dialog *dialog )
{
return dialog->parent;
}
LPWSTR msi_dialog_get_name( msi_dialog *dialog )
{
return dialog->name;
}
/*
* msi_dialog_get_style
*
......@@ -3060,7 +3071,8 @@ static LRESULT WINAPI MSIHiddenWindowProc( HWND hwnd, UINT msg,
/* functions that interface to other modules within MSI */
msi_dialog *msi_dialog_create( MSIPACKAGE* package, LPCWSTR szDialogName,
msi_dialog *msi_dialog_create( MSIPACKAGE* package,
LPCWSTR szDialogName, msi_dialog *parent,
msi_dialog_event_handler event_handler )
{
MSIRECORD *rec = NULL;
......@@ -3073,6 +3085,7 @@ msi_dialog *msi_dialog_create( MSIPACKAGE* package, LPCWSTR szDialogName,
if( !dialog )
return NULL;
strcpyW( dialog->name, szDialogName );
dialog->parent = parent;
msiobj_addref( &package->hdr );
dialog->package = package;
dialog->event_handler = event_handler;
......
......@@ -58,13 +58,13 @@ UINT ControlEvent_HandleControlEvent(MSIPACKAGE *, LPCWSTR, LPCWSTR, msi_dialog*
/*
* Create a dialog box and run it if it's modal
*/
static UINT event_do_dialog( MSIPACKAGE *package, LPCWSTR name, BOOL destroy_modeless )
static UINT event_do_dialog( MSIPACKAGE *package, LPCWSTR name, msi_dialog *parent, BOOL destroy_modeless )
{
msi_dialog *dialog;
UINT r;
/* create a new dialog */
dialog = msi_dialog_create( package, name,
dialog = msi_dialog_create( package, name, parent,
ControlEvent_HandleControlEvent );
if( dialog )
{
......@@ -111,7 +111,12 @@ static UINT ControlEvent_EndDialog(MSIPACKAGE* package, LPCWSTR argument,
else if (lstrcmpW(argument, szIgnore) == 0)
package->CurrentInstallState = -1;
else if (lstrcmpW(argument, szReturn) == 0)
{
msi_dialog *parent = msi_dialog_get_parent(dialog);
msi_free(package->next_dialog);
package->next_dialog = (parent) ? strdupW(msi_dialog_get_name(parent)) : NULL;
package->CurrentInstallState = ERROR_SUCCESS;
}
else
{
ERR("Unknown argument string %s\n",debugstr_w(argument));
......@@ -143,7 +148,7 @@ static UINT ControlEvent_SpawnDialog(MSIPACKAGE* package, LPCWSTR argument,
msi_dialog *dialog)
{
/* don't destroy a modeless dialogs that might be our parent */
event_do_dialog( package, argument, FALSE );
event_do_dialog( package, argument, dialog, FALSE );
if( package->CurrentInstallState != ERROR_SUCCESS )
msi_dialog_end_dialog( dialog );
return ERROR_SUCCESS;
......@@ -353,13 +358,13 @@ UINT ACTION_DialogBox( MSIPACKAGE* package, LPCWSTR szDialogName )
* dialog, as it returns ERROR_IO_PENDING when we try to run
* its message loop.
*/
r = event_do_dialog( package, szDialogName, TRUE );
r = event_do_dialog( package, szDialogName, NULL, TRUE );
while( r == ERROR_SUCCESS && package->next_dialog )
{
LPWSTR name = package->next_dialog;
package->next_dialog = NULL;
r = event_do_dialog( package, name, TRUE );
r = event_do_dialog( package, name, NULL, TRUE );
msi_free( name );
}
......
......@@ -451,7 +451,7 @@ extern LONG msi_reg_set_subkey_val( HKEY hkey, LPCWSTR path, LPCWSTR name, LPCWS
/* msi dialog interface */
typedef UINT (*msi_dialog_event_handler)( MSIPACKAGE*, LPCWSTR, LPCWSTR, msi_dialog* );
extern msi_dialog *msi_dialog_create( MSIPACKAGE*, LPCWSTR, msi_dialog_event_handler );
extern msi_dialog *msi_dialog_create( MSIPACKAGE*, LPCWSTR, msi_dialog*, msi_dialog_event_handler );
extern UINT msi_dialog_run_message_loop( msi_dialog* );
extern void msi_dialog_end_dialog( msi_dialog* );
extern void msi_dialog_check_messages( HANDLE );
......@@ -462,6 +462,8 @@ extern void msi_dialog_unregister_class( void );
extern void msi_dialog_handle_event( msi_dialog*, LPCWSTR, LPCWSTR, MSIRECORD * );
extern UINT msi_dialog_reset( msi_dialog *dialog );
extern UINT msi_dialog_directorylist_up( msi_dialog *dialog );
extern msi_dialog *msi_dialog_get_parent( msi_dialog *dialog );
extern LPWSTR msi_dialog_get_name( msi_dialog *dialog );
/* preview */
extern MSIPREVIEW *MSI_EnableUIPreview( MSIDATABASE * );
......
......@@ -103,7 +103,7 @@ UINT MSI_PreviewDialogW( MSIPREVIEW *preview, LPCWSTR szDialogName )
/* an empty name means we should just destroy the current preview dialog */
if( szDialogName )
{
dialog = msi_dialog_create( preview->package, szDialogName,
dialog = msi_dialog_create( preview->package, szDialogName, NULL,
preview_event_handler );
if( dialog )
msi_dialog_do_preview( dialog );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment