-
Notifications
You must be signed in to change notification settings - Fork 8k
Make some SystemPolicy APIs visible but non-op on Unix so that they can be included in PowerShellStandard.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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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 |
|
That's a very good point. I wasn't aware of it. [update] Opened the issue PowerShell/PowerShellStandard#103 to track the change to |
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.
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
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: