winget-cli

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

UninstallFlow.h (2901B)


      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     // Uninstalls a single package. This also does the reporting, user interaction, and recording
      9     // for single-package uninstallation.
     10     // RequiredArgs: None
     11     // Inputs: Package
     12     // Outputs: None
     13     void UninstallSinglePackage(Execution::Context& context);
     14 
     15     // Uninstalls a single package version. This also does the reporting, user interaction, and recording
     16     // for single-package uninstallation.
     17     // RequiredArgs: None
     18     // Inputs: InstalledPackageVersion
     19     // Outputs: None
     20     void UninstallSinglePackageVersion(Execution::Context& context);
     21 
     22     // Uninstalls multiple packages.
     23     // RequiredArgs: None
     24     // Inputs: PackageSubContexts
     25     // Outputs: None
     26     //   SubContext Inputs: Package
     27     //   SubContext Outputs: None
     28     void UninstallMultiplePackages(Execution::Context& context);
     29 
     30     // Gets the command string or package family names used to uninstall the package.
     31     // Required Args: None
     32     // Inputs: InstalledPackageVersion
     33     // Output: UninstallString?, PackageFamilyNames?
     34     void GetUninstallInfo(Execution::Context& context);
     35 
     36     // Uninstalls the package according to its type.
     37     // Required Args: None
     38     // Inputs: InstalledPackageVersion, UninstallString?, PackageFamilyNames?
     39     // Output: None
     40     void ExecuteUninstaller(Execution::Context& context);
     41 
     42     // Removes the MSIX.
     43     // Required Args: None
     44     // Inputs: PackageFamilyNames
     45     // Outputs: None
     46     void MsixUninstall(Execution::Context& context);
     47 
     48     // Records the uninstall to the tracking catalog.
     49     // Required Args: None
     50     // Inputs: Package
     51     // Outputs: None
     52     void RecordUninstall(Execution::Context& context);
     53 
     54     // Reports the return code returned by the Uninstaller.
     55     // Required Args: None
     56     // Inputs: InstalledPackageVersion
     57     // Outputs: None
     58     struct ReportUninstallerResult : public WorkflowTask
     59     {
     60         ReportUninstallerResult(std::string_view uninstallerType, HRESULT hr, bool isHResult = false) :
     61             WorkflowTask("ReportUninstallerResult"),
     62             m_uninstallerType(uninstallerType),
     63             m_hr(hr),
     64             m_isHResult(isHResult) {}
     65 
     66         void operator()(Execution::Context& context) const override;
     67 
     68     private:
     69         // Uninstaller type used when reporting failures.
     70         std::string_view m_uninstallerType;
     71         // Result to return if the Uninstaller failed.
     72         HRESULT m_hr;
     73         // Whether the Uninstaller result is an HRESULT. This guides how we show it.
     74         bool m_isHResult;
     75     };
     76 
     77     // Verifies that the uninstall operation is supported.
     78     // Required Args: None
     79     // Inputs: InstalledPackageVersion
     80     // Outputs: None
     81     void EnsureSupportForUninstall(Execution::Context& context);
     82 }