Add Microsoft.Windows/FeatureOnDemandList resource#1433
Add Microsoft.Windows/FeatureOnDemandList resource#1433SteveL-MSFT wants to merge 8 commits intoPowerShell:mainfrom
Microsoft.Windows/FeatureOnDemandList resource#1433Conversation
1397b87 to
af8e5e6
Compare
There was a problem hiding this comment.
Pull request overview
Adds a new Windows DSC resource (Microsoft.Windows/FeatureOnDemandList) to the dism_dsc resource host, alongside refactors to share DISM state/wildcard filtering utilities and to speed up export operations by avoiding expensive per-item info calls unless needed.
Changes:
- Add
Microsoft.Windows/FeatureOnDemandListresource with get/set/export backed by DISM capability APIs. - Refactor shared DISM state + wildcard filtering into a new
utilmodule and update OptionalFeature export to return basic (name/state) results by default. - Update resource manifests, localization strings, and add Pester tests for the new capability resource.
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 15 comments.
Show a summary per file
| File | Description |
|---|---|
| resources/dism_dsc/src/optional_feature/dism.rs | Adds DISM capability API bindings and refactors feature/capability enumeration and info retrieval. |
| resources/dism_dsc/src/util.rs | Introduces shared DismState and wildcard/filter helpers used by both resources. |
| resources/dism_dsc/src/main.rs | Updates CLI dispatch to route by operation + resource type. |
| resources/dism_dsc/src/feature_on_demand/* | Implements Feature on Demand get/set/export handlers and types. |
| resources/dism_dsc/src/optional_feature/export.rs | Optimizes export by returning basic feature objects unless “full info” filtering is requested. |
| resources/dism_dsc/src/optional_feature/types.rs | Switches feature state to shared DismState and adds shared filter matching. |
| resources/dism_dsc/src/optional_feature/mod.rs | Exposes DISM bindings module for reuse by Feature on Demand implementation. |
| resources/dism_dsc/src/optional_feature/set.rs | Reuses shared get_computer_name helper. |
| resources/dism_dsc/tests/featureOnDemand_{get,set,export}.tests.ps1 | Adds Pester coverage for new FeatureOnDemandList resource. |
| resources/dism_dsc/tests/optionalFeature_export.tests.ps1 | Updates expectations for basic export output and “full-info filter” behavior. |
| resources/dism_dsc/featureondemand.dsc.resource.json | Adds the new DSC resource manifest and embedded schema. |
| resources/dism_dsc/optionalfeature.dsc.resource.json | Updates args to include resource type for the new dispatcher format. |
| resources/dism_dsc/locales/en-us.toml | Adds localized messages for FoD operations and dispatcher changes. |
| resources/dism_dsc/.project.data.json | Ensures the new resource manifest is copied into the Windows bundle. |
| .vscode/settings.json | Adds workspace settings related to terminal auto-approval. |
Comments suppressed due to low confidence (1)
resources/dism_dsc/src/optional_feature/dism.rs:38
DismFeatureInfois alsopacked(4), but it contains pointer fields (*const u16). With 4-byte packing on 64-bit, the offsets/stride are very likely different from the actual DISM struct layout, so reading fields likedisplay_name/descriptioncan be invalid. Use the correct#[repr(C)]layout (and avoid packing unless the header explicitly requires it).
#[repr(C, packed(4))]
struct DismFeatureInfo {
feature_name: *const u16,
state: i32,
display_name: *const u16,
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
36664a0 to
6b2d352
Compare
There was a problem hiding this comment.
Pull request overview
Adds a new Microsoft.Windows/FeatureOnDemandList DSC resource and refactors shared DISM/wildcard logic to support get/set/export while keeping export performant by default.
Changes:
- Introduces Feature-on-Demand (capability) get/set/export implementation and manifests.
- Refactors common DISM state + wildcard filtering into a shared
utilmodule and reuses it for OptionalFeature export filtering. - Updates CLI dispatch to include a resource-type argument and adjusts OptionalFeature export tests to match “basic info unless full-info filter” behavior.
Reviewed changes
Copilot reviewed 21 out of 22 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| resources/dism_dsc/src/feature_on_demand/types.rs | Defines Feature-on-Demand schema types and wildcard filter matching. |
| resources/dism_dsc/src/feature_on_demand/get.rs | Implements get operation for capabilities via DISM API. |
| resources/dism_dsc/src/feature_on_demand/set.rs | Implements set operation (Installed/NotPresent) for capabilities via DISM API. |
| resources/dism_dsc/src/feature_on_demand/export.rs | Implements export with fast/basic path and full-info path based on filters. |
| resources/dism_dsc/src/feature_on_demand/mod.rs | Wires Feature-on-Demand module handlers. |
| resources/dism_dsc/src/util.rs | Adds shared DISM state enum, wildcard matching helpers, and tests. |
| resources/dism_dsc/src/optional_feature/types.rs | Reuses shared DismState and introduces shared filter trait usage. |
| resources/dism_dsc/src/optional_feature/export.rs | Refactors export filtering to shared wildcard/filter utilities; adds fast/basic output behavior. |
| resources/dism_dsc/src/optional_feature/get.rs | Switches to shared crate::dism::DismSessionHandle. |
| resources/dism_dsc/src/optional_feature/set.rs | Switches to shared crate::dism::DismSessionHandle and shared computer-name utility. |
| resources/dism_dsc/src/optional_feature/mod.rs | Adjusts module visibility and removes optional_feature-scoped dism module declaration. |
| resources/dism_dsc/src/optional_feature/dism.rs | Extends DISM FFI wrapper to include capability APIs and refactors struct packing/reads. |
| resources/dism_dsc/src/main.rs | Adds <resource-type> dispatch argument and changes stdin reading behavior. |
| resources/dism_dsc/optionalfeature.dsc.resource.json | Updates args to pass resource type to the executable. |
| resources/dism_dsc/featureondemand.dsc.resource.json | Adds new DSC resource manifest and embedded schema for capabilities. |
| resources/dism_dsc/locales/en-us.toml | Adds i18n messages for Feature-on-Demand and new CLI argument handling. |
| resources/dism_dsc/tests/featureOnDemand_get.tests.ps1 | Adds Pester coverage for get operation behavior and errors. |
| resources/dism_dsc/tests/featureOnDemand_set.tests.ps1 | Adds Pester coverage for set operation behavior, including mutating scenarios and errors. |
| resources/dism_dsc/tests/featureOnDemand_export.tests.ps1 | Adds Pester coverage for export filtering and “full-info filter” behavior. |
| resources/dism_dsc/tests/optionalFeature_export.tests.ps1 | Updates OptionalFeature export tests to validate basic output and full-info filtering. |
| resources/dism_dsc/.project.data.json | Ensures new resource manifest is copied for Windows builds. |
| .vscode/settings.json | Normalizes file formatting (newline/indent). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
b27400e to
f948764
Compare
PR Summary
Add
Microsoft.Windows/FeatureOnDemandListresource supportingget,set, andexportoperationsnameis required forgetandsetand must be exact case-insensitive matchexportsupports wildcard filtering forname,displayNameanddescriptionexport, only thenameandstateare returned since retrieving all of the properties is extremely slow, however, if any property is used as a filter then those properties must be retrieved and will be much slower to filter