Skip to content

fix: Windows Features names the features Windows turns on with the one you enable, and shows them on afterwards - #2944

Merged
laurentiu021 merged 1 commit into
mainfrom
fix/windows-features-names-the-parents-it-turns-on
Oct 21, 2026
Merged

laurentiu021 merged 1 commit into
mainfrom
fix/windows-features-names-the-parents-it-turns-on

Conversation

@laurentiu021

Copy link
Copy Markdown
Owner

Closes #2834 with part 1, the last of its parts that changes what the tab does. Part 5 is now #2943.

Confirmed in the code: Enable runs Enable-WindowsOptionalFeature … -All, which turns on every parent the named feature needs, and the confirmation named only the clicked feature. After the change only that row was written, so the parents that came on read Disabled until the next scan.

The PowerShell cmdlets do not report parents, and the DISM API does. What I checked on my PC, read-only and as administrator: DismGetFeatureParent gives IIS-ASPNET45 six direct parents, among them NetFx4Extended-ASPNET45, gives IIS-WebServer IIS-WebServerRole, gives TelnetClient none, and refuses a name Windows does not know with 0x800F080C. Its DismFeature is packed to one byte, a name pointer and then the state, which is what the six read back correctly showed.

The changes:

  • New IFeatureParentsService / FeatureParentsService: one DISM session per question, one at a time, walking DismGetFeatureParent through every parent, nearest first and each once, with a limit of 64 against a list that never ends. Each parent carries whether it is on and whether a change to it waits for a restart. Null when DISM cannot be asked, so the tab never claims to know. dismapi.dll is not one of the DLLs Windows always loads from System32, and SysManager runs elevated, so every import carries DefaultDllImportSearchPaths(System32).
  • WindowsFeaturesViewModel asks it before the confirmation, with the bar moving and "Checking what X needs…" on the status line, which goes back afterwards. Enabling says "Windows turns these on with it, because it needs them: …", ten names and then a count; disabling says "The features it needs stay on: …"; and when DISM could not be asked, enabling says "Windows also turns on any other features it needs.".
  • After turning a feature on, those that were off are read again and their rows written from DISM's answer, a restart one sets the reboot notice, and the status line ends "Windows also turned on N features it needs.".
  • Registered in ServiceRegistration and passed in the designer graph.

I left two things out on purpose. The issue suggested trying the change without -All first, but asking DISM first names the parents without a failed servicing run. And offering to turn the parents off when the feature is turned off would need to know which other features still need them; the confirmation names them instead, and each row can turn its own off.

Part 5 of #2834 (the admin banner's place below the toolbar, and Shortcut Cleaner's banner margin) moves where things sit on screen, so it waits for a look at a mockup, and is now #2943.

Docs

README, Windows Features: what else comes on. ARCHITECTURE: the new service, the seam count and list, and WindowsFeaturesViewModel.

Tests

  • New FeatureParentsServiceTests (unit): the walk lists every feature needed, nearest first and each once; goes on through a parent that is on; reads each DISM state; knows nothing when DISM does not answer; ends on a loop and never lists the feature itself; stops at its limit; skips a blank name; and every DISM call loads dismapi.dll from System32 only.
  • New in WindowsFeaturesTests: enabling names what comes on and shows those rows on afterwards, with the count on the status line and a restart one setting the notice; disabling names what stays on; DISM not answering gives the general sentence and the status line goes back; ten names and then a count.
  • New FeatureParentsServiceTests (integration), as administrator: the real DISM API reads what IIS-ASPNET45 needs, IIS-WebServerRole and NetFx4Extended-ASPNET45 among them, and knows nothing of a name Windows does not know.
  • EveryStringMarshallingInterop_BindsTheWideEntryPoint lists the three DISM functions that take text as Unicode-only, with the call that confirms it.
  • Red before the fix, green after, each undone on its own: the confirmation without the parents, the parent rows not written, the count not said, the status line left on "Checking", the walk stopping at a parent that is on, the walk without its seen set, a 16-byte stride (the integration test), and the System32 attribute removed.
  • Run locally, twice: WindowsFeaturesTests, FeatureParentsServiceTests, SafetyDatabaseTests, ArchitectureTests, AcceleratorRoutingTests, SystemPathsTests, InclusiveTermsTests, ServiceRegistrationGraphTests, FileLockServiceTests and PerformanceServiceExtendedTests, and the integration FeatureParentsServiceTests, WindowsFeatureScriptTests, AllViewModelsSweepTests and MainWindowViewModelTests. All four projects build with 0 warnings, and dotnet format --verify-no-changes is clean.

…e you enable, and shows them on afterwards

- New IFeatureParentsService / FeatureParentsService reads, through the DISM API's DismGetFeatureParent, every feature
  another one needs: its parents, theirs and so on. dismapi.dll is loaded from System32 only.
- Before a change the view model asks it, and the confirmation names what turning the feature on turns on with it, or
  the features it needs, which stay on when it is turned off. After turning one on, those rows are written from DISM's
  answer and the status line says how many came on. Enabling passes -All, and only the clicked feature was named.
@laurentiu021
laurentiu021 merged commit 127495a into main Oct 21, 2026
6 checks passed
@laurentiu021
laurentiu021 deleted the fix/windows-features-names-the-parents-it-turns-on branch October 21, 2026 23:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Windows Features — enabling one feature quietly turns on its parents, every failure says "Check permissions", and Escape kills DISM part-way

1 participant