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 ); return msi_unimplemented_action_stub( package, "InstallSFPCatalogFile", table );
} }
typedef UINT (*STANDARDACTIONHANDLER)(MSIPACKAGE*);
static const struct static const struct
{ {
const WCHAR *action; const WCHAR *action;
UINT (*handler)(MSIPACKAGE *); UINT (*handler)(MSIPACKAGE *);
const WCHAR *action_rollback;
} }
StandardActions[] = StandardActions[] =
{ {
{ szAllocateRegistrySpace, ACTION_AllocateRegistrySpace }, { szAllocateRegistrySpace, ACTION_AllocateRegistrySpace, NULL },
{ szAppSearch, ACTION_AppSearch }, { szAppSearch, ACTION_AppSearch, NULL },
{ szBindImage, ACTION_BindImage }, { szBindImage, ACTION_BindImage, NULL },
{ szCCPSearch, ACTION_CCPSearch }, { szCCPSearch, ACTION_CCPSearch, NULL },
{ szCostFinalize, ACTION_CostFinalize }, { szCostFinalize, ACTION_CostFinalize, NULL },
{ szCostInitialize, ACTION_CostInitialize }, { szCostInitialize, ACTION_CostInitialize, NULL },
{ szCreateFolders, ACTION_CreateFolders }, { szCreateFolders, ACTION_CreateFolders, szRemoveFolders },
{ szCreateShortcuts, ACTION_CreateShortcuts }, { szCreateShortcuts, ACTION_CreateShortcuts, szRemoveShortcuts },
{ szDeleteServices, ACTION_DeleteServices }, { szDeleteServices, ACTION_DeleteServices, NULL },
{ szDisableRollback, ACTION_DisableRollback }, { szDisableRollback, ACTION_DisableRollback, NULL },
{ szDuplicateFiles, ACTION_DuplicateFiles }, { szDuplicateFiles, ACTION_DuplicateFiles, szRemoveDuplicateFiles },
{ szExecuteAction, ACTION_ExecuteAction }, { szExecuteAction, ACTION_ExecuteAction, NULL },
{ szFileCost, ACTION_FileCost }, { szFileCost, ACTION_FileCost, NULL },
{ szFindRelatedProducts, ACTION_FindRelatedProducts }, { szFindRelatedProducts, ACTION_FindRelatedProducts, NULL },
{ szForceReboot, ACTION_ForceReboot }, { szForceReboot, ACTION_ForceReboot, NULL },
{ szInstallAdminPackage, ACTION_InstallAdminPackage }, { szInstallAdminPackage, ACTION_InstallAdminPackage, NULL },
{ szInstallExecute, ACTION_InstallExecute }, { szInstallExecute, ACTION_InstallExecute, NULL },
{ szInstallExecuteAgain, ACTION_InstallExecute }, { szInstallExecuteAgain, ACTION_InstallExecute, NULL },
{ szInstallFiles, ACTION_InstallFiles}, { szInstallFiles, ACTION_InstallFiles, NULL },
{ szInstallFinalize, ACTION_InstallFinalize }, { szInstallFinalize, ACTION_InstallFinalize, NULL },
{ szInstallInitialize, ACTION_InstallInitialize }, { szInstallInitialize, ACTION_InstallInitialize, NULL },
{ szInstallSFPCatalogFile, ACTION_InstallSFPCatalogFile }, { szInstallSFPCatalogFile, ACTION_InstallSFPCatalogFile, NULL },
{ szInstallValidate, ACTION_InstallValidate }, { szInstallValidate, ACTION_InstallValidate, NULL },
{ szIsolateComponents, ACTION_IsolateComponents }, { szIsolateComponents, ACTION_IsolateComponents, NULL },
{ szLaunchConditions, ACTION_LaunchConditions }, { szLaunchConditions, ACTION_LaunchConditions, NULL },
{ szMigrateFeatureStates, ACTION_MigrateFeatureStates }, { szMigrateFeatureStates, ACTION_MigrateFeatureStates, NULL },
{ szMoveFiles, ACTION_MoveFiles }, { szMoveFiles, ACTION_MoveFiles, NULL },
{ szMsiPublishAssemblies, ACTION_MsiPublishAssemblies }, { szMsiPublishAssemblies, ACTION_MsiPublishAssemblies, szMsiUnpublishAssemblies },
{ szMsiUnpublishAssemblies, ACTION_MsiUnpublishAssemblies }, { szMsiUnpublishAssemblies, ACTION_MsiUnpublishAssemblies, NULL },
{ szInstallODBC, ACTION_InstallODBC }, { szInstallODBC, ACTION_InstallODBC, szRemoveODBC },
{ szInstallServices, ACTION_InstallServices }, { szInstallServices, ACTION_InstallServices, szDeleteServices },
{ szPatchFiles, ACTION_PatchFiles }, { szPatchFiles, ACTION_PatchFiles, NULL },
{ szProcessComponents, ACTION_ProcessComponents }, { szProcessComponents, ACTION_ProcessComponents, NULL },
{ szPublishComponents, ACTION_PublishComponents }, { szPublishComponents, ACTION_PublishComponents, szUnpublishComponents },
{ szPublishFeatures, ACTION_PublishFeatures }, { szPublishFeatures, ACTION_PublishFeatures, szUnpublishFeatures },
{ szPublishProduct, ACTION_PublishProduct }, { szPublishProduct, ACTION_PublishProduct, NULL },
{ szRegisterClassInfo, ACTION_RegisterClassInfo }, { szRegisterClassInfo, ACTION_RegisterClassInfo, szUnregisterClassInfo },
{ szRegisterComPlus, ACTION_RegisterComPlus}, { szRegisterComPlus, ACTION_RegisterComPlus, szUnregisterComPlus },
{ szRegisterExtensionInfo, ACTION_RegisterExtensionInfo }, { szRegisterExtensionInfo, ACTION_RegisterExtensionInfo, szUnregisterExtensionInfo },
{ szRegisterFonts, ACTION_RegisterFonts }, { szRegisterFonts, ACTION_RegisterFonts, szUnregisterFonts },
{ szRegisterMIMEInfo, ACTION_RegisterMIMEInfo }, { szRegisterMIMEInfo, ACTION_RegisterMIMEInfo, szUnregisterMIMEInfo },
{ szRegisterProduct, ACTION_RegisterProduct }, { szRegisterProduct, ACTION_RegisterProduct, NULL },
{ szRegisterProgIdInfo, ACTION_RegisterProgIdInfo }, { szRegisterProgIdInfo, ACTION_RegisterProgIdInfo, szUnregisterProgIdInfo },
{ szRegisterTypeLibraries, ACTION_RegisterTypeLibraries }, { szRegisterTypeLibraries, ACTION_RegisterTypeLibraries, szUnregisterTypeLibraries },
{ szRegisterUser, ACTION_RegisterUser }, { szRegisterUser, ACTION_RegisterUser, NULL },
{ szRemoveDuplicateFiles, ACTION_RemoveDuplicateFiles }, { szRemoveDuplicateFiles, ACTION_RemoveDuplicateFiles, NULL },
{ szRemoveEnvironmentStrings, ACTION_RemoveEnvironmentStrings }, { szRemoveEnvironmentStrings, ACTION_RemoveEnvironmentStrings, NULL },
{ szRemoveExistingProducts, ACTION_RemoveExistingProducts }, { szRemoveExistingProducts, ACTION_RemoveExistingProducts, NULL },
{ szRemoveFiles, ACTION_RemoveFiles }, { szRemoveFiles, ACTION_RemoveFiles, NULL },
{ szRemoveFolders, ACTION_RemoveFolders }, { szRemoveFolders, ACTION_RemoveFolders, NULL },
{ szRemoveIniValues, ACTION_RemoveIniValues }, { szRemoveIniValues, ACTION_RemoveIniValues, NULL },
{ szRemoveODBC, ACTION_RemoveODBC }, { szRemoveODBC, ACTION_RemoveODBC, NULL },
{ szRemoveRegistryValues, ACTION_RemoveRegistryValues }, { szRemoveRegistryValues, ACTION_RemoveRegistryValues, NULL },
{ szRemoveShortcuts, ACTION_RemoveShortcuts }, { szRemoveShortcuts, ACTION_RemoveShortcuts, NULL },
{ szResolveSource, ACTION_ResolveSource }, { szResolveSource, ACTION_ResolveSource, NULL },
{ szRMCCPSearch, ACTION_RMCCPSearch }, { szRMCCPSearch, ACTION_RMCCPSearch, NULL },
{ szScheduleReboot, ACTION_ScheduleReboot }, { szScheduleReboot, ACTION_ScheduleReboot, NULL },
{ szSelfRegModules, ACTION_SelfRegModules }, { szSelfRegModules, ACTION_SelfRegModules, szSelfUnregModules },
{ szSelfUnregModules, ACTION_SelfUnregModules }, { szSelfUnregModules, ACTION_SelfUnregModules, NULL },
{ szSetODBCFolders, ACTION_SetODBCFolders }, { szSetODBCFolders, ACTION_SetODBCFolders, NULL },
{ szStartServices, ACTION_StartServices }, { szStartServices, ACTION_StartServices, szStopServices },
{ szStopServices, ACTION_StopServices }, { szStopServices, ACTION_StopServices, NULL },
{ szUnpublishComponents, ACTION_UnpublishComponents }, { szUnpublishComponents, ACTION_UnpublishComponents, NULL },
{ szUnpublishFeatures, ACTION_UnpublishFeatures }, { szUnpublishFeatures, ACTION_UnpublishFeatures, NULL },
{ szUnregisterClassInfo, ACTION_UnregisterClassInfo }, { szUnregisterClassInfo, ACTION_UnregisterClassInfo, NULL },
{ szUnregisterComPlus, ACTION_UnregisterComPlus }, { szUnregisterComPlus, ACTION_UnregisterComPlus, NULL },
{ szUnregisterExtensionInfo, ACTION_UnregisterExtensionInfo }, { szUnregisterExtensionInfo, ACTION_UnregisterExtensionInfo, NULL },
{ szUnregisterFonts, ACTION_UnregisterFonts }, { szUnregisterFonts, ACTION_UnregisterFonts, NULL },
{ szUnregisterMIMEInfo, ACTION_UnregisterMIMEInfo }, { szUnregisterMIMEInfo, ACTION_UnregisterMIMEInfo, NULL },
{ szUnregisterProgIdInfo, ACTION_UnregisterProgIdInfo }, { szUnregisterProgIdInfo, ACTION_UnregisterProgIdInfo, NULL },
{ szUnregisterTypeLibraries, ACTION_UnregisterTypeLibraries }, { szUnregisterTypeLibraries, ACTION_UnregisterTypeLibraries, NULL },
{ szValidateProductID, ACTION_ValidateProductID }, { szValidateProductID, ACTION_ValidateProductID, NULL },
{ szWriteEnvironmentStrings, ACTION_WriteEnvironmentStrings }, { szWriteEnvironmentStrings, ACTION_WriteEnvironmentStrings, szRemoveEnvironmentStrings },
{ szWriteIniValues, ACTION_WriteIniValues }, { szWriteIniValues, ACTION_WriteIniValues, szRemoveIniValues },
{ szWriteRegistryValues, ACTION_WriteRegistryValues }, { szWriteRegistryValues, ACTION_WriteRegistryValues, szRemoveRegistryValues },
{ NULL, NULL }, { NULL, NULL, NULL }
}; };
static BOOL ACTION_HandleStandardAction( MSIPACKAGE *package, LPCWSTR action, UINT *rc ) 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 ); ui_actioninfo( package, action, TRUE, 0 );
*rc = StandardActions[i].handler( package ); *rc = StandardActions[i].handler( package );
ui_actioninfo( package, action, FALSE, *rc ); 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 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 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; UINT count;
WCHAR **newbuf = NULL; WCHAR **newbuf = NULL;
@ -286,17 +286,17 @@ UINT ACTION_CustomAction(MSIPACKAGE *package, LPCWSTR action, UINT script, BOOL
if (type & msidbCustomActionTypeCommit) if (type & msidbCustomActionTypeCommit)
{ {
TRACE("Deferring commit action\n"); TRACE("Deferring commit action\n");
schedule_action(package, COMMIT_SCRIPT, deferred); msi_schedule_action(package, COMMIT_SCRIPT, deferred);
} }
else if (type & msidbCustomActionTypeRollback) else if (type & msidbCustomActionTypeRollback)
{ {
FIXME("Deferring rollback only action\n"); TRACE("Deferring rollback action\n");
schedule_action(package, ROLLBACK_SCRIPT, deferred); msi_schedule_action(package, ROLLBACK_SCRIPT, deferred);
} }
else else
{ {
TRACE("Deferring action\n"); TRACE("Deferring action\n");
schedule_action(package, INSTALL_SCRIPT, deferred); msi_schedule_action(package, INSTALL_SCRIPT, deferred);
} }
rc = ERROR_SUCCESS; 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 ACTION_ForceReboot(MSIPACKAGE *package) DECLSPEC_HIDDEN;
extern UINT MSI_Sequence( MSIPACKAGE *package, LPCWSTR szTable, INT iSequenceMode ) 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_SetFeatureStates( MSIPACKAGE *package ) DECLSPEC_HIDDEN;
extern UINT msi_parse_command_line( MSIPACKAGE *package, LPCWSTR szCommandLine, extern UINT msi_parse_command_line( MSIPACKAGE *package, LPCWSTR szCommandLine, BOOL preserve_case ) DECLSPEC_HIDDEN;
BOOL preserve_case ) DECLSPEC_HIDDEN; extern UINT msi_schedule_action( MSIPACKAGE *package, UINT script, const WCHAR *action ) DECLSPEC_HIDDEN;
/* record internals */ /* record internals */
extern void MSI_CloseRecord( MSIOBJECTHDR * ) DECLSPEC_HIDDEN; extern void MSI_CloseRecord( MSIOBJECTHDR * ) DECLSPEC_HIDDEN;