Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WinGet COM API for Repair #4736

Commits on Aug 7, 2024

  1. Add Skeleton Implementation for Repair COM APIs Invocable from E2E Tests

    This commit includes:
    1. Necessary additions and updates to PackageManager.idl to define repair-specific COM API contracts and runtime class declarations.
    2. Implementation of repair-specific runtime class and PackageManager runtime class repair contract methods skeleton.
    3. GUID mapping for In-proc and Out-of-proc COM API class definitions.
    4. Updates to `Package.appxmanifest` and `Microsoft.Management.Deployment.InProc.dll.manifest` to include new COM class entries for `RepairOptions`.
    5. Updates to `ComClsids.cpp` and `ComClsids.h` to include CLSID definitions and redirection logic for `RepairOptions`.
    6. Modifications to `ClassesDefinition.cs` and `WinGetProjectionFactory.cs` to define and create instances of `RepairOptions`and repair com api support for C# winrt projection interop library.
    Madhusudhan-MSFT committed Aug 7, 2024
    Configuration menu
    Copy the full SHA
    2ee3cd6 View commit details
    Browse the repository at this point in the history
  2. Implement Sample Interop Test for Winget Repair COM API

    This commit includes:
    - A sample interop test to invoke the Winget repair out-of-proc COM API.
    - Validation to ensure the COM API endpoint is invocable.
    Madhusudhan-MSFT committed Aug 7, 2024
    Configuration menu
    Copy the full SHA
    24bd7a0 View commit details
    Browse the repository at this point in the history

Commits on Aug 15, 2024

  1. [Updates to PackageManager.idl :] Add DownloadError status and rename…

    … InstallerErrorCode
    
    - Updated `RepairResultStatus` enum to include `DownloadError`.
    - Renamed `InstallerErrorCode` to `RepairErrorCode` in `RepairResult`.
    - Added  inline comments for `LogOutputPath` property for directing log output.
    - Updated `RepairResult.cpp` and `RepairResult.h` for renaming.
    Madhusudhan-MSFT committed Aug 15, 2024
    Configuration menu
    Copy the full SHA
    c9b38a4 View commit details
    Browse the repository at this point in the history
  2. Added integration logic for Repair COM APIs:

    - Integrated Repair COM APIs with workflow.
    - Added `COMRepairCommand` class.
    - Updated `ContextOrchestrator` with `CreateItemForRepair`.
    - Added `GetManifestRepairScope` in `Converters`.
    - Enhanced `PackageManager` with repair functions and async methods.
    Madhusudhan-MSFT committed Aug 15, 2024
    Configuration menu
    Copy the full SHA
    b208c30 View commit details
    Browse the repository at this point in the history
  3. Added E2E tests for Winget COM Repair API:

    - Introduced RepairInterop.cs for InProc & Out of Proc COM Repair APIs.
    - Extended GroupPolicyForInterop.cs to cover COM Repair API scenarios.
    Madhusudhan-MSFT committed Aug 15, 2024
    Configuration menu
    Copy the full SHA
    79a4220 View commit details
    Browse the repository at this point in the history
  4. Fix test failure in RepairCommand for NonstoreMSIX machine scope repair

    Adjusted test assertion in RepairCommand.cs to check for the more general string "Microsoft.Paint" instead of "Microsoft.Paint_8wekyb3d8bbwe". This change ensures compatibility with version-specific output variations.
    Madhusudhan-MSFT committed Aug 15, 2024
    Configuration menu
    Copy the full SHA
    1ab97db View commit details
    Browse the repository at this point in the history

Commits on Aug 16, 2024

  1. Fix for RepairNonStoreMsixPackageWithMachineScope test failure

    - Changed `PackageMatchField` from `Name` to `Id`.
    - Updated search value from `"Paint"` to `"Microsoft.Paint_8wekyb3d8bbwe"` to ensure accurate package identification.
    Madhusudhan-MSFT committed Aug 16, 2024
    Configuration menu
    Copy the full SHA
    fa8c6d5 View commit details
    Browse the repository at this point in the history
  2. Test failure fix for: RepairNonStoreMsixPackageWithMachineScope

    These changes ensure the test only proceeds if a package is found, preventing false failures and improving test accuracy.
    Madhusudhan-MSFT committed Aug 16, 2024
    Configuration menu
    Copy the full SHA
    0e43224 View commit details
    Browse the repository at this point in the history
  3. Fix OOP COM Repair Test Failures

    The following tests failed in the Azure pipeline due to ERROR_ADMIN_CONTEXT_REPAIR_PROHIBITED (0x8A15007D):
    - DisableWinGetCommandLineInterfacesPolicy
    - RepairBurnInstallerWithModifyBehavior
    - RepairExeInstallerWithUninstallerBehavior
    - RepairNullsoftInstallerWithUninstallerBehavior
    
    The problem is due to the OOP COM Server running as admin in the pipeline, which is not the case for local test runs. This discrepancy may indicate different test configurations in the pipeline. This prevents the repair of user-scope installed packages. The solution is to install the test package to system scope, similar to In-Proc tests.
    
    -  Made minor optimizations to the replacement arguments string building logic.
    Madhusudhan-MSFT committed Aug 16, 2024
    Configuration menu
    Copy the full SHA
    7d112a4 View commit details
    Browse the repository at this point in the history

Commits on Aug 19, 2024

  1. Remove DownloadDirectory parameter and related logic

    The DownloadDirectory parameter and its associated logic have been
    removed from WinGet COM Repair logic.
    
    This includes:
    - Removal of the DownloadDirectory from the interface definition in
      PackageManager.idl.
    - Removal of the code that adds the DownloadDirectory argument to
      the context in PackageManager.cpp.
    - Removal of the getter and setter methods in RepairOptions.cpp.
    - Removal of the m_downloadPath member variable in RepairOptions.h.
    Madhusudhan-MSFT committed Aug 19, 2024
    Configuration menu
    Copy the full SHA
    b34ad4b View commit details
    Browse the repository at this point in the history

Commits on Aug 20, 2024

  1. Merge branch 'master' of https://github.com/Madhusudhan-MSFT/winget-cli

    … into user/masudars/WinGet_Repair_COMAPI
    Madhusudhan-MSFT committed Aug 20, 2024
    Configuration menu
    Copy the full SHA
    e6d2830 View commit details
    Browse the repository at this point in the history
  2. Add CLSID for RepairOptions in Microsoft.Management.Deployment.OutOfP…

    …roc Factory.cpp
    
    Introduce a new CLSID for RepairOptions in the Microsoft::Management::Deployment::OutOfProc namespace. Update the s_nameCLSIDPairs array to include the new NameCLSIDPair for RepairOptions, increasing the array size from 8 to 9. This change enables the system to recognize and work with RepairOptions similarly to other components.
    Madhusudhan-MSFT committed Aug 20, 2024
    Configuration menu
    Copy the full SHA
    01beb24 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    97d48e8 View commit details
    Browse the repository at this point in the history

Commits on Aug 23, 2024

  1. Add Repair-WinGetPackage powershell cmdlet to Microsoft.WinGet.Client

    Introduced a new cmdlet `Repair-WinGetPackage` to the Microsoft.WinGet.Client PowerShell module. This cmdlet allows users to repair packages with different modes (Default, Silent, Interactive) and provides detailed results of the repair operation.
    
    Key changes:
    - Added new classes and methods to support the repair functionality.
    - Updated `Format.ps1xml` to include a new view definition for `PSRepairResult`.
    - Added new localized strings for repair operations.
    - Updated `README.md` and added a sample script `Sample_RepairPackage.ps1`.
    - Included `Repair-WinGetPackage` in the list of exported cmdlets in `Microsoft.WinGet.Client.psd1`.
    Madhusudhan-MSFT committed Aug 23, 2024
    Configuration menu
    Copy the full SHA
    ec3822f View commit details
    Browse the repository at this point in the history
  2. Fix parameter name in RepairPackageCommand constructor to address Spe…

    …llCheck error
    
    Renamed the parameter `pSCatalogPackage` to `psCatalogPackage` in the
    `RepairPackageCommand` constructor and updated all references to
    ensure consistency and improve readability with camelCase naming.
    Madhusudhan-MSFT committed Aug 23, 2024
    Configuration menu
    Copy the full SHA
    752766b View commit details
    Browse the repository at this point in the history

Commits on Aug 24, 2024

  1. Fix Format.ps1xml formatting issue.

    Reformatted XML structure in Format.ps1xml file to resolve 'Node TableRowEntries is missing' error. Adjusted the <TableRowEntries> and its nested elements accordingly.
    Madhusudhan-MSFT committed Aug 24, 2024
    Configuration menu
    Copy the full SHA
    ffc4f8f View commit details
    Browse the repository at this point in the history
  2. Add test case for Repair-WinGetPackage cmdlet

    - Introduced `Install|Repair|Uninstall-WinGetPackage` test suite in `Microsoft.WinGet.Client.Tests.ps1` to cover installation, repair, and uninstallation of MSIX, Burn Installer, and Exe Installer packages.
    - Each test verifies expected results, including non-null results, correct package Ids, names, sources, error codes, statuses, and reboot requirements.
    - `BeforeAll` block adds a test source, and `AfterAll` block ensures cleanup by uninstalling test packages.
    Madhusudhan-MSFT committed Aug 24, 2024
    Configuration menu
    Copy the full SHA
    673e930 View commit details
    Browse the repository at this point in the history
  3. Refactor and optimize Repair-WinGetPackage tests

    - Added `Validate-WinGetResultCommonFields` and `Validate-WinGetPackageOperationResult` functions in `Microsoft.WinGet.Client.Tests.ps1` to validate common fields and specific operation results for WinGet package operations.
    - Refactor install, repair, and uninstall test cases to use these functions, removing individual validation steps and adding contexts for better organization.
    - Simplify test logic by creating an expected result object and passing it to the validation function.
    Madhusudhan-MSFT committed Aug 24, 2024
    Configuration menu
    Copy the full SHA
    dc7b1aa View commit details
    Browse the repository at this point in the history
  4. Fixed repair scenario test failures

    - Addressed repair scenario test failures by adding InstallerErrorCode, RepairErrorCode, and UninstallerErrorCode properties with a default value of 0 to the test cases expectedResult object
    - Removed unnecessary error code assignment
    
    This fix resolves the runtime exceptions:
    1. The property 'InstallerErrorCode' cannot be found on this object,
    2. The property 'RepairErrorCode' cannot be found on this object, and
    3. The property 'UninstallerErrorCode' cannot be found on this object'.
    Madhusudhan-MSFT committed Aug 24, 2024
    Configuration menu
    Copy the full SHA
    db2bc39 View commit details
    Browse the repository at this point in the history

Commits on Aug 25, 2024

  1. Add BeforeEach blocks to initialize $expectedResult in tests, fixing …

    …the variable initialization issue that results in test failures
    Madhusudhan-MSFT committed Aug 25, 2024
    Configuration menu
    Copy the full SHA
    e8e3013 View commit details
    Browse the repository at this point in the history
  2. Refactored test cases for Install|Update|Uninstall-WinGetPackage cmdl…

    …ets:
    
    - Added BeforeEach block to define expected result objects.
    - Replaced inline assertions with Validate-WinGetPackageOperationResult.
    - Centralized validation logic to improve readability and maintainability.
    Madhusudhan-MSFT committed Aug 25, 2024
    Configuration menu
    Copy the full SHA
    4f68812 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    dce2094 View commit details
    Browse the repository at this point in the history

Commits on Aug 27, 2024

  1. Configuration menu
    Copy the full SHA
    995bd58 View commit details
    Browse the repository at this point in the history
  2. Refactor namespace for PSPackageRepairMode enum

    Changed the namespace for the `PSPackageRepairMode` enum from `Microsoft.WinGet.Client.Cmdlets.Cmdlets.PSObjects` to `Microsoft.WinGet.Client.PSObjects`. Updated `RepairPackageCmdlet.cs` to reflect this change, ensuring correct references.
    Madhusudhan-MSFT committed Aug 27, 2024
    Configuration menu
    Copy the full SHA
    442a7a5 View commit details
    Browse the repository at this point in the history
  3. Add Repair-WinGetPackage cmdlet documentation

    Updated `Microsoft.WinGet.Client.md` to include the new `Repair-WinGetPackage` cmdlet. Created `Repair-WinGetPackage.md` to document the cmdlet, including synopsis, syntax, detailed description, examples, parameter descriptions, common parameters, input/output types, and related links.
    Madhusudhan-MSFT committed Aug 27, 2024
    Configuration menu
    Copy the full SHA
    828284f View commit details
    Browse the repository at this point in the history
  4. Fix typo in -Confirm parameter type in Repair-WinGetPackage.md & Spel…

    …l check error fix.
    
    Corrected the type definition of the -Confirm parameter from
    'SSystem.Management.Automation.witchParameter' to
    'System.Management.Automation.SwitchParameter' in the
    Repair-WinGetPackage.md file.
    Madhusudhan-MSFT committed Aug 27, 2024
    Configuration menu
    Copy the full SHA
    d8553a4 View commit details
    Browse the repository at this point in the history

Commits on Sep 4, 2024

  1. Add missing interfaces for RepairOptions and RepairResult collections

    Added new interfaces in the `Microsoft.Management.Deployment`
    namespace within the `PackageManager.idl` file. Added interfaces
    for handling collections of `RepairOptions` and `RepairResult`:
    - `Windows.Foundation.Collections.IVector<RepairOptions>`
    - `Windows.Foundation.Collections.IVectorView<RepairOptions>`
    - `Windows.Foundation.Collections.IVector<RepairResult>`
    - `Windows.Foundation.Collections.IVectorView<RepairResult>`
    
    These changes enhance the functionality related to repair operations
    in the package management system by allowing manipulation and viewing
    of these collections.
    Madhusudhan-MSFT committed Sep 4, 2024
    Configuration menu
    Copy the full SHA
    55efd2c View commit details
    Browse the repository at this point in the history

Commits on Sep 6, 2024

  1. Update PackageManager.idl comments and refactor powershell repair m…

    …ethods
    
    - Updated the comment in `PackageManager.idl` to clarify that `CorrelationData` is used for the repair process.
    - In `RepairPackageCommand.cs`, replaced the method call to `PackageManagerWrapper.Instance.RepairPackageAsync` with `this.RepairPackageAsync`.
    - Renamed `RepairResultAsync` to `RepairPackageAsync` for better clarity.
    Madhusudhan-MSFT committed Sep 6, 2024
    Configuration menu
    Copy the full SHA
    859cd04 View commit details
    Browse the repository at this point in the history

Commits on Sep 7, 2024

  1. Configuration menu
    Copy the full SHA
    08cb8fe View commit details
    Browse the repository at this point in the history
  2. Update contract version to 12 in PackageManager.idl

    Revised the contract version from 11 to 12 for repair-specific implementations because version 11 conflicted with the previous addition but code wasn't in sync.
    Madhusudhan-MSFT committed Sep 7, 2024
    Configuration menu
    Copy the full SHA
    84cadf0 View commit details
    Browse the repository at this point in the history

Commits on Sep 9, 2024

  1. Configuration menu
    Copy the full SHA
    f9c3ecd View commit details
    Browse the repository at this point in the history

Commits on Sep 10, 2024

  1. Configuration menu
    Copy the full SHA
    05220c8 View commit details
    Browse the repository at this point in the history

Commits on Sep 13, 2024

  1. Remove GetRepairProgress method from PackageManager

    - The GetRepairProgress method has been removed from both the implementation file (PackageManager.cpp) and the interface definition file (PackageManager.idl).
    - This method was designed to return the progress of a repair operation for a given package and catalog information to allow another client to find asynchronously. However, we currently do not have a practical use case for this functionality. If this requirement arises in the future, we will consider adding it back.
    Madhusudhan-MSFT committed Sep 13, 2024
    Configuration menu
    Copy the full SHA
    3d3b435 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    c3a2ccb View commit details
    Browse the repository at this point in the history

Commits on Sep 28, 2024

  1. Add new repair options and rename error codes (API Review Feedback)

    Updated `Converters.h` to use `NoApplicableRepairer` instead of `NoApplicableInstallers`. Added handling for `AllowHashMismatch`, `BypassIsStoreClientBlockedPolicyCheck`, and `Force` in `PackageManager.cpp` and `PackageManager.idl`.
    - Renamed `NoApplicableInstallers` to `NoApplicableRepairer` and `RepairErrorCode` to `RepairerErrorCode` in `PackageManager.idl`.
    
    Added getter and setter methods for new options in `RepairOptions.cpp` and declarations in `RepairOptions.h`. Updated `RepairResult.cpp` and `RepairResult.h` to use `repairerErrorCode`. Enhanced `RepairPackageCmdlet.cs` and `RepairPackageCommand.cs` to handle new parameters. Updated `PSRepairResult.cs` to use `RepairerErrorCode`.
    Madhusudhan-MSFT committed Sep 28, 2024
    Configuration menu
    Copy the full SHA
    e915dde View commit details
    Browse the repository at this point in the history

Commits on Oct 2, 2024

  1. Update GUID and XML docs in ManagementDeploymentFactory

    - Updated `RepairOptionsIid` GUID in `ManagementDeploymentFactory` to align with WinRT MIDL-generated interface ID for `RepairOptions` resulted from API review feedback changes in last commit.
    
    This resolves COMException: Failed to create instance: -2147467262 when PowerShell tests invoke Repair-WinGetPackage cmdlet.
    
    - Corrected XML documentation for `CreateRepairOptions` method to accurately describe it creates an instance of `RepairOptions` class instead of `PackageMatchFilter` class.
    Madhusudhan-MSFT committed Oct 2, 2024
    Configuration menu
    Copy the full SHA
    d00a2aa View commit details
    Browse the repository at this point in the history
  2. Enhance error handling for Repair-WinGetPackage command-let

    - Introduced a new exception class `WinGetRepairPackageException` in `WinGetRepairPackageException.cs` to encapsulate various error scenarios during the repair operation.
    - Updated `RepairPackageCommand.cs` to throw `WinGetRepairPackageException` when specific error conditions are met during the repair process.
    - Added new error codes in `ErrorCode.cs` to represent different repair-related errors such as `NoRepairInfoFound`, `RepairNotApplicable`, `RepairerFailure`, `RepairNotSupported`, and `AdminContextRepairProhibited`.
    - Enhanced `Resources.Designer.cs` and `Resources.resx` with new localized strings to provide user-friendly error messages for the new error codes.
    - Modified the `RepairPackageCommand.cs` to handle and throw exceptions with detailed error messages based on the new error codes and localized strings.
    Madhusudhan-MSFT committed Oct 2, 2024
    Configuration menu
    Copy the full SHA
    4f87879 View commit details
    Browse the repository at this point in the history

Commits on Oct 5, 2024

  1. PR Feedback implementation:

    - Added inline comment for `COMRepairCommand` in `COMCommand.cpp`.
    - Updated inline comments in `ContextOrchestrator.cpp` and `ContextOrchestrator.h` to reflect repair commands specific changes.
    - Introduced `ModifyRepairInstaller` constant in `Constants.cs` and refactored related files for consistency.
    - Modified `Converters.h` to map error codes for repair operations.
    - Removed an unnecessary `Natvis` include from `Microsoft.Management.Deployment.vcxproj.filters`.
    - Corrected a comment in `PackageManager.cpp` about repair requirements.
    - Enhanced `RepairPackageCommand.cs` to search both local and remote catalogs.
    - Updated resource strings in `Resources.Designer.cs` and `Resources.resx` for clarity in error messages.
    Madhusudhan-MSFT committed Oct 5, 2024
    Configuration menu
    Copy the full SHA
    309e40e View commit details
    Browse the repository at this point in the history
  2. Follow up PR feedback fixes:

    - Removed the GetRepairProgress method from the PackageManager class
    - Updated the CompositeSearchBehavior in RepairPackageCommand.cs to use AllCatalogs, broadening the scope of package searches.
    - Also, added a newline for readability in PackageManager.cpp.
    Madhusudhan-MSFT committed Oct 5, 2024
    Configuration menu
    Copy the full SHA
    c0f12f3 View commit details
    Browse the repository at this point in the history