Skip to content

Conversation

@SteveL-MSFT
Copy link
Member

@SteveL-MSFT SteveL-MSFT commented Jun 15, 2018

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.ps1 to work correctly on Windows PowerShell Core 5 so that you can install PSCore6 remoting on Win10 IoT.

Fix #6750

PR Checklist

fix install-powershellremoting to work on Windows PowerShell 5.1
int lastError = Marshal.GetLastWin32Error();
if (lastError == NativeConstants.FUNCTION_NOT_SUPPORTED)
{
_saferApiSupported = false;

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".

Copy link
Member

@TravisEz13 TravisEz13 left a 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
Copy link
Collaborator

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.

Copy link
Member Author

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;
Copy link
Collaborator

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will change

@adityapatwardhan adityapatwardhan merged commit abcdce4 into PowerShell:master Jun 20, 2018
@SteveL-MSFT SteveL-MSFT deleted the safer-api branch June 20, 2018 02:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pwsh.exe does not start on Windows 10 IOT (arm32)

7 participants