RepairFlow.h (3227B)
1 // Copyright (c) Microsoft Corporation. 2 // Licensed under the MIT License. 3 #pragma once 4 #include "ExecutionContext.h" 5 6 namespace AppInstaller::CLI::Workflow 7 { 8 // Execute the repair operation for RepairBehavior based installers. 9 // RequiredArgs:None 10 // Inputs: RepairBehavior, RepairString 11 // Outputs:None 12 void RunRepairForRepairBehaviorBasedInstaller(Execution::Context& context); 13 14 // Execute the repair operation for MSI based installers. 15 // RequiredArgs:None 16 // Inputs: ProductCodes 17 // Outputs:None 18 void RepairMsiBasedInstaller(Execution::Context& context); 19 20 // Applicability check for repair operation. 21 // RequiredArgs:None 22 // Inputs:InstalledPackageVersion, NoModify ?, NoRepair ? 23 // Outputs:None 24 void RepairApplicabilityCheck(Execution::Context& context); 25 26 // Execute the repair operation. 27 // RequiredArgs:None 28 // Inputs: InstallerType, RepairBehavior ?, RepairString? , ProductCodes?, PackageFamilyNames? 29 // Outputs:None 30 void ExecuteRepair(Execution::Context& context); 31 32 // Obtains the necessary information for repair operation. 33 // RequiredArgs:None 34 // Inputs:InstallerType 35 // Outputs:RepairString?, ProductCodes?, PackageFamilyNames? 36 void GetRepairInfo(Execution::Context& context); 37 38 // Perform the repair operation for the MSIX NonStore package. 39 // RequiredArgs:None 40 // Inputs:PackageFamilyNames , InstallScope? 41 // Outputs:None 42 void RepairMsixPackage(Execution::Context& context); 43 44 // Select the applicable package version by matching the installed package version with the available package version. 45 // RequiredArgs:None 46 // Inputs: Package,InstalledPackageVersion, AvailablePackageVersions 47 // Outputs:Manifest, PackageVersion, Installer 48 void SelectApplicablePackageVersion(Execution::Context& context); 49 50 /// <summary> 51 /// Select the applicable installer for the installed package if necessary. 52 // RequiredArgs:None 53 // Inputs: Package,InstalledPackageVersion, AvailablePackageVersions 54 // Outputs:Manifest, PackageVersion, Installer 55 void SelectApplicableInstallerIfNecessary(Execution::Context& context); 56 57 // Perform the repair operation for the single package. 58 // RequiredArgs:None 59 // Inputs: SearchResult, InstalledPackage, ApplicableInstaller 60 // Outputs:None 61 void RepairSinglePackage(Execution::Context& context); 62 63 // Reports the result of the repair. 64 // Required Args: None 65 // Inputs: None 66 // Outputs: None 67 struct ReportRepairResult : public WorkflowTask 68 { 69 ReportRepairResult(std::string_view repairType, HRESULT hr, bool isHResult = false) : 70 WorkflowTask("ReportRepairResult"), 71 m_repairType(repairType), 72 m_hr(hr), 73 m_isHResult(isHResult) {} 74 75 void operator()(Execution::Context& context) const override; 76 77 private: 78 // Repair type used for reporting failure. 79 std::string_view m_repairType; 80 // Result to return if the repair fails. 81 HRESULT m_hr; 82 // Whether the result is an HRESULT. 83 bool m_isHResult; 84 }; 85 }