Commit 9cd707da authored by Aric Stewart's avatar Aric Stewart Committed by Alexandre Julliard

Introduce really basic scripting of actions. This is primarily to get

the order of execution of the action correct since some custom actions can be scripted and others are run during the script building phase.
parent aa95731d
...@@ -179,8 +179,23 @@ typedef struct tagMSIAPPID ...@@ -179,8 +179,23 @@ typedef struct tagMSIAPPID
BOOL RunAsInteractiveUser; BOOL RunAsInteractiveUser;
} MSIAPPID; } MSIAPPID;
enum SCRIPTS {
INSTALL_SCRIPT = 0,
COMMIT_SCRIPT = 1,
ROLLBACK_SCRIPT = 2,
TOTAL_SCRIPTS = 3
};
typedef struct tagMSISCRIPT
{
LPWSTR *Actions[TOTAL_SCRIPTS];
UINT ActionCount[TOTAL_SCRIPTS];
BOOL ExecuteSequenceRun;
BOOL CurrentlyScripting;
}MSISCRIPT;
UINT ACTION_PerformAction(MSIPACKAGE *package, const WCHAR *action); UINT ACTION_PerformAction(MSIPACKAGE *package, const WCHAR *action, BOOL force);
UINT ACTION_PerformUIAction(MSIPACKAGE *package, const WCHAR *action); UINT ACTION_PerformUIAction(MSIPACKAGE *package, const WCHAR *action);
void ACTION_FinishCustomActions( MSIPACKAGE* package); void ACTION_FinishCustomActions( MSIPACKAGE* package);
UINT ACTION_CustomAction(MSIPACKAGE *package,const WCHAR *action, BOOL execute); UINT ACTION_CustomAction(MSIPACKAGE *package,const WCHAR *action, BOOL execute);
...@@ -196,6 +211,7 @@ int get_loaded_component(MSIPACKAGE* package, LPCWSTR Component ); ...@@ -196,6 +211,7 @@ int get_loaded_component(MSIPACKAGE* package, LPCWSTR Component );
int get_loaded_feature(MSIPACKAGE* package, LPCWSTR Feature ); int get_loaded_feature(MSIPACKAGE* package, LPCWSTR Feature );
int get_loaded_file(MSIPACKAGE* package, LPCWSTR file); int get_loaded_file(MSIPACKAGE* package, LPCWSTR file);
int track_tempfile(MSIPACKAGE *package, LPCWSTR name, LPCWSTR path); int track_tempfile(MSIPACKAGE *package, LPCWSTR name, LPCWSTR path);
UINT schedule_action(MSIPACKAGE *package, UINT script, LPCWSTR action);
/* control event stuff */ /* control event stuff */
VOID ControlEvent_FireSubscribedEvent(MSIPACKAGE *package, LPCWSTR event, VOID ControlEvent_FireSubscribedEvent(MSIPACKAGE *package, LPCWSTR event,
......
...@@ -123,6 +123,7 @@ UINT ACTION_CustomAction(MSIPACKAGE *package,LPCWSTR action, BOOL execute) ...@@ -123,6 +123,7 @@ UINT ACTION_CustomAction(MSIPACKAGE *package,LPCWSTR action, BOOL execute)
if (type & 0x100) if (type & 0x100)
{ {
FIXME("Rollback only action... rollbacks not supported yet\n"); FIXME("Rollback only action... rollbacks not supported yet\n");
schedule_action(package, ROLLBACK_SCRIPT, action);
HeapFree(GetProcessHeap(),0,source); HeapFree(GetProcessHeap(),0,source);
HeapFree(GetProcessHeap(),0,target); HeapFree(GetProcessHeap(),0,target);
msiobj_release(&row->hdr); msiobj_release(&row->hdr);
...@@ -132,37 +133,15 @@ UINT ACTION_CustomAction(MSIPACKAGE *package,LPCWSTR action, BOOL execute) ...@@ -132,37 +133,15 @@ UINT ACTION_CustomAction(MSIPACKAGE *package,LPCWSTR action, BOOL execute)
} }
if (!execute) if (!execute)
{ {
LPWSTR *newbuf = NULL;
INT count;
if (type & 0x200) if (type & 0x200)
{ {
TRACE("Deferring Commit Action!\n"); TRACE("Deferring Commit Action!\n");
count = package->CommitActionCount; schedule_action(package, COMMIT_SCRIPT, action);
package->CommitActionCount++;
if (count != 0)
newbuf = HeapReAlloc(GetProcessHeap(),0,
package->CommitAction,
package->CommitActionCount * sizeof(LPWSTR));
else
newbuf = HeapAlloc(GetProcessHeap(),0, sizeof(LPWSTR));
newbuf[count] = strdupW(action);
package->CommitAction = newbuf;
} }
else else
{ {
TRACE("Deferring Action!\n"); TRACE("Deferring Action!\n");
count = package->DeferredActionCount; schedule_action(package, INSTALL_SCRIPT, action);
package->DeferredActionCount++;
if (count != 0)
newbuf = HeapReAlloc(GetProcessHeap(),0,
package->DeferredAction,
package->DeferredActionCount * sizeof(LPWSTR));
else
newbuf = HeapAlloc(GetProcessHeap(),0, sizeof(LPWSTR));
newbuf[count] = strdupW(action);
package->DeferredAction = newbuf;
} }
HeapFree(GetProcessHeap(),0,source); HeapFree(GetProcessHeap(),0,source);
......
...@@ -163,7 +163,7 @@ static VOID ControlEvent_SpawnWaitDialog(MSIPACKAGE* package, LPCWSTR argument, ...@@ -163,7 +163,7 @@ static VOID ControlEvent_SpawnWaitDialog(MSIPACKAGE* package, LPCWSTR argument,
static VOID ControlEvent_DoAction(MSIPACKAGE* package, LPCWSTR argument, static VOID ControlEvent_DoAction(MSIPACKAGE* package, LPCWSTR argument,
msi_dialog* dialog) msi_dialog* dialog)
{ {
ACTION_PerformAction(package,argument); ACTION_PerformAction(package,argument,TRUE);
} }
static VOID ControlEvent_AddLocal(MSIPACKAGE* package, LPCWSTR argument, static VOID ControlEvent_AddLocal(MSIPACKAGE* package, LPCWSTR argument,
......
...@@ -210,11 +210,7 @@ typedef struct tagMSIPACKAGE ...@@ -210,11 +210,7 @@ typedef struct tagMSIPACKAGE
struct tagMSIAPPID *appids; struct tagMSIAPPID *appids;
UINT loaded_appids; UINT loaded_appids;
LPWSTR *DeferredAction; struct tagMSISCRIPT *script;
UINT DeferredActionCount;
LPWSTR *CommitAction;
UINT CommitActionCount;
struct tagMSIRUNNINGACTION *RunningAction; struct tagMSIRUNNINGACTION *RunningAction;
UINT RunningActionCount; UINT RunningActionCount;
...@@ -224,8 +220,7 @@ typedef struct tagMSIPACKAGE ...@@ -224,8 +220,7 @@ typedef struct tagMSIPACKAGE
UINT CurrentInstallState; UINT CurrentInstallState;
msi_dialog *dialog; msi_dialog *dialog;
LPWSTR next_dialog; LPWSTR next_dialog;
BOOL ExecuteSequenceRun;
struct _subscriptions *EventSubscriptions; struct _subscriptions *EventSubscriptions;
} MSIPACKAGE; } MSIPACKAGE;
......
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