msi: Implement MsiGetMode for MSIRUNMODE_SCHEDULED, MSIRUNMODE_COMMIT and MSIRUNMODE_ROLLBACK.
This commit is contained in:
parent
1a23836f91
commit
8a94f7aad3
|
@ -748,9 +748,9 @@ static UINT ACTION_PerformActionSequence(MSIPACKAGE *package, UINT seq, BOOL UI)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (UI)
|
if (UI)
|
||||||
rc = ACTION_PerformUIAction(package,action);
|
rc = ACTION_PerformUIAction(package,action,-1);
|
||||||
else
|
else
|
||||||
rc = ACTION_PerformAction(package,action,FALSE);
|
rc = ACTION_PerformAction(package,action,-1,FALSE);
|
||||||
end:
|
end:
|
||||||
msiobj_release(&row->hdr);
|
msiobj_release(&row->hdr);
|
||||||
}
|
}
|
||||||
|
@ -789,9 +789,9 @@ static UINT ITERATE_Actions(MSIRECORD *row, LPVOID param)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (iap->UI)
|
if (iap->UI)
|
||||||
rc = ACTION_PerformUIAction(iap->package,action);
|
rc = ACTION_PerformUIAction(iap->package,action,-1);
|
||||||
else
|
else
|
||||||
rc = ACTION_PerformAction(iap->package,action,FALSE);
|
rc = ACTION_PerformAction(iap->package,action,-1,FALSE);
|
||||||
|
|
||||||
msi_dialog_check_messages( NULL );
|
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,
|
static BOOL ACTION_HandleCustomAction( MSIPACKAGE* package, LPCWSTR action,
|
||||||
UINT* rc, BOOL force )
|
UINT* rc, UINT script, BOOL force )
|
||||||
{
|
{
|
||||||
BOOL ret=FALSE;
|
BOOL ret=FALSE;
|
||||||
UINT arc;
|
UINT arc;
|
||||||
|
|
||||||
arc = ACTION_CustomAction(package,action, force);
|
arc = ACTION_CustomAction(package, action, script, force);
|
||||||
|
|
||||||
if (arc != ERROR_CALL_NOT_IMPLEMENTED)
|
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
|
* 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.
|
* 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;
|
UINT rc = ERROR_SUCCESS;
|
||||||
BOOL handled;
|
BOOL handled;
|
||||||
|
@ -1013,7 +1013,7 @@ UINT ACTION_PerformAction(MSIPACKAGE *package, const WCHAR *action, BOOL force)
|
||||||
handled = ACTION_HandleStandardAction(package, action, &rc, force);
|
handled = ACTION_HandleStandardAction(package, action, &rc, force);
|
||||||
|
|
||||||
if (!handled)
|
if (!handled)
|
||||||
handled = ACTION_HandleCustomAction(package, action, &rc, force);
|
handled = ACTION_HandleCustomAction(package, action, &rc, script, force);
|
||||||
|
|
||||||
if (!handled)
|
if (!handled)
|
||||||
{
|
{
|
||||||
|
@ -1024,7 +1024,7 @@ UINT ACTION_PerformAction(MSIPACKAGE *package, const WCHAR *action, BOOL force)
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT ACTION_PerformUIAction(MSIPACKAGE *package, const WCHAR *action)
|
UINT ACTION_PerformUIAction(MSIPACKAGE *package, const WCHAR *action, UINT script)
|
||||||
{
|
{
|
||||||
UINT rc = ERROR_SUCCESS;
|
UINT rc = ERROR_SUCCESS;
|
||||||
BOOL handled = FALSE;
|
BOOL handled = FALSE;
|
||||||
|
@ -1034,7 +1034,7 @@ UINT ACTION_PerformUIAction(MSIPACKAGE *package, const WCHAR *action)
|
||||||
handled = ACTION_HandleStandardAction(package, action, &rc,TRUE);
|
handled = ACTION_HandleStandardAction(package, action, &rc,TRUE);
|
||||||
|
|
||||||
if (!handled)
|
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 )
|
if( !handled && ACTION_DialogBox(package,action) == ERROR_SUCCESS )
|
||||||
handled = TRUE;
|
handled = TRUE;
|
||||||
|
@ -1598,7 +1598,7 @@ static UINT execute_script(MSIPACKAGE *package, UINT script )
|
||||||
action = package->script->Actions[script][i];
|
action = package->script->Actions[script][i];
|
||||||
ui_actionstart(package, action);
|
ui_actionstart(package, action);
|
||||||
TRACE("Executing Action (%s)\n",debugstr_w(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)
|
if (rc != ERROR_SUCCESS)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -174,7 +174,7 @@ static void set_deferred_action_props(MSIPACKAGE *package, LPWSTR deferred_data)
|
||||||
MSI_SetPropertyW(package, ProdCode, beg);
|
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;
|
UINT rc = ERROR_SUCCESS;
|
||||||
MSIRECORD * row = 0;
|
MSIRECORD * row = 0;
|
||||||
|
@ -258,6 +258,21 @@ UINT ACTION_CustomAction(MSIPACKAGE *package,LPCWSTR action, BOOL execute)
|
||||||
|
|
||||||
LPWSTR actiondata = msi_dup_property( package, action );
|
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)
|
if (deferred_data)
|
||||||
set_deferred_action_props(package, deferred_data);
|
set_deferred_action_props(package, deferred_data);
|
||||||
else if (actiondata)
|
else if (actiondata)
|
||||||
|
@ -334,6 +349,9 @@ UINT ACTION_CustomAction(MSIPACKAGE *package,LPCWSTR action, BOOL execute)
|
||||||
}
|
}
|
||||||
|
|
||||||
end:
|
end:
|
||||||
|
package->scheduled_action_running = FALSE;
|
||||||
|
package->commit_action_running = FALSE;
|
||||||
|
package->rollback_action_running = FALSE;
|
||||||
msi_free(action_copy);
|
msi_free(action_copy);
|
||||||
msiobj_release(&row->hdr);
|
msiobj_release(&row->hdr);
|
||||||
return rc;
|
return rc;
|
||||||
|
|
|
@ -168,7 +168,7 @@ static UINT ControlEvent_SpawnWaitDialog(MSIPACKAGE* package, LPCWSTR argument,
|
||||||
static UINT ControlEvent_DoAction(MSIPACKAGE* package, LPCWSTR argument,
|
static UINT ControlEvent_DoAction(MSIPACKAGE* package, LPCWSTR argument,
|
||||||
msi_dialog* dialog)
|
msi_dialog* dialog)
|
||||||
{
|
{
|
||||||
ACTION_PerformAction(package,argument,TRUE);
|
ACTION_PerformAction(package,argument,-1,TRUE);
|
||||||
return ERROR_SUCCESS;
|
return ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@ UINT WINAPI MsiDoActionW( MSIHANDLE hInstall, LPCWSTR szAction )
|
||||||
if (!package)
|
if (!package)
|
||||||
return ERROR_INVALID_HANDLE;
|
return ERROR_INVALID_HANDLE;
|
||||||
|
|
||||||
ret = ACTION_PerformUIAction( package, szAction );
|
ret = ACTION_PerformUIAction( package, szAction, -1 );
|
||||||
msiobj_release( &package->hdr );
|
msiobj_release( &package->hdr );
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -452,8 +452,13 @@ UINT WINAPI MsiSetTargetPathW(MSIHANDLE hInstall, LPCWSTR szFolder,
|
||||||
*/
|
*/
|
||||||
BOOL WINAPI MsiGetMode(MSIHANDLE hInstall, MSIRUNMODE iRunMode)
|
BOOL WINAPI MsiGetMode(MSIHANDLE hInstall, MSIRUNMODE iRunMode)
|
||||||
{
|
{
|
||||||
|
MSIPACKAGE *package;
|
||||||
BOOL r = FALSE;
|
BOOL r = FALSE;
|
||||||
|
|
||||||
|
package = msihandle2msiinfo(hInstall, MSIHANDLETYPE_PACKAGE);
|
||||||
|
if (!package)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
switch (iRunMode)
|
switch (iRunMode)
|
||||||
{
|
{
|
||||||
case MSIRUNMODE_WINDOWS9X:
|
case MSIRUNMODE_WINDOWS9X:
|
||||||
|
@ -467,8 +472,15 @@ BOOL WINAPI MsiGetMode(MSIHANDLE hInstall, MSIRUNMODE iRunMode)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MSIRUNMODE_SCHEDULED:
|
case MSIRUNMODE_SCHEDULED:
|
||||||
|
r = package->scheduled_action_running;
|
||||||
|
break;
|
||||||
|
|
||||||
case MSIRUNMODE_ROLLBACK:
|
case MSIRUNMODE_ROLLBACK:
|
||||||
|
r = package->rollback_action_running;
|
||||||
|
break;
|
||||||
|
|
||||||
case MSIRUNMODE_COMMIT:
|
case MSIRUNMODE_COMMIT:
|
||||||
|
r = package->commit_action_running;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -1765,7 +1765,7 @@ UINT WINAPI MsiCollectUserInfoW(LPCWSTR szProduct)
|
||||||
return ERROR_INVALID_PARAMETER;
|
return ERROR_INVALID_PARAMETER;
|
||||||
|
|
||||||
package = msihandle2msiinfo(handle, MSIHANDLETYPE_PACKAGE);
|
package = msihandle2msiinfo(handle, MSIHANDLETYPE_PACKAGE);
|
||||||
rc = ACTION_PerformUIAction(package, szFirstRun);
|
rc = ACTION_PerformUIAction(package, szFirstRun, -1);
|
||||||
msiobj_release( &package->hdr );
|
msiobj_release( &package->hdr );
|
||||||
|
|
||||||
MsiCloseHandle(handle);
|
MsiCloseHandle(handle);
|
||||||
|
@ -1787,7 +1787,7 @@ UINT WINAPI MsiCollectUserInfoA(LPCSTR szProduct)
|
||||||
return ERROR_INVALID_PARAMETER;
|
return ERROR_INVALID_PARAMETER;
|
||||||
|
|
||||||
package = msihandle2msiinfo(handle, MSIHANDLETYPE_PACKAGE);
|
package = msihandle2msiinfo(handle, MSIHANDLETYPE_PACKAGE);
|
||||||
rc = ACTION_PerformUIAction(package, szFirstRun);
|
rc = ACTION_PerformUIAction(package, szFirstRun, -1);
|
||||||
msiobj_release( &package->hdr );
|
msiobj_release( &package->hdr );
|
||||||
|
|
||||||
MsiCloseHandle(handle);
|
MsiCloseHandle(handle);
|
||||||
|
@ -1869,7 +1869,7 @@ UINT WINAPI MsiConfigureFeatureW(LPCWSTR szProduct, LPCWSTR szFeature, INSTALLST
|
||||||
|
|
||||||
MsiSetInternalUI( INSTALLUILEVEL_BASIC, NULL );
|
MsiSetInternalUI( INSTALLUILEVEL_BASIC, NULL );
|
||||||
|
|
||||||
r = ACTION_PerformUIAction( package, szCostInit );
|
r = ACTION_PerformUIAction( package, szCostInit, -1 );
|
||||||
if (r != ERROR_SUCCESS)
|
if (r != ERROR_SUCCESS)
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
|
|
|
@ -248,6 +248,10 @@ typedef struct tagMSIPACKAGE
|
||||||
UINT WordCount;
|
UINT WordCount;
|
||||||
|
|
||||||
struct list subscriptions;
|
struct list subscriptions;
|
||||||
|
|
||||||
|
unsigned char scheduled_action_running : 1;
|
||||||
|
unsigned char commit_action_running : 1;
|
||||||
|
unsigned char rollback_action_running : 1;
|
||||||
} MSIPACKAGE;
|
} MSIPACKAGE;
|
||||||
|
|
||||||
typedef struct tagMSIPREVIEW
|
typedef struct tagMSIPREVIEW
|
||||||
|
@ -731,10 +735,10 @@ extern WCHAR gszLogFile[MAX_PATH];
|
||||||
extern HINSTANCE msi_hInstance;
|
extern HINSTANCE msi_hInstance;
|
||||||
|
|
||||||
/* action related functions */
|
/* action related functions */
|
||||||
extern UINT ACTION_PerformAction(MSIPACKAGE *package, const WCHAR *action, BOOL force);
|
extern UINT ACTION_PerformAction(MSIPACKAGE *package, const WCHAR *action, UINT script, BOOL force);
|
||||||
extern UINT ACTION_PerformUIAction(MSIPACKAGE *package, const WCHAR *action);
|
extern UINT ACTION_PerformUIAction(MSIPACKAGE *package, const WCHAR *action, UINT script);
|
||||||
extern void ACTION_FinishCustomActions( const MSIPACKAGE* package);
|
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 )
|
static inline void msi_feature_set_state( MSIFEATURE *feature, INSTALLSTATE state )
|
||||||
{
|
{
|
||||||
|
|
|
@ -702,6 +702,9 @@ static MSIPACKAGE *msi_alloc_package( void )
|
||||||
package->LastAction = NULL;
|
package->LastAction = NULL;
|
||||||
package->dialog = NULL;
|
package->dialog = NULL;
|
||||||
package->next_dialog = NULL;
|
package->next_dialog = NULL;
|
||||||
|
package->scheduled_action_running = FALSE;
|
||||||
|
package->commit_action_running = FALSE;
|
||||||
|
package->rollback_action_running = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return package;
|
return package;
|
||||||
|
|
Loading…
Reference in New Issue