diff --git a/src/System.Management.Automation/engine/Utils.cs b/src/System.Management.Automation/engine/Utils.cs index 70d3ac4a9..7d71e2a13 100644 --- a/src/System.Management.Automation/engine/Utils.cs +++ b/src/System.Management.Automation/engine/Utils.cs @@ -200,8 +200,12 @@ namespace System.Management.Automation return ecFromTLS.TypeTable; } +#if !UNIX private static string s_pshome = null; + /// + /// Get the application base path of the shell from registry + /// internal static string GetApplicationBaseFromRegistry(string shellId) { bool wantPsHome = (object)shellId == (object)DefaultPowerShellShellID; @@ -226,6 +230,7 @@ namespace System.Management.Automation return null; } +#endif /// /// Gets the application base for current monad version @@ -616,13 +621,18 @@ namespace System.Management.Automation return GetRegistryConfigurationPrefix() + "\\" + shellID; } - // Retrieves group policy settings based on the preference order provided: - // Dictionary settings = GetGroupPolicySetting("Transcription", Registry.LocalMachine, Registry.CurrentUser); - + // Calling static members of 'Registry' on UNIX will raise 'PlatformNotSupportedException' +#if UNIX + internal static RegistryKey[] RegLocalMachine = null; + internal static RegistryKey[] RegCurrentUser = null; + internal static RegistryKey[] RegLocalMachineThenCurrentUser = null; + internal static RegistryKey[] RegCurrentUserThenLocalMachine = null; +#else internal static RegistryKey[] RegLocalMachine = new[] { Registry.LocalMachine }; internal static RegistryKey[] RegCurrentUser = new[] { Registry.CurrentUser }; internal static RegistryKey[] RegLocalMachineThenCurrentUser = new[] { Registry.LocalMachine, Registry.CurrentUser }; internal static RegistryKey[] RegCurrentUserThenLocalMachine = new[] { Registry.CurrentUser, Registry.LocalMachine }; +#endif internal static Dictionary GetGroupPolicySetting(string settingName, RegistryKey[] preferenceOrder) { diff --git a/src/System.Management.Automation/engine/hostifaces/LocalPipeline.cs b/src/System.Management.Automation/engine/hostifaces/LocalPipeline.cs index 64719a124..bba09c267 100644 --- a/src/System.Management.Automation/engine/hostifaces/LocalPipeline.cs +++ b/src/System.Management.Automation/engine/hostifaces/LocalPipeline.cs @@ -247,6 +247,7 @@ namespace System.Management.Automation.Runspaces } } +#if !CORECLR /// /// Stack Reserve setting for pipeline threads /// @@ -263,6 +264,38 @@ namespace System.Management.Automation.Runspaces } } + internal static int ReadRegistryInt(string policyValueName, int defaultValue) + { + RegistryKey key; + try + { + key = Registry.LocalMachine.OpenSubKey(Utils.GetRegistryConfigurationPrefix()); + } + catch (System.Security.SecurityException) + { + return defaultValue; + } + if (null == key) + return defaultValue; + + object temp; + try + { + temp = key.GetValue(policyValueName); + } + catch (System.Security.SecurityException) + { + return defaultValue; + } + if (!(temp is int)) + { + return defaultValue; + } + int i = (int)temp; + return i; + } +#endif + /// /// Helper method for asynchronous invoke ///Unhandled FlowControl exception if InvocationSettings.ExposeFlowControlExceptions is true. @@ -531,40 +564,6 @@ namespace System.Management.Automation.Runspaces return flowControlException; } - // NTRAID#Windows Out Of Band Releases-915506-2005/09/09 - // Removed HandleUnexpectedExceptions infrastructure - - internal static int ReadRegistryInt(string policyValueName, int defaultValue) - { - RegistryKey key; - try - { - key = Registry.LocalMachine.OpenSubKey(Utils.GetRegistryConfigurationPrefix()); - } - catch (System.Security.SecurityException) - { - return defaultValue; - } - if (null == key) - return defaultValue; - - object temp; - try - { - temp = key.GetValue(policyValueName); - } - catch (System.Security.SecurityException) - { - return defaultValue; - } - if (!(temp is int)) - { - return defaultValue; - } - int i = (int)temp; - return i; - } - // NTRAID#Windows Out Of Band Releases-915506-2005/09/09 // Removed HandleUnexpectedExceptions infrastructure ///