- Notifications
You must be signed in to change notification settings - Fork7.7k
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
SystemPolicy
APIs are useful outside of PowerShell, for example, theThreadJob
module depends on them to determine when to block a thread job from running. However, they are not included in thePowerShellStandard.Library
package 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.Library
package, 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.Library
the next time we update that package.[Update] As pointed out in#25051 (comment), the
GetFilePolicyEnforcement
method is not available in Windows 5.1 on Win10 or Windows Server 2022. So, we probably should only includeGetSystemLockdownPolicy
andGetLockdownPolicy
inPowerShellStandard.Library
for 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 theGetFilePolicyEnforcement
method to the package.PR Checklist
.h
,.cpp
,.cs
,.ps1
and.psm1
files have the correct copyright headerWIP:
or[ WIP ]
to the beginning of the title (theWIP
bot will keep its status check atPending
while the prefix is present) and remove the prefix when the PR is ready.- [ ] Issue filed: