Make some SystemPolicy APIs visible but non-op on Unix so that they can be included in PowerShellStandard.Library#25051
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 |
TravisEz13
left a comment
There was a problem hiding this comment.
Approved, but waiting on @SeeminglyScience to verify one thing.
Co-authored-by: Travis Plunk <[email protected]>
TravisEz13
left a comment
There was a problem hiding this comment.
Reviewed with @SeeminglyScience
…so that they can be included in `PowerShellStandard.Library` (PowerShell#25051)
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: