Commit f25501db authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

Revert "msi: Store the current script in the package."

Commit 036f007e (which reverts 86bc556f) is not sufficient to fix the Office installers because MsiGetMode(MSIRUNMODE_SCHEDULED) no longer does the right thing after the revert. That is caused by "msi: Store the current script in the package.", which, in hindsight, should have been part of the first commit. This reverts e1e668d4. Signed-off-by: 's avatarHans Leidekker <hans@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 3b4c6e6d
......@@ -510,7 +510,7 @@ static UINT ITERATE_Actions(MSIRECORD *row, LPVOID param)
return ERROR_SUCCESS;
}
rc = ACTION_PerformAction(package, action);
rc = ACTION_PerformAction(package, action, SCRIPT_NONE);
msi_dialog_check_messages( NULL );
......@@ -604,7 +604,7 @@ static UINT ACTION_ProcessUISequence(MSIPACKAGE *package)
/********************************************************
* ACTION helper functions and functions that perform the actions
*******************************************************/
static UINT ACTION_HandleCustomAction(MSIPACKAGE *package, LPCWSTR action)
static UINT ACTION_HandleCustomAction(MSIPACKAGE *package, LPCWSTR action, UINT script)
{
UINT arc;
INT uirc;
......@@ -613,7 +613,7 @@ static UINT ACTION_HandleCustomAction(MSIPACKAGE *package, LPCWSTR action)
if (uirc == IDCANCEL)
return ERROR_INSTALL_USEREXIT;
ui_actioninfo(package, action, TRUE, 0);
arc = ACTION_CustomAction(package, action);
arc = ACTION_CustomAction( package, action, script );
uirc = !arc;
if (arc == ERROR_FUNCTION_NOT_CALLED && needs_ui_sequence(package))
......@@ -1546,13 +1546,11 @@ static UINT execute_script( MSIPACKAGE *package, UINT script )
TRACE("executing script %u\n", script);
package->script = script;
if (script == SCRIPT_ROLLBACK)
{
for (i = package->script_actions_count[script]; i > 0; i--)
{
rc = ACTION_PerformAction(package, package->script_actions[script][i-1]);
rc = ACTION_PerformAction(package, package->script_actions[script][i-1], script);
if (rc != ERROR_SUCCESS)
{
ERR("Execution of script %i halted; action %s returned %u\n",
......@@ -1565,7 +1563,7 @@ static UINT execute_script( MSIPACKAGE *package, UINT script )
{
for (i = 0; i < package->script_actions_count[script]; i++)
{
rc = ACTION_PerformAction(package, package->script_actions[script][i]);
rc = ACTION_PerformAction(package, package->script_actions[script][i], script);
if (rc != ERROR_SUCCESS)
{
ERR("Execution of script %i halted; action %s returned %u\n",
......@@ -1574,9 +1572,6 @@ static UINT execute_script( MSIPACKAGE *package, UINT script )
}
}
}
package->script = SCRIPT_NONE;
msi_free_action_script(package, script);
return rc;
}
......@@ -5658,7 +5653,7 @@ static UINT ACTION_ExecuteAction(MSIPACKAGE *package)
msiobj_release(&uirow->hdr);
}
else
rc = ACTION_PerformAction(package, action);
rc = ACTION_PerformAction(package, action, SCRIPT_NONE);
/* Send all set properties. */
if (!MSI_OpenQuery(package->db, &view, prop_query))
......@@ -7897,7 +7892,7 @@ static UINT ACTION_HandleStandardAction(MSIPACKAGE *package, LPCWSTR action)
return rc;
}
UINT ACTION_PerformAction(MSIPACKAGE *package, const WCHAR *action)
UINT ACTION_PerformAction(MSIPACKAGE *package, const WCHAR *action, UINT script)
{
UINT rc;
......@@ -7907,7 +7902,7 @@ UINT ACTION_PerformAction(MSIPACKAGE *package, const WCHAR *action)
rc = ACTION_HandleStandardAction(package, action);
if (rc == ERROR_FUNCTION_NOT_CALLED)
rc = ACTION_HandleCustomAction(package, action);
rc = ACTION_HandleCustomAction(package, action, script);
if (rc == ERROR_FUNCTION_NOT_CALLED)
WARN("unhandled msi action %s\n", debugstr_w(action));
......@@ -7960,7 +7955,7 @@ static UINT ACTION_PerformActionSequence(MSIPACKAGE *package, UINT seq)
return ERROR_FUNCTION_FAILED;
}
rc = ACTION_PerformAction(package, action);
rc = ACTION_PerformAction(package, action, SCRIPT_NONE);
msiobj_release(&row->hdr);
}
......@@ -8049,7 +8044,7 @@ UINT MSI_InstallPackage( MSIPACKAGE *package, LPCWSTR szPackagePath,
msi_set_property( package->db, szRollbackDisabled, szOne, -1 );
}
rc = ACTION_PerformAction(package, action);
rc = ACTION_PerformAction(package, action, SCRIPT_NONE);
/* process the ending type action */
if (rc == ERROR_SUCCESS)
......
......@@ -1186,7 +1186,7 @@ static UINT defer_custom_action( MSIPACKAGE *package, const WCHAR *action, UINT
return ERROR_SUCCESS;
}
UINT ACTION_CustomAction( MSIPACKAGE *package, LPCWSTR action )
UINT ACTION_CustomAction( MSIPACKAGE *package, LPCWSTR action, UINT script )
{
static const WCHAR query[] = {
'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
......@@ -1226,7 +1226,7 @@ UINT ACTION_CustomAction( MSIPACKAGE *package, LPCWSTR action )
if (type & msidbCustomActionTypeNoImpersonate)
WARN("msidbCustomActionTypeNoImpersonate not handled\n");
if (!action_type_matches_script( type, package->script ))
if (!action_type_matches_script( type, script ))
{
rc = defer_custom_action( package, action, type );
goto end;
......@@ -1235,6 +1235,15 @@ UINT ACTION_CustomAction( MSIPACKAGE *package, LPCWSTR action )
{
LPWSTR actiondata = msi_dup_property( package->db, action );
if (type & msidbCustomActionTypeInScript)
package->scheduled_action_running = TRUE;
if (type & msidbCustomActionTypeCommit)
package->commit_action_running = TRUE;
if (type & msidbCustomActionTypeRollback)
package->rollback_action_running = TRUE;
if (deferred_data)
set_deferred_action_props(package, deferred_data);
else if (actiondata)
......@@ -1316,6 +1325,9 @@ UINT ACTION_CustomAction( MSIPACKAGE *package, LPCWSTR action )
}
end:
package->scheduled_action_running = FALSE;
package->commit_action_running = FALSE;
package->rollback_action_running = FALSE;
msiobj_release(&row->hdr);
return rc;
}
......
......@@ -4366,7 +4366,7 @@ static UINT event_spawn_wait_dialog( msi_dialog *dialog, const WCHAR *argument )
static UINT event_do_action( msi_dialog *dialog, const WCHAR *argument )
{
ACTION_PerformAction( dialog->package, argument );
ACTION_PerformAction( dialog->package, argument, SCRIPT_NONE );
return ERROR_SUCCESS;
}
......
......@@ -105,7 +105,7 @@ UINT WINAPI MsiDoActionW( MSIHANDLE hInstall, LPCWSTR szAction )
return ERROR_SUCCESS;
}
ret = ACTION_PerformAction( package, szAction );
ret = ACTION_PerformAction( package, szAction, SCRIPT_NONE );
msiobj_release( &package->hdr );
return ret;
......@@ -736,15 +736,15 @@ BOOL WINAPI MsiGetMode(MSIHANDLE hInstall, MSIRUNMODE iRunMode)
break;
case MSIRUNMODE_SCHEDULED:
r = (package->script == SCRIPT_INSTALL);
r = package->scheduled_action_running;
break;
case MSIRUNMODE_ROLLBACK:
r = (package->script == SCRIPT_ROLLBACK);
r = package->rollback_action_running;
break;
case MSIRUNMODE_COMMIT:
r = (package->script == SCRIPT_COMMIT);
r = package->commit_action_running;
break;
case MSIRUNMODE_MAINTENANCE:
......
......@@ -3747,7 +3747,7 @@ UINT WINAPI MsiCollectUserInfoW(LPCWSTR szProduct)
if (!package)
return ERROR_CALL_NOT_IMPLEMENTED;
rc = ACTION_PerformAction(package, szFirstRun);
rc = ACTION_PerformAction(package, szFirstRun, SCRIPT_NONE);
msiobj_release( &package->hdr );
MsiCloseHandle(handle);
......@@ -3773,7 +3773,7 @@ UINT WINAPI MsiCollectUserInfoA(LPCSTR szProduct)
if (!package)
return ERROR_CALL_NOT_IMPLEMENTED;
rc = ACTION_PerformAction(package, szFirstRun);
rc = ACTION_PerformAction(package, szFirstRun, SCRIPT_NONE);
msiobj_release( &package->hdr );
MsiCloseHandle(handle);
......@@ -3854,7 +3854,7 @@ UINT WINAPI MsiConfigureFeatureW(LPCWSTR szProduct, LPCWSTR szFeature, INSTALLST
MsiSetInternalUI( INSTALLUILEVEL_BASIC, NULL );
r = ACTION_PerformAction( package, szCostInitialize );
r = ACTION_PerformAction( package, szCostInitialize, SCRIPT_NONE );
if (r != ERROR_SUCCESS)
goto end;
......
......@@ -412,7 +412,6 @@ typedef struct tagMSIPACKAGE
struct list mimes;
struct list appids;
enum script script;
LPWSTR *script_actions[SCRIPT_MAX];
int script_actions_count[SCRIPT_MAX];
LPWSTR *unique_actions;
......@@ -442,6 +441,9 @@ typedef struct tagMSIPACKAGE
struct list sourcelist_info;
struct list sourcelist_media;
unsigned char scheduled_action_running : 1;
unsigned char commit_action_running : 1;
unsigned char rollback_action_running : 1;
unsigned char need_reboot_at_end : 1;
unsigned char need_reboot_now : 1;
unsigned char need_rollback : 1;
......@@ -973,9 +975,9 @@ extern WCHAR *gszLogFile DECLSPEC_HIDDEN;
extern HINSTANCE msi_hInstance DECLSPEC_HIDDEN;
/* action related functions */
extern UINT ACTION_PerformAction(MSIPACKAGE *package, const WCHAR *action) DECLSPEC_HIDDEN;
extern UINT ACTION_PerformAction(MSIPACKAGE *package, const WCHAR *action, UINT script) DECLSPEC_HIDDEN;
extern void ACTION_FinishCustomActions( const MSIPACKAGE* package) DECLSPEC_HIDDEN;
extern UINT ACTION_CustomAction(MSIPACKAGE *, const WCHAR *) DECLSPEC_HIDDEN;
extern UINT ACTION_CustomAction(MSIPACKAGE *, const WCHAR *, UINT) DECLSPEC_HIDDEN;
/* actions in other modules */
extern UINT ACTION_AppSearch(MSIPACKAGE *package) DECLSPEC_HIDDEN;
......
......@@ -1098,7 +1098,6 @@ MSIPACKAGE *MSI_CreatePackage( MSIDATABASE *db, LPCWSTR base_url )
msi_load_admin_properties( package );
package->log_file = INVALID_HANDLE_VALUE;
package->script = SCRIPT_NONE;
}
return package;
}
......
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