msi: Schedule rollback for standard actions.

This commit is contained in:
Hans Leidekker 2011-05-20 12:33:45 +02:00 committed by Alexandre Julliard
parent 49f263558b
commit 0f5cb14a67
3 changed files with 91 additions and 85 deletions

View File

@ -7921,91 +7921,90 @@ static UINT ACTION_InstallSFPCatalogFile( MSIPACKAGE *package )
return msi_unimplemented_action_stub( package, "InstallSFPCatalogFile", table );
}
typedef UINT (*STANDARDACTIONHANDLER)(MSIPACKAGE*);
static const struct
{
const WCHAR *action;
UINT (*handler)(MSIPACKAGE *);
const WCHAR *action_rollback;
}
StandardActions[] =
{
{ szAllocateRegistrySpace, ACTION_AllocateRegistrySpace },
{ szAppSearch, ACTION_AppSearch },
{ szBindImage, ACTION_BindImage },
{ szCCPSearch, ACTION_CCPSearch },
{ szCostFinalize, ACTION_CostFinalize },
{ szCostInitialize, ACTION_CostInitialize },
{ szCreateFolders, ACTION_CreateFolders },
{ szCreateShortcuts, ACTION_CreateShortcuts },
{ szDeleteServices, ACTION_DeleteServices },
{ szDisableRollback, ACTION_DisableRollback },
{ szDuplicateFiles, ACTION_DuplicateFiles },
{ szExecuteAction, ACTION_ExecuteAction },
{ szFileCost, ACTION_FileCost },
{ szFindRelatedProducts, ACTION_FindRelatedProducts },
{ szForceReboot, ACTION_ForceReboot },
{ szInstallAdminPackage, ACTION_InstallAdminPackage },
{ szInstallExecute, ACTION_InstallExecute },
{ szInstallExecuteAgain, ACTION_InstallExecute },
{ szInstallFiles, ACTION_InstallFiles},
{ szInstallFinalize, ACTION_InstallFinalize },
{ szInstallInitialize, ACTION_InstallInitialize },
{ szInstallSFPCatalogFile, ACTION_InstallSFPCatalogFile },
{ szInstallValidate, ACTION_InstallValidate },
{ szIsolateComponents, ACTION_IsolateComponents },
{ szLaunchConditions, ACTION_LaunchConditions },
{ szMigrateFeatureStates, ACTION_MigrateFeatureStates },
{ szMoveFiles, ACTION_MoveFiles },
{ szMsiPublishAssemblies, ACTION_MsiPublishAssemblies },
{ szMsiUnpublishAssemblies, ACTION_MsiUnpublishAssemblies },
{ szInstallODBC, ACTION_InstallODBC },
{ szInstallServices, ACTION_InstallServices },
{ szPatchFiles, ACTION_PatchFiles },
{ szProcessComponents, ACTION_ProcessComponents },
{ szPublishComponents, ACTION_PublishComponents },
{ szPublishFeatures, ACTION_PublishFeatures },
{ szPublishProduct, ACTION_PublishProduct },
{ szRegisterClassInfo, ACTION_RegisterClassInfo },
{ szRegisterComPlus, ACTION_RegisterComPlus},
{ szRegisterExtensionInfo, ACTION_RegisterExtensionInfo },
{ szRegisterFonts, ACTION_RegisterFonts },
{ szRegisterMIMEInfo, ACTION_RegisterMIMEInfo },
{ szRegisterProduct, ACTION_RegisterProduct },
{ szRegisterProgIdInfo, ACTION_RegisterProgIdInfo },
{ szRegisterTypeLibraries, ACTION_RegisterTypeLibraries },
{ szRegisterUser, ACTION_RegisterUser },
{ szRemoveDuplicateFiles, ACTION_RemoveDuplicateFiles },
{ szRemoveEnvironmentStrings, ACTION_RemoveEnvironmentStrings },
{ szRemoveExistingProducts, ACTION_RemoveExistingProducts },
{ szRemoveFiles, ACTION_RemoveFiles },
{ szRemoveFolders, ACTION_RemoveFolders },
{ szRemoveIniValues, ACTION_RemoveIniValues },
{ szRemoveODBC, ACTION_RemoveODBC },
{ szRemoveRegistryValues, ACTION_RemoveRegistryValues },
{ szRemoveShortcuts, ACTION_RemoveShortcuts },
{ szResolveSource, ACTION_ResolveSource },
{ szRMCCPSearch, ACTION_RMCCPSearch },
{ szScheduleReboot, ACTION_ScheduleReboot },
{ szSelfRegModules, ACTION_SelfRegModules },
{ szSelfUnregModules, ACTION_SelfUnregModules },
{ szSetODBCFolders, ACTION_SetODBCFolders },
{ szStartServices, ACTION_StartServices },
{ szStopServices, ACTION_StopServices },
{ szUnpublishComponents, ACTION_UnpublishComponents },
{ szUnpublishFeatures, ACTION_UnpublishFeatures },
{ szUnregisterClassInfo, ACTION_UnregisterClassInfo },
{ szUnregisterComPlus, ACTION_UnregisterComPlus },
{ szUnregisterExtensionInfo, ACTION_UnregisterExtensionInfo },
{ szUnregisterFonts, ACTION_UnregisterFonts },
{ szUnregisterMIMEInfo, ACTION_UnregisterMIMEInfo },
{ szUnregisterProgIdInfo, ACTION_UnregisterProgIdInfo },
{ szUnregisterTypeLibraries, ACTION_UnregisterTypeLibraries },
{ szValidateProductID, ACTION_ValidateProductID },
{ szWriteEnvironmentStrings, ACTION_WriteEnvironmentStrings },
{ szWriteIniValues, ACTION_WriteIniValues },
{ szWriteRegistryValues, ACTION_WriteRegistryValues },
{ NULL, NULL },
{ szAllocateRegistrySpace, ACTION_AllocateRegistrySpace, NULL },
{ szAppSearch, ACTION_AppSearch, NULL },
{ szBindImage, ACTION_BindImage, NULL },
{ szCCPSearch, ACTION_CCPSearch, NULL },
{ szCostFinalize, ACTION_CostFinalize, NULL },
{ szCostInitialize, ACTION_CostInitialize, NULL },
{ szCreateFolders, ACTION_CreateFolders, szRemoveFolders },
{ szCreateShortcuts, ACTION_CreateShortcuts, szRemoveShortcuts },
{ szDeleteServices, ACTION_DeleteServices, NULL },
{ szDisableRollback, ACTION_DisableRollback, NULL },
{ szDuplicateFiles, ACTION_DuplicateFiles, szRemoveDuplicateFiles },
{ szExecuteAction, ACTION_ExecuteAction, NULL },
{ szFileCost, ACTION_FileCost, NULL },
{ szFindRelatedProducts, ACTION_FindRelatedProducts, NULL },
{ szForceReboot, ACTION_ForceReboot, NULL },
{ szInstallAdminPackage, ACTION_InstallAdminPackage, NULL },
{ szInstallExecute, ACTION_InstallExecute, NULL },
{ szInstallExecuteAgain, ACTION_InstallExecute, NULL },
{ szInstallFiles, ACTION_InstallFiles, NULL },
{ szInstallFinalize, ACTION_InstallFinalize, NULL },
{ szInstallInitialize, ACTION_InstallInitialize, NULL },
{ szInstallSFPCatalogFile, ACTION_InstallSFPCatalogFile, NULL },
{ szInstallValidate, ACTION_InstallValidate, NULL },
{ szIsolateComponents, ACTION_IsolateComponents, NULL },
{ szLaunchConditions, ACTION_LaunchConditions, NULL },
{ szMigrateFeatureStates, ACTION_MigrateFeatureStates, NULL },
{ szMoveFiles, ACTION_MoveFiles, NULL },
{ szMsiPublishAssemblies, ACTION_MsiPublishAssemblies, szMsiUnpublishAssemblies },
{ szMsiUnpublishAssemblies, ACTION_MsiUnpublishAssemblies, NULL },
{ szInstallODBC, ACTION_InstallODBC, szRemoveODBC },
{ szInstallServices, ACTION_InstallServices, szDeleteServices },
{ szPatchFiles, ACTION_PatchFiles, NULL },
{ szProcessComponents, ACTION_ProcessComponents, NULL },
{ szPublishComponents, ACTION_PublishComponents, szUnpublishComponents },
{ szPublishFeatures, ACTION_PublishFeatures, szUnpublishFeatures },
{ szPublishProduct, ACTION_PublishProduct, NULL },
{ szRegisterClassInfo, ACTION_RegisterClassInfo, szUnregisterClassInfo },
{ szRegisterComPlus, ACTION_RegisterComPlus, szUnregisterComPlus },
{ szRegisterExtensionInfo, ACTION_RegisterExtensionInfo, szUnregisterExtensionInfo },
{ szRegisterFonts, ACTION_RegisterFonts, szUnregisterFonts },
{ szRegisterMIMEInfo, ACTION_RegisterMIMEInfo, szUnregisterMIMEInfo },
{ szRegisterProduct, ACTION_RegisterProduct, NULL },
{ szRegisterProgIdInfo, ACTION_RegisterProgIdInfo, szUnregisterProgIdInfo },
{ szRegisterTypeLibraries, ACTION_RegisterTypeLibraries, szUnregisterTypeLibraries },
{ szRegisterUser, ACTION_RegisterUser, NULL },
{ szRemoveDuplicateFiles, ACTION_RemoveDuplicateFiles, NULL },
{ szRemoveEnvironmentStrings, ACTION_RemoveEnvironmentStrings, NULL },
{ szRemoveExistingProducts, ACTION_RemoveExistingProducts, NULL },
{ szRemoveFiles, ACTION_RemoveFiles, NULL },
{ szRemoveFolders, ACTION_RemoveFolders, NULL },
{ szRemoveIniValues, ACTION_RemoveIniValues, NULL },
{ szRemoveODBC, ACTION_RemoveODBC, NULL },
{ szRemoveRegistryValues, ACTION_RemoveRegistryValues, NULL },
{ szRemoveShortcuts, ACTION_RemoveShortcuts, NULL },
{ szResolveSource, ACTION_ResolveSource, NULL },
{ szRMCCPSearch, ACTION_RMCCPSearch, NULL },
{ szScheduleReboot, ACTION_ScheduleReboot, NULL },
{ szSelfRegModules, ACTION_SelfRegModules, szSelfUnregModules },
{ szSelfUnregModules, ACTION_SelfUnregModules, NULL },
{ szSetODBCFolders, ACTION_SetODBCFolders, NULL },
{ szStartServices, ACTION_StartServices, szStopServices },
{ szStopServices, ACTION_StopServices, NULL },
{ szUnpublishComponents, ACTION_UnpublishComponents, NULL },
{ szUnpublishFeatures, ACTION_UnpublishFeatures, NULL },
{ szUnregisterClassInfo, ACTION_UnregisterClassInfo, NULL },
{ szUnregisterComPlus, ACTION_UnregisterComPlus, NULL },
{ szUnregisterExtensionInfo, ACTION_UnregisterExtensionInfo, NULL },
{ szUnregisterFonts, ACTION_UnregisterFonts, NULL },
{ szUnregisterMIMEInfo, ACTION_UnregisterMIMEInfo, NULL },
{ szUnregisterProgIdInfo, ACTION_UnregisterProgIdInfo, NULL },
{ szUnregisterTypeLibraries, ACTION_UnregisterTypeLibraries, NULL },
{ szValidateProductID, ACTION_ValidateProductID, NULL },
{ szWriteEnvironmentStrings, ACTION_WriteEnvironmentStrings, szRemoveEnvironmentStrings },
{ szWriteIniValues, ACTION_WriteIniValues, szRemoveIniValues },
{ szWriteRegistryValues, ACTION_WriteRegistryValues, szRemoveRegistryValues },
{ NULL, NULL, NULL }
};
static BOOL ACTION_HandleStandardAction( MSIPACKAGE *package, LPCWSTR action, UINT *rc )
@ -8024,6 +8023,13 @@ static BOOL ACTION_HandleStandardAction( MSIPACKAGE *package, LPCWSTR action, UI
ui_actioninfo( package, action, TRUE, 0 );
*rc = StandardActions[i].handler( package );
ui_actioninfo( package, action, FALSE, *rc );
if (StandardActions[i].action_rollback &&
!msi_get_property_int( package->db, szRollbackDisabled, 0 ))
{
TRACE("scheduling rollback action\n");
msi_schedule_action( package, ROLLBACK_SCRIPT, StandardActions[i].action_rollback );
}
}
else
{

View File

@ -89,7 +89,7 @@ static CRITICAL_SECTION msi_custom_action_cs = { &msi_custom_action_cs_debug, -1
static struct list msi_pending_custom_actions = LIST_INIT( msi_pending_custom_actions );
static UINT schedule_action( MSIPACKAGE *package, UINT script, const WCHAR *action )
UINT msi_schedule_action( MSIPACKAGE *package, UINT script, const WCHAR *action )
{
UINT count;
WCHAR **newbuf = NULL;
@ -286,17 +286,17 @@ UINT ACTION_CustomAction(MSIPACKAGE *package, LPCWSTR action, UINT script, BOOL
if (type & msidbCustomActionTypeCommit)
{
TRACE("Deferring commit action\n");
schedule_action(package, COMMIT_SCRIPT, deferred);
msi_schedule_action(package, COMMIT_SCRIPT, deferred);
}
else if (type & msidbCustomActionTypeRollback)
{
FIXME("Deferring rollback only action\n");
schedule_action(package, ROLLBACK_SCRIPT, deferred);
TRACE("Deferring rollback action\n");
msi_schedule_action(package, ROLLBACK_SCRIPT, deferred);
}
else
{
TRACE("Deferring action\n");
schedule_action(package, INSTALL_SCRIPT, deferred);
msi_schedule_action(package, INSTALL_SCRIPT, deferred);
}
rc = ERROR_SUCCESS;

View File

@ -767,8 +767,8 @@ extern UINT ACTION_DialogBox( MSIPACKAGE*, LPCWSTR) DECLSPEC_HIDDEN;
extern UINT ACTION_ForceReboot(MSIPACKAGE *package) DECLSPEC_HIDDEN;
extern UINT MSI_Sequence( MSIPACKAGE *package, LPCWSTR szTable, INT iSequenceMode ) DECLSPEC_HIDDEN;
extern UINT MSI_SetFeatureStates( MSIPACKAGE *package ) DECLSPEC_HIDDEN;
extern UINT msi_parse_command_line( MSIPACKAGE *package, LPCWSTR szCommandLine,
BOOL preserve_case ) DECLSPEC_HIDDEN;
extern UINT msi_parse_command_line( MSIPACKAGE *package, LPCWSTR szCommandLine, BOOL preserve_case ) DECLSPEC_HIDDEN;
extern UINT msi_schedule_action( MSIPACKAGE *package, UINT script, const WCHAR *action ) DECLSPEC_HIDDEN;
/* record internals */
extern void MSI_CloseRecord( MSIOBJECTHDR * ) DECLSPEC_HIDDEN;