msi: Implement MsiGetMode for MSIRUNMODE_SCHEDULED, MSIRUNMODE_COMMIT and MSIRUNMODE_ROLLBACK.

This commit is contained in:
Rob Shearman 2007-06-25 20:47:38 +01:00 committed by Alexandre Julliard
parent 1a23836f91
commit 8a94f7aad3
7 changed files with 57 additions and 20 deletions

View file

@ -748,9 +748,9 @@ static UINT ACTION_PerformActionSequence(MSIPACKAGE *package, UINT seq, BOOL UI)
}
if (UI)
rc = ACTION_PerformUIAction(package,action);
rc = ACTION_PerformUIAction(package,action,-1);
else
rc = ACTION_PerformAction(package,action,FALSE);
rc = ACTION_PerformAction(package,action,-1,FALSE);
end:
msiobj_release(&row->hdr);
}
@ -789,9 +789,9 @@ static UINT ITERATE_Actions(MSIRECORD *row, LPVOID param)
}
if (iap->UI)
rc = ACTION_PerformUIAction(iap->package,action);
rc = ACTION_PerformUIAction(iap->package,action,-1);
else
rc = ACTION_PerformAction(iap->package,action,FALSE);
rc = ACTION_PerformAction(iap->package,action,-1,FALSE);
msi_dialog_check_messages( NULL );
@ -980,12 +980,12 @@ static BOOL ACTION_HandleStandardAction(MSIPACKAGE *package, LPCWSTR action,
}
static BOOL ACTION_HandleCustomAction( MSIPACKAGE* package, LPCWSTR action,
UINT* rc, BOOL force )
UINT* rc, UINT script, BOOL force )
{
BOOL ret=FALSE;
UINT arc;
arc = ACTION_CustomAction(package,action, force);
arc = ACTION_CustomAction(package, action, script, force);
if (arc != ERROR_CALL_NOT_IMPLEMENTED)
{
@ -1003,7 +1003,7 @@ static BOOL ACTION_HandleCustomAction( MSIPACKAGE* package, LPCWSTR action,
* But until I get write access to the database that is hard, so I am going to
* hack it to see if I can get something to run.
*/
UINT ACTION_PerformAction(MSIPACKAGE *package, const WCHAR *action, BOOL force)
UINT ACTION_PerformAction(MSIPACKAGE *package, const WCHAR *action, UINT script, BOOL force)
{
UINT rc = ERROR_SUCCESS;
BOOL handled;
@ -1013,7 +1013,7 @@ UINT ACTION_PerformAction(MSIPACKAGE *package, const WCHAR *action, BOOL force)
handled = ACTION_HandleStandardAction(package, action, &rc, force);
if (!handled)
handled = ACTION_HandleCustomAction(package, action, &rc, force);
handled = ACTION_HandleCustomAction(package, action, &rc, script, force);
if (!handled)
{
@ -1024,7 +1024,7 @@ UINT ACTION_PerformAction(MSIPACKAGE *package, const WCHAR *action, BOOL force)
return rc;
}
UINT ACTION_PerformUIAction(MSIPACKAGE *package, const WCHAR *action)
UINT ACTION_PerformUIAction(MSIPACKAGE *package, const WCHAR *action, UINT script)
{
UINT rc = ERROR_SUCCESS;
BOOL handled = FALSE;
@ -1034,7 +1034,7 @@ UINT ACTION_PerformUIAction(MSIPACKAGE *package, const WCHAR *action)
handled = ACTION_HandleStandardAction(package, action, &rc,TRUE);
if (!handled)
handled = ACTION_HandleCustomAction(package, action, &rc, FALSE);
handled = ACTION_HandleCustomAction(package, action, &rc, script, FALSE);
if( !handled && ACTION_DialogBox(package,action) == ERROR_SUCCESS )
handled = TRUE;
@ -1598,7 +1598,7 @@ static UINT execute_script(MSIPACKAGE *package, UINT script )
action = package->script->Actions[script][i];
ui_actionstart(package, action);
TRACE("Executing Action (%s)\n",debugstr_w(action));
rc = ACTION_PerformAction(package, action, TRUE);
rc = ACTION_PerformAction(package, action, script, TRUE);
if (rc != ERROR_SUCCESS)
break;
}

View file

@ -174,7 +174,7 @@ static void set_deferred_action_props(MSIPACKAGE *package, LPWSTR deferred_data)
MSI_SetPropertyW(package, ProdCode, beg);
}
UINT ACTION_CustomAction(MSIPACKAGE *package,LPCWSTR action, BOOL execute)
UINT ACTION_CustomAction(MSIPACKAGE *package, LPCWSTR action, UINT script, BOOL execute)
{
UINT rc = ERROR_SUCCESS;
MSIRECORD * row = 0;
@ -258,6 +258,21 @@ UINT ACTION_CustomAction(MSIPACKAGE *package,LPCWSTR action, BOOL execute)
LPWSTR actiondata = msi_dup_property( package, action );
switch (script)
{
case INSTALL_SCRIPT:
package->scheduled_action_running = TRUE;
break;
case COMMIT_SCRIPT:
package->commit_action_running = TRUE;
break;
case ROLLBACK_SCRIPT:
package->rollback_action_running = TRUE;
break;
default:
break;
}
if (deferred_data)
set_deferred_action_props(package, deferred_data);
else if (actiondata)
@ -334,6 +349,9 @@ UINT ACTION_CustomAction(MSIPACKAGE *package,LPCWSTR action, BOOL execute)
}
end:
package->scheduled_action_running = FALSE;
package->commit_action_running = FALSE;
package->rollback_action_running = FALSE;
msi_free(action_copy);
msiobj_release(&row->hdr);
return rc;

View file

@ -168,7 +168,7 @@ static UINT ControlEvent_SpawnWaitDialog(MSIPACKAGE* package, LPCWSTR argument,
static UINT ControlEvent_DoAction(MSIPACKAGE* package, LPCWSTR argument,
msi_dialog* dialog)
{
ACTION_PerformAction(package,argument,TRUE);
ACTION_PerformAction(package,argument,-1,TRUE);
return ERROR_SUCCESS;
}

View file

@ -69,7 +69,7 @@ UINT WINAPI MsiDoActionW( MSIHANDLE hInstall, LPCWSTR szAction )
if (!package)
return ERROR_INVALID_HANDLE;
ret = ACTION_PerformUIAction( package, szAction );
ret = ACTION_PerformUIAction( package, szAction, -1 );
msiobj_release( &package->hdr );
return ret;
@ -452,8 +452,13 @@ UINT WINAPI MsiSetTargetPathW(MSIHANDLE hInstall, LPCWSTR szFolder,
*/
BOOL WINAPI MsiGetMode(MSIHANDLE hInstall, MSIRUNMODE iRunMode)
{
MSIPACKAGE *package;
BOOL r = FALSE;
package = msihandle2msiinfo(hInstall, MSIHANDLETYPE_PACKAGE);
if (!package)
return FALSE;
switch (iRunMode)
{
case MSIRUNMODE_WINDOWS9X:
@ -467,8 +472,15 @@ BOOL WINAPI MsiGetMode(MSIHANDLE hInstall, MSIRUNMODE iRunMode)
break;
case MSIRUNMODE_SCHEDULED:
r = package->scheduled_action_running;
break;
case MSIRUNMODE_ROLLBACK:
r = package->rollback_action_running;
break;
case MSIRUNMODE_COMMIT:
r = package->commit_action_running;
break;
default:

View file

@ -1765,7 +1765,7 @@ UINT WINAPI MsiCollectUserInfoW(LPCWSTR szProduct)
return ERROR_INVALID_PARAMETER;
package = msihandle2msiinfo(handle, MSIHANDLETYPE_PACKAGE);
rc = ACTION_PerformUIAction(package, szFirstRun);
rc = ACTION_PerformUIAction(package, szFirstRun, -1);
msiobj_release( &package->hdr );
MsiCloseHandle(handle);
@ -1787,7 +1787,7 @@ UINT WINAPI MsiCollectUserInfoA(LPCSTR szProduct)
return ERROR_INVALID_PARAMETER;
package = msihandle2msiinfo(handle, MSIHANDLETYPE_PACKAGE);
rc = ACTION_PerformUIAction(package, szFirstRun);
rc = ACTION_PerformUIAction(package, szFirstRun, -1);
msiobj_release( &package->hdr );
MsiCloseHandle(handle);
@ -1869,7 +1869,7 @@ UINT WINAPI MsiConfigureFeatureW(LPCWSTR szProduct, LPCWSTR szFeature, INSTALLST
MsiSetInternalUI( INSTALLUILEVEL_BASIC, NULL );
r = ACTION_PerformUIAction( package, szCostInit );
r = ACTION_PerformUIAction( package, szCostInit, -1 );
if (r != ERROR_SUCCESS)
goto end;

View file

@ -248,6 +248,10 @@ typedef struct tagMSIPACKAGE
UINT WordCount;
struct list subscriptions;
unsigned char scheduled_action_running : 1;
unsigned char commit_action_running : 1;
unsigned char rollback_action_running : 1;
} MSIPACKAGE;
typedef struct tagMSIPREVIEW
@ -731,10 +735,10 @@ extern WCHAR gszLogFile[MAX_PATH];
extern HINSTANCE msi_hInstance;
/* action related functions */
extern UINT ACTION_PerformAction(MSIPACKAGE *package, const WCHAR *action, BOOL force);
extern UINT ACTION_PerformUIAction(MSIPACKAGE *package, const WCHAR *action);
extern UINT ACTION_PerformAction(MSIPACKAGE *package, const WCHAR *action, UINT script, BOOL force);
extern UINT ACTION_PerformUIAction(MSIPACKAGE *package, const WCHAR *action, UINT script);
extern void ACTION_FinishCustomActions( const MSIPACKAGE* package);
extern UINT ACTION_CustomAction(MSIPACKAGE *package,const WCHAR *action, BOOL execute);
extern UINT ACTION_CustomAction(MSIPACKAGE *package,const WCHAR *action, UINT script, BOOL execute);
static inline void msi_feature_set_state( MSIFEATURE *feature, INSTALLSTATE state )
{

View file

@ -702,6 +702,9 @@ static MSIPACKAGE *msi_alloc_package( void )
package->LastAction = NULL;
package->dialog = NULL;
package->next_dialog = NULL;
package->scheduled_action_running = FALSE;
package->commit_action_running = FALSE;
package->rollback_action_running = FALSE;
}
return package;