From 8ebde131206f1502cbff2055941ffe52e2802439 Mon Sep 17 00:00:00 2001 From: Charles Baker Date: Thu, 24 Oct 2024 13:13:26 +1300 Subject: Add bal:DisplayFilesInUseDialogCondition to disable Files In Use dialog Disabling display skips showing the "Files In Use" dialog and returning a result as if the user had chosen to ignore the dialog and reboot in the case of files that were unable to be replaced. --- .../stdbas/WixStandardBootstrapperApplication.cpp | 52 +++++++++++++++------- 1 file changed, 35 insertions(+), 17 deletions(-) (limited to 'src/ext/Bal/stdbas/WixStandardBootstrapperApplication.cpp') diff --git a/src/ext/Bal/stdbas/WixStandardBootstrapperApplication.cpp b/src/ext/Bal/stdbas/WixStandardBootstrapperApplication.cpp index 6cfe0b4c..ddb2d1c5 100644 --- a/src/ext/Bal/stdbas/WixStandardBootstrapperApplication.cpp +++ b/src/ext/Bal/stdbas/WixStandardBootstrapperApplication.cpp @@ -1231,34 +1231,52 @@ public: // IBootstrapperApplication __inout int* pResult ) { + HRESULT hr = S_OK; + BAL_INFO_PACKAGE* pPackage = NULL; + BOOL fShowFilesInUseDialog = TRUE; if (!m_fShowingInternalUiThisPackage && wzPackageId && *wzPackageId) { BalLog(BOOTSTRAPPER_LOG_LEVEL_VERBOSE, "Package %ls has %d applications holding files in use.", wzPackageId, cFiles); - switch (source) + hr = BalInfoFindPackageById(&m_Bundle.packages, wzPackageId, &pPackage); + if (SUCCEEDED(hr) && pPackage->sczDisplayFilesInUseDialogCondition) { - case BOOTSTRAPPER_FILES_IN_USE_TYPE_MSI: - if (m_fShowStandardFilesInUse) - { - return ShowMsiFilesInUse(cFiles, rgwzFiles, source, pResult); - } - break; - case BOOTSTRAPPER_FILES_IN_USE_TYPE_MSI_RM: - if (m_fShowRMFilesInUse) - { - return ShowMsiFilesInUse(cFiles, rgwzFiles, source, pResult); - } - break; - case BOOTSTRAPPER_FILES_IN_USE_TYPE_NETFX: - if (m_fShowNetfxFilesInUse) + hr = BalEvaluateCondition(pPackage->sczDisplayFilesInUseDialogCondition, &fShowFilesInUseDialog); + BalExitOnFailure(hr, "Failed to evaluate condition for package '%ls': %ls", wzPackageId, pPackage->sczDisplayFilesInUseDialogCondition); + } + + if (fShowFilesInUseDialog) + { + switch (source) { - return ShowNetfxFilesInUse(cFiles, rgwzFiles, pResult); + case BOOTSTRAPPER_FILES_IN_USE_TYPE_MSI: + if (m_fShowStandardFilesInUse) + { + return ShowMsiFilesInUse(cFiles, rgwzFiles, source, pResult); + } + break; + case BOOTSTRAPPER_FILES_IN_USE_TYPE_MSI_RM: + if (m_fShowRMFilesInUse) + { + return ShowMsiFilesInUse(cFiles, rgwzFiles, source, pResult); + } + break; + case BOOTSTRAPPER_FILES_IN_USE_TYPE_NETFX: + if (m_fShowNetfxFilesInUse) + { + return ShowNetfxFilesInUse(cFiles, rgwzFiles, pResult); + } + break; } - break; + } + else + { + *pResult = IDIGNORE; } } + LExit: return __super::OnExecuteFilesInUse(wzPackageId, cFiles, rgwzFiles, nRecommendation, source, pResult); } -- cgit v1.2.3-55-g6feb