- Notifications
You must be signed in to change notification settings - Fork8.1k
Make someSystemPolicy APIs visible but non-op on Unix so that they can be included inPowerShellStandard.Library#25051
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
@SeeminglyScience Where shall we open issues to track the changes needed for |
Perhaps we could annotate them with SupportedOSPlatformAttribute. |
How will this work across the Windows versions? The |
daxian-dbw commentedFeb 21, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
That's a very good point. I wasn't aware of it. [update] Opened the issuePowerShell/PowerShellStandard#103 to track the change to |
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Approved, but waiting on@SeeminglyScience to verify one thing.
Uh oh!
There was an error while loading.Please reload this page.
Co-authored-by: Travis Plunk <travis.plunk@microsoft.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Reviewed with@SeeminglyScience
0e6ffc5 intoPowerShell:masterUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
PR Summary
Some
SystemPolicyAPIs are useful outside of PowerShell, for example, theThreadJobmodule depends on them to determine when to block a thread job from running. However, they are not included in thePowerShellStandard.Librarypackage because they are Windows-only API so far. So, it's hard for a module to use it -- it has to invoke those method with reflection.In order to include them in the
PowerShellStandard.Librarypackage, those APIs need to be available on both Windows and Unix platforms, so this PR make them visible but non-op on Unix, so that they can be included inPowerShellStandard.Librarythe next time we update that package.[Update] As pointed out in#25051 (comment), the
GetFilePolicyEnforcementmethod is not available in Windows 5.1 on Win10 or Windows Server 2022. So, we probably should only includeGetSystemLockdownPolicyandGetLockdownPolicyinPowerShellStandard.Libraryfor the short/middle term. After Windows 10 and Windows Server 2022 reach EOL (or when the method becomes available on them) we can then add theGetFilePolicyEnforcementmethod to the package.PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:or[ WIP ]to the beginning of the title (theWIPbot will keep its status check atPendingwhile the prefix is present) and remove the prefix when the PR is ready.- [ ] Issue filed: