2005-05-27 11:11:18 +02:00
|
|
|
/*
|
|
|
|
* Implementation of the Microsoft Installer (msi.dll)
|
|
|
|
*
|
|
|
|
* Copyright 2005 Aric Stewart for CodeWeavers
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2005-05-27 11:11:18 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "winerror.h"
|
|
|
|
#include "winreg.h"
|
|
|
|
#include "msi.h"
|
|
|
|
#include "msipriv.h"
|
|
|
|
|
|
|
|
#include "wine/debug.h"
|
2006-07-19 20:17:46 +02:00
|
|
|
#include "wine/unicode.h"
|
2005-05-27 11:11:18 +02:00
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(msi);
|
|
|
|
|
2005-06-17 23:31:06 +02:00
|
|
|
typedef UINT (*EVENTHANDLER)(MSIPACKAGE*,LPCWSTR,msi_dialog *);
|
2005-05-27 11:11:18 +02:00
|
|
|
|
2011-06-07 10:35:34 +02:00
|
|
|
struct control_events
|
|
|
|
{
|
|
|
|
const WCHAR *event;
|
2005-05-27 11:11:18 +02:00
|
|
|
EVENTHANDLER handler;
|
|
|
|
};
|
|
|
|
|
2005-06-06 17:40:15 +02:00
|
|
|
struct subscriber {
|
|
|
|
struct list entry;
|
2006-10-04 00:01:23 +02:00
|
|
|
msi_dialog *dialog;
|
2005-06-06 17:40:15 +02:00
|
|
|
LPWSTR event;
|
2005-05-27 11:11:18 +02:00
|
|
|
LPWSTR control;
|
|
|
|
LPWSTR attribute;
|
|
|
|
};
|
|
|
|
|
2007-01-12 17:47:57 +01:00
|
|
|
static UINT ControlEvent_HandleControlEvent(MSIPACKAGE *, LPCWSTR, LPCWSTR, msi_dialog*);
|
2005-05-27 11:11:18 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Create a dialog box and run it if it's modal
|
|
|
|
*/
|
2006-09-29 01:20:40 +02:00
|
|
|
static UINT event_do_dialog( MSIPACKAGE *package, LPCWSTR name, msi_dialog *parent, BOOL destroy_modeless )
|
2005-05-27 11:11:18 +02:00
|
|
|
{
|
|
|
|
msi_dialog *dialog;
|
|
|
|
UINT r;
|
|
|
|
|
|
|
|
/* create a new dialog */
|
2006-09-29 01:20:40 +02:00
|
|
|
dialog = msi_dialog_create( package, name, parent,
|
2005-05-27 11:11:18 +02:00
|
|
|
ControlEvent_HandleControlEvent );
|
|
|
|
if( dialog )
|
|
|
|
{
|
2005-07-06 13:11:26 +02:00
|
|
|
/* kill the current modeless dialog */
|
|
|
|
if( destroy_modeless && package->dialog )
|
|
|
|
{
|
|
|
|
msi_dialog_destroy( package->dialog );
|
|
|
|
package->dialog = NULL;
|
|
|
|
}
|
|
|
|
|
2005-05-27 11:11:18 +02:00
|
|
|
/* modeless dialogs return an error message */
|
|
|
|
r = msi_dialog_run_message_loop( dialog );
|
|
|
|
if( r == ERROR_SUCCESS )
|
|
|
|
msi_dialog_destroy( dialog );
|
|
|
|
else
|
|
|
|
package->dialog = dialog;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
r = ERROR_FUNCTION_FAILED;
|
|
|
|
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* End a modal dialog box
|
|
|
|
*/
|
2005-06-17 23:31:06 +02:00
|
|
|
static UINT ControlEvent_EndDialog(MSIPACKAGE* package, LPCWSTR argument,
|
2005-05-27 11:11:18 +02:00
|
|
|
msi_dialog* dialog)
|
|
|
|
{
|
2010-10-19 11:27:44 +02:00
|
|
|
static const WCHAR szExit[] = {'E','x','i','t',0};
|
|
|
|
static const WCHAR szRetry[] = {'R','e','t','r','y',0};
|
|
|
|
static const WCHAR szIgnore[] = {'I','g','n','o','r','e',0};
|
|
|
|
static const WCHAR szReturn[] = {'R','e','t','u','r','n',0};
|
|
|
|
|
|
|
|
if (!strcmpW( argument, szExit ))
|
2005-05-27 11:11:18 +02:00
|
|
|
package->CurrentInstallState = ERROR_INSTALL_USEREXIT;
|
2010-10-19 11:27:44 +02:00
|
|
|
else if (!strcmpW( argument, szRetry ))
|
2005-05-27 11:11:18 +02:00
|
|
|
package->CurrentInstallState = ERROR_INSTALL_SUSPEND;
|
2010-10-19 11:27:44 +02:00
|
|
|
else if (!strcmpW( argument, szIgnore ))
|
2008-12-16 18:11:51 +01:00
|
|
|
package->CurrentInstallState = ERROR_SUCCESS;
|
2010-10-19 11:27:44 +02:00
|
|
|
else if (!strcmpW( argument, szReturn ))
|
2006-09-29 01:20:40 +02:00
|
|
|
{
|
|
|
|
msi_dialog *parent = msi_dialog_get_parent(dialog);
|
|
|
|
msi_free(package->next_dialog);
|
|
|
|
package->next_dialog = (parent) ? strdupW(msi_dialog_get_name(parent)) : NULL;
|
2005-05-27 11:11:18 +02:00
|
|
|
package->CurrentInstallState = ERROR_SUCCESS;
|
2006-09-29 01:20:40 +02:00
|
|
|
}
|
2005-05-27 11:11:18 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
ERR("Unknown argument string %s\n",debugstr_w(argument));
|
|
|
|
package->CurrentInstallState = ERROR_FUNCTION_FAILED;
|
|
|
|
}
|
|
|
|
|
2006-12-18 08:48:25 +01:00
|
|
|
ControlEvent_CleanupDialogSubscriptions(package, msi_dialog_get_name( dialog ));
|
2005-05-27 11:11:18 +02:00
|
|
|
msi_dialog_end_dialog( dialog );
|
2005-06-17 23:31:06 +02:00
|
|
|
return ERROR_SUCCESS;
|
2005-05-27 11:11:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* transition from one modal dialog to another modal dialog
|
|
|
|
*/
|
2005-06-17 23:31:06 +02:00
|
|
|
static UINT ControlEvent_NewDialog(MSIPACKAGE* package, LPCWSTR argument,
|
2005-05-27 11:11:18 +02:00
|
|
|
msi_dialog *dialog)
|
|
|
|
{
|
|
|
|
/* store the name of the next dialog, and signal this one to end */
|
|
|
|
package->next_dialog = strdupW(argument);
|
2005-06-06 17:40:15 +02:00
|
|
|
ControlEvent_CleanupSubscriptions(package);
|
2005-05-27 11:11:18 +02:00
|
|
|
msi_dialog_end_dialog( dialog );
|
2005-06-17 23:31:06 +02:00
|
|
|
return ERROR_SUCCESS;
|
2005-05-27 11:11:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Create a new child dialog of an existing modal dialog
|
|
|
|
*/
|
2005-06-17 23:31:06 +02:00
|
|
|
static UINT ControlEvent_SpawnDialog(MSIPACKAGE* package, LPCWSTR argument,
|
2005-05-27 11:11:18 +02:00
|
|
|
msi_dialog *dialog)
|
|
|
|
{
|
2005-07-06 13:11:26 +02:00
|
|
|
/* don't destroy a modeless dialogs that might be our parent */
|
2006-09-29 01:20:40 +02:00
|
|
|
event_do_dialog( package, argument, dialog, FALSE );
|
2005-05-27 11:11:18 +02:00
|
|
|
if( package->CurrentInstallState != ERROR_SUCCESS )
|
|
|
|
msi_dialog_end_dialog( dialog );
|
2005-06-17 23:31:06 +02:00
|
|
|
return ERROR_SUCCESS;
|
2005-05-27 11:11:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Creates a dialog that remains up for a period of time
|
|
|
|
* based on a condition
|
|
|
|
*/
|
2005-06-17 23:31:06 +02:00
|
|
|
static UINT ControlEvent_SpawnWaitDialog(MSIPACKAGE* package, LPCWSTR argument,
|
2005-05-27 11:11:18 +02:00
|
|
|
msi_dialog* dialog)
|
|
|
|
{
|
|
|
|
FIXME("Doing Nothing\n");
|
2005-06-17 23:31:06 +02:00
|
|
|
return ERROR_SUCCESS;
|
2005-05-27 11:11:18 +02:00
|
|
|
}
|
|
|
|
|
2005-06-17 23:31:06 +02:00
|
|
|
static UINT ControlEvent_DoAction(MSIPACKAGE* package, LPCWSTR argument,
|
2005-05-27 11:11:18 +02:00
|
|
|
msi_dialog* dialog)
|
|
|
|
{
|
2010-07-23 09:42:21 +02:00
|
|
|
ACTION_PerformAction(package, argument, -1);
|
2005-06-17 23:31:06 +02:00
|
|
|
return ERROR_SUCCESS;
|
2005-05-27 11:11:18 +02:00
|
|
|
}
|
|
|
|
|
2010-12-24 15:31:02 +01:00
|
|
|
static UINT ControlEvent_AddLocal( MSIPACKAGE *package, LPCWSTR argument, msi_dialog *dialog )
|
2005-05-27 11:11:18 +02:00
|
|
|
{
|
2010-12-24 15:31:02 +01:00
|
|
|
MSIFEATURE *feature;
|
2005-05-27 11:11:18 +02:00
|
|
|
|
2010-12-24 15:31:02 +01:00
|
|
|
LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry )
|
2005-05-27 11:11:18 +02:00
|
|
|
{
|
2010-12-24 15:31:02 +01:00
|
|
|
if (!strcmpW( argument, feature->Feature ) || !strcmpW( argument, szAll ))
|
|
|
|
{
|
|
|
|
if (feature->ActionRequest != INSTALLSTATE_LOCAL)
|
|
|
|
msi_set_property( package->db, szPreselected, szOne );
|
|
|
|
MSI_SetFeatureStateW( package, feature->Feature, INSTALLSTATE_LOCAL );
|
|
|
|
}
|
2005-05-27 11:11:18 +02:00
|
|
|
}
|
2005-06-17 23:31:06 +02:00
|
|
|
return ERROR_SUCCESS;
|
2005-05-27 11:11:18 +02:00
|
|
|
}
|
|
|
|
|
2010-12-24 15:31:02 +01:00
|
|
|
static UINT ControlEvent_Remove( MSIPACKAGE *package, LPCWSTR argument, msi_dialog *dialog )
|
2005-05-27 11:11:18 +02:00
|
|
|
{
|
2010-12-24 15:31:02 +01:00
|
|
|
MSIFEATURE *feature;
|
2005-05-27 11:11:18 +02:00
|
|
|
|
2010-12-24 15:31:02 +01:00
|
|
|
LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry )
|
2005-05-27 11:11:18 +02:00
|
|
|
{
|
2010-12-24 15:31:02 +01:00
|
|
|
if (!strcmpW( argument, feature->Feature ) || !strcmpW( argument, szAll ))
|
|
|
|
{
|
|
|
|
if (feature->ActionRequest != INSTALLSTATE_ABSENT)
|
|
|
|
msi_set_property( package->db, szPreselected, szOne );
|
|
|
|
MSI_SetFeatureStateW( package, feature->Feature, INSTALLSTATE_ABSENT );
|
|
|
|
}
|
2005-05-27 11:11:18 +02:00
|
|
|
}
|
2005-06-17 23:31:06 +02:00
|
|
|
return ERROR_SUCCESS;
|
2005-05-27 11:11:18 +02:00
|
|
|
}
|
|
|
|
|
2010-12-24 15:31:02 +01:00
|
|
|
static UINT ControlEvent_AddSource( MSIPACKAGE *package, LPCWSTR argument, msi_dialog *dialog )
|
2005-05-27 11:11:18 +02:00
|
|
|
{
|
2010-12-24 15:31:02 +01:00
|
|
|
MSIFEATURE *feature;
|
2005-05-27 11:11:18 +02:00
|
|
|
|
2010-12-24 15:31:02 +01:00
|
|
|
LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry )
|
2005-05-27 11:11:18 +02:00
|
|
|
{
|
2010-12-24 15:31:02 +01:00
|
|
|
if (!strcmpW( argument, feature->Feature ) || !strcmpW( argument, szAll ))
|
|
|
|
{
|
|
|
|
if (feature->ActionRequest != INSTALLSTATE_SOURCE)
|
|
|
|
msi_set_property( package->db, szPreselected, szOne );
|
|
|
|
MSI_SetFeatureStateW( package, feature->Feature, INSTALLSTATE_SOURCE );
|
|
|
|
}
|
2005-05-27 11:11:18 +02:00
|
|
|
}
|
2005-06-17 23:31:06 +02:00
|
|
|
return ERROR_SUCCESS;
|
2005-05-27 11:11:18 +02:00
|
|
|
}
|
|
|
|
|
2005-06-17 23:31:06 +02:00
|
|
|
static UINT ControlEvent_SetTargetPath(MSIPACKAGE* package, LPCWSTR argument,
|
|
|
|
msi_dialog* dialog)
|
|
|
|
{
|
2010-04-21 11:37:54 +02:00
|
|
|
LPWSTR path = msi_dup_property( package->db, argument );
|
2006-10-04 00:02:07 +02:00
|
|
|
MSIRECORD *rec = MSI_CreateRecord( 1 );
|
2005-09-08 13:03:45 +02:00
|
|
|
UINT r;
|
2006-10-04 00:02:07 +02:00
|
|
|
|
|
|
|
static const WCHAR szSelectionPath[] = {'S','e','l','e','c','t','i','o','n','P','a','t','h',0};
|
|
|
|
|
|
|
|
MSI_RecordSetStringW( rec, 1, path );
|
|
|
|
ControlEvent_FireSubscribedEvent( package, szSelectionPath, rec );
|
|
|
|
|
2005-06-17 23:31:06 +02:00
|
|
|
/* failure to set the path halts the executing of control events */
|
2005-09-08 13:03:45 +02:00
|
|
|
r = MSI_SetTargetPathW(package, argument, path);
|
2005-09-20 13:57:19 +02:00
|
|
|
msi_free(path);
|
2006-10-04 00:02:07 +02:00
|
|
|
msi_free(&rec->hdr);
|
2005-09-08 13:03:45 +02:00
|
|
|
return r;
|
2005-06-17 23:31:06 +02:00
|
|
|
}
|
2005-05-27 11:11:18 +02:00
|
|
|
|
2006-01-03 12:12:09 +01:00
|
|
|
static UINT ControlEvent_Reset(MSIPACKAGE* package, LPCWSTR argument,
|
|
|
|
msi_dialog* dialog)
|
|
|
|
{
|
|
|
|
msi_dialog_reset(dialog);
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2005-05-27 11:11:18 +02:00
|
|
|
/*
|
|
|
|
* Subscribed events
|
|
|
|
*/
|
2005-06-06 17:40:15 +02:00
|
|
|
static void free_subscriber( struct subscriber *sub )
|
2005-05-27 11:11:18 +02:00
|
|
|
{
|
2005-09-20 13:57:19 +02:00
|
|
|
msi_free(sub->event);
|
|
|
|
msi_free(sub->control);
|
|
|
|
msi_free(sub->attribute);
|
|
|
|
msi_free(sub);
|
2005-05-27 11:11:18 +02:00
|
|
|
}
|
|
|
|
|
2006-10-04 00:01:23 +02:00
|
|
|
VOID ControlEvent_SubscribeToEvent( MSIPACKAGE *package, msi_dialog *dialog,
|
|
|
|
LPCWSTR event, LPCWSTR control, LPCWSTR attribute )
|
2005-05-27 11:11:18 +02:00
|
|
|
{
|
2005-06-06 17:40:15 +02:00
|
|
|
struct subscriber *sub;
|
2005-05-27 11:11:18 +02:00
|
|
|
|
2005-09-20 13:57:19 +02:00
|
|
|
sub = msi_alloc(sizeof (*sub));
|
2005-06-06 17:40:15 +02:00
|
|
|
if( !sub )
|
|
|
|
return;
|
2006-10-04 00:01:23 +02:00
|
|
|
sub->dialog = dialog;
|
2005-06-06 17:40:15 +02:00
|
|
|
sub->event = strdupW(event);
|
|
|
|
sub->control = strdupW(control);
|
|
|
|
sub->attribute = strdupW(attribute);
|
|
|
|
list_add_tail( &package->subscriptions, &sub->entry );
|
2005-05-27 11:11:18 +02:00
|
|
|
}
|
|
|
|
|
2005-06-06 17:40:15 +02:00
|
|
|
VOID ControlEvent_FireSubscribedEvent( MSIPACKAGE *package, LPCWSTR event,
|
|
|
|
MSIRECORD *rec )
|
2005-05-27 11:11:18 +02:00
|
|
|
{
|
2005-06-06 17:40:15 +02:00
|
|
|
struct subscriber *sub;
|
2005-05-27 11:11:18 +02:00
|
|
|
|
|
|
|
TRACE("Firing Event %s\n",debugstr_w(event));
|
|
|
|
|
2005-06-06 17:40:15 +02:00
|
|
|
LIST_FOR_EACH_ENTRY( sub, &package->subscriptions, struct subscriber, entry )
|
2005-05-27 11:11:18 +02:00
|
|
|
{
|
2010-10-19 11:27:44 +02:00
|
|
|
if (strcmpiW( sub->event, event ))
|
2005-06-06 17:40:15 +02:00
|
|
|
continue;
|
2010-10-19 11:27:44 +02:00
|
|
|
msi_dialog_handle_event( sub->dialog, sub->control, sub->attribute, rec );
|
2005-05-27 11:11:18 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-02-20 21:16:10 +01:00
|
|
|
VOID ControlEvent_CleanupDialogSubscriptions(MSIPACKAGE *package, LPWSTR dialog)
|
2006-12-18 08:48:25 +01:00
|
|
|
{
|
|
|
|
struct list *i, *t;
|
|
|
|
struct subscriber *sub;
|
|
|
|
|
|
|
|
LIST_FOR_EACH_SAFE( i, t, &package->subscriptions )
|
|
|
|
{
|
|
|
|
sub = LIST_ENTRY( i, struct subscriber, entry );
|
|
|
|
|
2010-10-19 11:27:44 +02:00
|
|
|
if (strcmpW( msi_dialog_get_name( sub->dialog ), dialog ))
|
2006-12-18 08:48:25 +01:00
|
|
|
continue;
|
|
|
|
|
|
|
|
list_remove( &sub->entry );
|
|
|
|
free_subscriber( sub );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-05-27 11:11:18 +02:00
|
|
|
VOID ControlEvent_CleanupSubscriptions(MSIPACKAGE *package)
|
|
|
|
{
|
2005-06-06 17:40:15 +02:00
|
|
|
struct list *i, *t;
|
|
|
|
struct subscriber *sub;
|
2005-05-27 11:11:18 +02:00
|
|
|
|
2005-06-06 17:40:15 +02:00
|
|
|
LIST_FOR_EACH_SAFE( i, t, &package->subscriptions )
|
2005-05-27 11:11:18 +02:00
|
|
|
{
|
2005-06-06 17:40:15 +02:00
|
|
|
sub = LIST_ENTRY( i, struct subscriber, entry );
|
|
|
|
|
|
|
|
list_remove( &sub->entry );
|
|
|
|
free_subscriber( sub );
|
2005-05-27 11:11:18 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ACTION_DialogBox()
|
|
|
|
*
|
|
|
|
* Return ERROR_SUCCESS if dialog is process and ERROR_FUNCTION_FAILED
|
|
|
|
* if the given parameter is not a dialog box
|
|
|
|
*/
|
|
|
|
UINT ACTION_DialogBox( MSIPACKAGE* package, LPCWSTR szDialogName )
|
|
|
|
{
|
|
|
|
UINT r = ERROR_SUCCESS;
|
|
|
|
|
|
|
|
if( package->next_dialog )
|
|
|
|
ERR("Already a next dialog... ignoring it\n");
|
|
|
|
package->next_dialog = NULL;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Dialogs are chained by filling in the next_dialog member
|
|
|
|
* of the package structure, then terminating the current dialog.
|
|
|
|
* The code below sees the next_dialog member set, and runs the
|
|
|
|
* next dialog.
|
|
|
|
* We fall out of the loop below if we come across a modeless
|
|
|
|
* dialog, as it returns ERROR_IO_PENDING when we try to run
|
|
|
|
* its message loop.
|
|
|
|
*/
|
2006-09-29 01:20:40 +02:00
|
|
|
r = event_do_dialog( package, szDialogName, NULL, TRUE );
|
2005-05-27 11:11:18 +02:00
|
|
|
while( r == ERROR_SUCCESS && package->next_dialog )
|
|
|
|
{
|
|
|
|
LPWSTR name = package->next_dialog;
|
|
|
|
|
|
|
|
package->next_dialog = NULL;
|
2006-09-29 01:20:40 +02:00
|
|
|
r = event_do_dialog( package, name, NULL, TRUE );
|
2005-09-20 13:57:19 +02:00
|
|
|
msi_free( name );
|
2005-05-27 11:11:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if( r == ERROR_IO_PENDING )
|
|
|
|
r = ERROR_SUCCESS;
|
|
|
|
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
2006-07-19 20:17:46 +02:00
|
|
|
static UINT ControlEvent_SetInstallLevel(MSIPACKAGE* package, LPCWSTR argument,
|
|
|
|
msi_dialog* dialog)
|
|
|
|
{
|
|
|
|
int iInstallLevel = atolW(argument);
|
|
|
|
|
|
|
|
TRACE("Setting install level: %i\n", iInstallLevel);
|
|
|
|
|
|
|
|
return MSI_SetInstallLevel( package, iInstallLevel );
|
|
|
|
}
|
|
|
|
|
2006-08-25 23:22:16 +02:00
|
|
|
static UINT ControlEvent_DirectoryListUp(MSIPACKAGE *package, LPCWSTR argument,
|
|
|
|
msi_dialog *dialog)
|
|
|
|
{
|
|
|
|
return msi_dialog_directorylist_up( dialog );
|
|
|
|
}
|
|
|
|
|
2007-05-07 03:54:21 +02:00
|
|
|
static UINT ControlEvent_ReinstallMode(MSIPACKAGE *package, LPCWSTR argument,
|
|
|
|
msi_dialog *dialog)
|
|
|
|
{
|
2010-04-21 11:38:40 +02:00
|
|
|
return msi_set_property( package->db, szReinstallMode, argument );
|
2007-05-07 03:54:21 +02:00
|
|
|
}
|
|
|
|
|
2010-03-26 12:12:06 +01:00
|
|
|
static UINT ControlEvent_Reinstall( MSIPACKAGE *package, LPCWSTR argument,
|
|
|
|
msi_dialog *dialog )
|
|
|
|
{
|
2010-04-27 13:29:31 +02:00
|
|
|
return msi_set_property( package->db, szReinstall, argument );
|
2010-03-26 12:12:06 +01:00
|
|
|
}
|
|
|
|
|
2010-01-20 15:36:00 +01:00
|
|
|
static UINT ControlEvent_ValidateProductID(MSIPACKAGE *package, LPCWSTR argument,
|
|
|
|
msi_dialog *dialog)
|
|
|
|
{
|
|
|
|
LPWSTR key, template;
|
|
|
|
UINT ret = ERROR_SUCCESS;
|
|
|
|
|
2010-04-21 11:37:54 +02:00
|
|
|
template = msi_dup_property( package->db, szPIDTemplate );
|
|
|
|
key = msi_dup_property( package->db, szPIDKEY );
|
2010-01-20 15:36:00 +01:00
|
|
|
|
|
|
|
if (key && template)
|
|
|
|
{
|
|
|
|
FIXME( "partial stub: template %s key %s\n", debugstr_w(template), debugstr_w(key) );
|
2010-04-21 11:38:40 +02:00
|
|
|
ret = msi_set_property( package->db, szProductID, key );
|
2010-01-20 15:36:00 +01:00
|
|
|
}
|
|
|
|
msi_free( template );
|
|
|
|
msi_free( key );
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2011-06-07 10:35:34 +02:00
|
|
|
static const WCHAR end_dialogW[] = {'E','n','d','D','i','a','l','o','g',0};
|
|
|
|
static const WCHAR new_dialogW[] = {'N','e','w','D','i','a','l','o','g',0};
|
|
|
|
static const WCHAR spawn_dialogW[] = {'S','p','a','w','n','D','i','a','l','o','g',0};
|
|
|
|
static const WCHAR spawn_wait_dialogW[] = {'S','p','a','w','n','W','a','i','t','D','i','a','l','o','g',0};
|
|
|
|
static const WCHAR do_actionW[] = {'D','o','A','c','t','i','o','n',0};
|
|
|
|
static const WCHAR add_localW[] = {'A','d','d','L','o','c','a','l',0};
|
|
|
|
static const WCHAR removeW[] = {'R','e','m','o','v','e',0};
|
|
|
|
static const WCHAR add_sourceW[] = {'A','d','d','S','o','u','r','c','e',0};
|
|
|
|
static const WCHAR set_target_pathW[] = {'S','e','t','T','a','r','g','e','t','P','a','t','h',0};
|
|
|
|
static const WCHAR resetW[] = {'R','e','s','e','t',0};
|
|
|
|
static const WCHAR set_install_levelW[] = {'S','e','t','I','n','s','t','a','l','l','L','e','v','e','l',0};
|
|
|
|
static const WCHAR directory_list_upW[] = {'D','i','r','e','c','t','o','r','y','L','i','s','t','U','p',0};
|
|
|
|
static const WCHAR selection_browseW[] = {'S','e','l','e','c','t','i','o','n','B','r','o','w','s','e',0};
|
|
|
|
static const WCHAR reinstall_modeW[] = {'R','e','i','n','s','t','a','l','l','M','o','d','e',0};
|
|
|
|
static const WCHAR reinstallW[] = {'R','e','i','n','s','t','a','l','l',0};
|
|
|
|
static const WCHAR validate_product_idW[] = {'V','a','l','i','d','a','t','e','P','r','o','d','u','c','t','I','D',0};
|
|
|
|
|
|
|
|
static const struct control_events control_events[] =
|
|
|
|
{
|
|
|
|
{ end_dialogW, ControlEvent_EndDialog },
|
|
|
|
{ new_dialogW, ControlEvent_NewDialog },
|
|
|
|
{ spawn_dialogW, ControlEvent_SpawnDialog },
|
|
|
|
{ spawn_wait_dialogW, ControlEvent_SpawnWaitDialog },
|
|
|
|
{ do_actionW, ControlEvent_DoAction },
|
|
|
|
{ add_localW, ControlEvent_AddLocal },
|
|
|
|
{ removeW, ControlEvent_Remove },
|
|
|
|
{ add_sourceW, ControlEvent_AddSource },
|
|
|
|
{ set_target_pathW, ControlEvent_SetTargetPath },
|
|
|
|
{ resetW, ControlEvent_Reset },
|
|
|
|
{ set_install_levelW, ControlEvent_SetInstallLevel },
|
|
|
|
{ directory_list_upW, ControlEvent_DirectoryListUp },
|
|
|
|
{ selection_browseW, ControlEvent_SpawnDialog },
|
|
|
|
{ reinstall_modeW, ControlEvent_ReinstallMode },
|
|
|
|
{ reinstallW, ControlEvent_Reinstall },
|
|
|
|
{ validate_product_idW, ControlEvent_ValidateProductID },
|
|
|
|
{ NULL, NULL }
|
2005-05-27 11:11:18 +02:00
|
|
|
};
|
|
|
|
|
2011-06-07 10:35:34 +02:00
|
|
|
UINT ControlEvent_HandleControlEvent( MSIPACKAGE *package, LPCWSTR event,
|
|
|
|
LPCWSTR argument, msi_dialog *dialog )
|
2005-05-27 11:11:18 +02:00
|
|
|
{
|
2011-06-07 10:35:34 +02:00
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
TRACE("handling control event %s\n", debugstr_w(event));
|
2005-05-27 11:11:18 +02:00
|
|
|
|
2011-06-07 10:35:34 +02:00
|
|
|
if (!event) return ERROR_SUCCESS;
|
2005-05-27 11:11:18 +02:00
|
|
|
|
2011-06-07 10:35:34 +02:00
|
|
|
for (i = 0; control_events[i].event; i++)
|
2005-05-27 11:11:18 +02:00
|
|
|
{
|
2011-06-07 10:35:34 +02:00
|
|
|
if (!strcmpW( control_events[i].event, event ))
|
|
|
|
return control_events[i].handler( package, argument, dialog );
|
2005-05-27 11:11:18 +02:00
|
|
|
}
|
2011-06-07 10:35:34 +02:00
|
|
|
FIXME("unhandled control event %s arg(%s)\n", debugstr_w(event), debugstr_w(argument));
|
|
|
|
return ERROR_SUCCESS;
|
2005-05-27 11:11:18 +02:00
|
|
|
}
|