-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Don't fail if SaferPolicy API is not available on Win10 IoT or NanoServer #7075
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
fix install-powershellremoting to work on Windows PowerShell 5.1
| int lastError = Marshal.GetLastWin32Error(); | ||
| if (lastError == NativeConstants.FUNCTION_NOT_SUPPORTED) | ||
| { | ||
| _saferApiSupported = false; |
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.
The var name "_saferApiSupported" is kind of misleading because it is broad in a sense that there are other native API calls (Cert-related) in this file that neither utilize this 'global flag' nor set it in case of similar error handling (Win32Exception(Marshal.GetLastWin32Error())).
So for consistency either this"_saferApiSupported" flag should be added to them; or simply renamed to something more narrow like "_SaferIdentifyLevelApiSupported".
TravisEz13
left a comment
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.
other than the issue we discussed offline, looks good to me
| /// MAX_PATH -> 260 | ||
| internal const int MAX_PATH = 260; | ||
|
|
||
| /// This function is not supported on this system |
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.
:-) CodeFactor says that we use incorrect documentation header.
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.
I'll fix this file
|
|
||
| #endregion execution policy | ||
|
|
||
| private static bool _SaferIdentifyLevelApiSupported = true; |
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.
From CodeFactor - Variable names and private field names must start with a lower-case letter.
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.
will change
PR Summary
We P/Invoke to the SaferPolicy APIs which are not available on Win10 IoT or NanoServer.
If the Win32 error indicates that the api is not supported, we default to Allowed.
Updated
Install-PowerShellRemoting.ps1to work correctly on Windows PowerShell Core 5 so that you can install PSCore6 remoting on Win10 IoT.Fix #6750
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:to the beginning of the title and remove the prefix when the PR is ready.[feature]if the change is significant or affects feature tests