ShellExecuteInstallerHandler.h (2913B)
1 // Copyright (c) Microsoft Corporation. 2 // Licensed under the MIT License. 3 #pragma once 4 #include <AppInstallerProgress.h> 5 #include "ExecutionContext.h" 6 7 #include <filesystem> 8 #include <optional> 9 10 // ShellExecuteInstallerHandler handles installers run through ShellExecute. 11 // Exe, Wix, Nullsoft, Msi and Inno should be handled by this installer handler. 12 namespace AppInstaller::CLI::Workflow 13 { 14 // Install is done through invoking ShellExecute on downloaded installer. 15 // Required Args: None 16 // Inputs: Manifest?, InstallerPath, InstallerArgs 17 // Outputs: OperationReturnCode 18 void ShellExecuteInstallImpl(Execution::Context& context); 19 20 // Uninstall is done through invoking ShellExecute on uninstall string. 21 // Required Args: None 22 // Inputs: UninstallString 23 // Outputs: OperationReturnCode 24 void ShellExecuteUninstallImpl(Execution::Context& context); 25 26 // Removes the MSI 27 // Required Args: None 28 // Inputs: ProductCodes 29 // Output: None 30 void ShellExecuteMsiExecUninstall(Execution::Context& context); 31 32 // Gets the installer args from the context. 33 // Required Args: None 34 // Inputs: Manifest?, Installer, InstallerPath 35 // Outputs: InstallerArgs 36 void GetInstallerArgs(Execution::Context& context); 37 38 // Repair is done through invoking ShellExecute on downloaded installer. 39 // Required Args: None 40 // Inputs: Manifest?, InstallerPath, InstallerArgs 41 // Outputs: OperationReturnCode 42 void ShellExecuteRepairImpl(Execution::Context& context); 43 44 // Repair the MSI 45 // Required Args: None 46 // Inputs: ProductCodes 47 // Output: None 48 void ShellExecuteMsiExecRepair(Execution::Context& context); 49 50 // Enables the Windows Feature dependency by invoking ShellExecute on the DISM executable. 51 // Required Args: None 52 // Inputs: Windows Feature dependency 53 // Outputs: None 54 struct ShellExecuteEnableWindowsFeature : public WorkflowTask 55 { 56 ShellExecuteEnableWindowsFeature(std::string_view featureName) : WorkflowTask("ShellExecuteEnableWindowsFeature"), m_featureName(featureName) {} 57 58 void operator()(Execution::Context& context) const override; 59 60 private: 61 std::string_view m_featureName; 62 }; 63 64 // Extracts the installer archive using the tar executable. 65 // Required Args: None 66 // Inputs: InstallerPath 67 // Outputs: None 68 struct ShellExecuteExtractArchive : public WorkflowTask 69 { 70 ShellExecuteExtractArchive(const std::filesystem::path& archivePath, const std::filesystem::path& destPath) : WorkflowTask("ShellExecuteExtractArchive"), m_archivePath(archivePath), m_destPath(destPath) {} 71 72 void operator()(Execution::Context& context) const override; 73 74 private: 75 std::filesystem::path m_archivePath; 76 std::filesystem::path m_destPath; 77 }; 78 }