Skip to content

[release/v7.6.6] Fix FileOnlyEntry crashing on older versions of Windows - #27931

Merged
Patrick Meinecke (SeeminglyScience) merged 1 commit into
PowerShell:release/v7.6.6from
SeeminglyScience:backport/release/v7.6.6/27880-80fdeb912
Sep 1, 2026
Merged

[release/v7.6.6] Fix FileOnlyEntry crashing on older versions of Windows#27931
Patrick Meinecke (SeeminglyScience) merged 1 commit into
PowerShell:release/v7.6.6from
SeeminglyScience:backport/release/v7.6.6/27880-80fdeb912

Conversation

@SeeminglyScience

Copy link
Copy Markdown
Contributor

Backport of #27880 to release/v7.6.6

Triggered by Patrick Meinecke (@SeeminglyScience) on behalf of Patrick Meinecke (@SeeminglyScience)

Original CL Label: CL-Engine

/cc @PowerShell/powershell-maintainers

Impact

REQUIRED: Choose either Tooling Impact or Customer Impact (or both). At least one checkbox must be selected.

Tooling Impact

  • Required tooling change
  • Optional tooling change (include reasoning)

Customer Impact

  • Customer reported
  • Found internally

Fixes a crash when the new EnableFileOnlyEntry WLDP setting check runs on older Windows versions that lack the corresponding API; EntryPointNotFoundException is now caught and treated as a false result instead of crashing.

Regression

REQUIRED: Check exactly one box.

  • Yes
  • No

Introduced by #26752 (backported as #27922), which added the FileOnlyEntry WLDP setting check without accounting for older Windows versions missing the API.

Testing

Cherry-picked cleanly with no conflicts, now that the prerequisite PR #26752 (backport #27922) is present in the release branch.

Risk

REQUIRED: Check exactly one box.

  • High
  • Medium
  • Low

Fixes a crash on older Windows versions caused by the FileOnlyEntry WLDP check backported in #27922; catches EntryPointNotFoundException and treats it as a false result. Fix is narrowly scoped to the new opt-in setting's code path.

Copilot AI lite review requested due to automatic review settings September 1, 2026 02:10
@SeeminglyScience Patrick Meinecke (SeeminglyScience) added the CL-Engine Indicates that a PR should be marked as an engine change in the Change Log label Sep 1, 2026
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Backports the fix from #27880 to release/v7.6.6 to prevent a crash on older Windows versions when querying the WLDP EnableFileOnlyEntry/FileOnlyEntry setting, where the underlying API entry point may not exist.

Changes:

  • Wraps the WLDP boolean setting query in a safe helper that catches DllNotFoundException / EntryPointNotFoundException and treats the setting as disabled.
  • Adds explicit ETW logging for the “API not available” failure path, instead of allowing an unhandled exception to crash PowerShell.
  • Keeps the existing debug override (__PSLockdownPolicy_<settingName>) behavior for forcing the setting on when the native query returns false.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@SeeminglyScience Patrick Meinecke (SeeminglyScience) changed the title [release/v7.6.6] Fix FileOnlyEntry crashing on older versions of Windows wip: [release/v7.6.6] Fix FileOnlyEntry crashing on older versions of Windows Sep 1, 2026
@SeeminglyScience Patrick Meinecke (SeeminglyScience) changed the title wip: [release/v7.6.6] Fix FileOnlyEntry crashing on older versions of Windows [release/v7.6.6] Fix FileOnlyEntry crashing on older versions of Windows Sep 1, 2026
@SeeminglyScience
Patrick Meinecke (SeeminglyScience) merged commit 2de3d96 into PowerShell:release/v7.6.6 Sep 1, 2026
38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-Engine Indicates that a PR should be marked as an engine change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants