WSLC SDK install API update#40949
Open
JohnMcPMS wants to merge 9 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the WSLC SDK install/update surface to support caller-selected component installation plus “repair” semantics (reinstall/force-update), and threads those options through the WinRT projection and Windows Update integration helpers.
Changes:
- Extends the C SDK install entry point to accept explicit component flags and install options (including repair).
- Adds a WinRT
InstallOptionsruntimeclass and updatesWslcService::InstallWithDependencies{Async}to accept options and map them to the C API. - Refactors
WindowsUpdateContextto support “ensure vs reset” product registration and updates tests/utilities accordingly.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| test/windows/WslcSdkWinRTTests.cpp | Updates WinRT install tests and adds coverage for InstallOptions defaults/mutations and error behavior. |
| test/windows/WslcSdkTests.cpp | Adds C SDK install tests for new flags/options and a GH-fallback failure scenario. |
| test/windows/WindowsUpdateTests.cpp | Updates tests for the new WindowsUpdateContext constructor and RunUpdateFlow options. |
| test/windows/Common.h | Extends UniqueWebServer with a status-code-only response mode for negative-path tests. |
| test/windows/Common.cpp | Implements UniqueWebServer status-code-only constructor using HttpListener. |
| src/windows/WslcSDK/wslcsdk.h | Introduces WslcInstallOptions and changes the C install API signature to accept components/options. |
| src/windows/WslcSDK/wslcsdk.cpp | Updates install implementation to support explicit components and repair semantics via Windows Update options. |
| src/windows/WslcSDK/winrt/WslcService.h | Changes WinRT install methods to accept InstallOptions. |
| src/windows/WslcSDK/winrt/WslcService.cpp | Maps WinRT InstallOptions to C flags/options and forwards into the updated C API. |
| src/windows/WslcSDK/winrt/wslcsdk.idl | Adds InstallOptions runtimeclass and updates the WslcService install method signatures. |
| src/windows/WslcSDK/winrt/InstallOptions.h | Adds WinRT implementation type for InstallOptions. |
| src/windows/WslcSDK/winrt/InstallOptions.cpp | Implements InstallOptions property storage. |
| src/windows/WslcSDK/winrt/CMakeLists.txt | Adds InstallOptions sources to the WinRT build. |
| src/windows/common/WindowsUpdateIntegration.h | Refactors Windows Update flow to use UpdateOptions and adds reset capability to product registration. |
| src/windows/common/WindowsUpdateIntegration.cpp | Implements reset-aware product registration and updates update-flow tracing/logic. |
| src/windows/common/helpers.hpp | Declares VersionRegisteredWithDcat() helper. |
| src/windows/common/helpers.cpp | Implements VersionRegisteredWithDcat() and uses a constant for the DCAT version value name. |
Comment on lines
+1550
to
+1561
| constexpr auto GitHubApiResponse = | ||
| LR"([{ | ||
| \"name\": \"1.0.0\", | ||
| \"created_at\": \"2023-06-14T16:56:30Z\", | ||
| \"assets\": [ | ||
| { | ||
| \"url\": \"http://127.0.0.1:12346/fake.msixbundle\", | ||
| \"id\": 1, | ||
| \"name\": \"Microsoft.WSL_1.0.0.0_x64_ARM64.msixbundle\" | ||
| } | ||
| ] | ||
| }])"; |
Comment on lines
+627
to
640
| typedef enum WslcInstallOptions | ||
| { | ||
| WSLC_INSTALL_OPTION_NONE = 0, | ||
| // Allows components to be reinstalled. | ||
| WSLC_INSTALL_OPTION_REPAIR = 1, | ||
| } WslcInstallOptions; | ||
|
|
||
| DEFINE_ENUM_FLAG_OPERATORS(WslcInstallOptions); | ||
|
|
||
| // Callbacks will only be made for components that are actively installed by this call. | ||
| // That list can be acquired prior to this call with `WslcCanRun`. | ||
| STDAPI WslcInstallWithDependencies(_In_opt_ WslcInstallCallback progressCallback, _In_opt_ PVOID context); | ||
| // The list of required components can be acquired prior to this call with `WslcGetMissingComponents`. | ||
| STDAPI WslcInstallWithDependencies( | ||
| _In_ WslcComponentFlags components, _In_ WslcInstallOptions options, _In_opt_ WslcInstallCallback progressCallback, _In_opt_ PVOID context); | ||
|
|
Comment on lines
267
to
273
| runtimeclass WslcService | ||
| { | ||
| static IVectorView<Component> GetMissingComponents(); | ||
| static ServiceVersion GetVersion(); | ||
| static void InstallWithDependencies(); | ||
| static Windows.Foundation.IAsyncActionWithProgress<InstallProgress> InstallWithDependenciesAsync(); | ||
| static void InstallWithDependencies(InstallOptions options); | ||
| static Windows.Foundation.IAsyncActionWithProgress<InstallProgress> InstallWithDependenciesAsync(InstallOptions options); | ||
| }; |
Comment on lines
+1671
to
1674
| // This API cannot update the SDK that the client is using. | ||
| RETURN_HR_IF(WSLC_E_SDK_UPDATE_NEEDED, WI_IsFlagSet(components, WSLC_COMPONENT_FLAG_SDK_NEEDS_UPDATE)); | ||
|
|
||
| HRESULT result = S_OK; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of the Pull Request
Updates the WSLC SDK install API to allow more flexibility in the calling pattern, specifically enabling caller-initiated updates/reinstalls to WSL even when WSLC is already present.
PR Checklist
Detailed Description of the Pull Request / Additional comments
Changes
WslcInstallWithDependenciesto take in a component flags and new options enum values. This allows the caller to request specific components to install and to request repair semantics, where we will attempt to install the latest version even if it appears that this version is already present.The call flow is not significantly affected, although the pattern can now support additional checks:
Similar changes are made to the WinRT API surface, with more flexibility to simply not provide some of the inputs and we will make the calls as we would have previously.
Validation Steps Performed
Ran all modified and new tests.
Adds a new test for
WslcInstallWithDependenciesthat forces a GH fallback update that is intentionally blocked by the test.