internal static string WSManGetSessionOptionAsString( IntPtr wsManAPIHandle, WSManNativeApi.WSManSessionOption option) { string str = ""; int optionLengthUsed = 0; if (122 != WSManNativeApi.WSManGetSessionOptionAsString(wsManAPIHandle, option, 0, (byte[])null, out optionLengthUsed)) { return(str); } byte[] numArray = new byte[optionLengthUsed * 2]; if (WSManNativeApi.WSManGetSessionOptionAsString(wsManAPIHandle, option, optionLengthUsed * 2, numArray, out int _) != 0) { return(str); } try { str = Encoding.Unicode.GetString(numArray); } catch (ArgumentNullException ex) { } catch (DecoderFallbackException ex) { } return(str); }
internal void SetWSManSessionOption(WSManNativeApi.WSManSessionOption option, int dwordData) { int errorCode = WSManNativeApi.WSManSetSessionOption(this.wsManSessionHandle, option, new WSManNativeApi.WSManDataDWord(dwordData)); if (errorCode != 0) { throw new PSInvalidOperationException(WSManNativeApi.WSManGetErrorMessage(WSManClientSessionTransportManager.wsManApiStaticData.WSManAPIHandle, errorCode)); } }
internal static int WSManSetSessionOption( IntPtr wsManSessionHandle, WSManNativeApi.WSManSessionOption option, WSManNativeApi.WSManDataDWord data) { WSManNativeApi.MarshalledObject marshalledObject = data.Marshal(); using (marshalledObject) return(WSManNativeApi.WSManSetSessionOption(wsManSessionHandle, option, marshalledObject.DataPtr)); }
internal void SetWSManSessionOption(WSManNativeApi.WSManSessionOption option, string stringData) { using (WSManNativeApi.WSManData wsManData = new WSManNativeApi.WSManData(stringData)) { int errorCode = WSManNativeApi.WSManSetSessionOption(this.wsManSessionHandle, option, (IntPtr)wsManData); if (errorCode != 0) { throw new PSInvalidOperationException(WSManNativeApi.WSManGetErrorMessage(WSManClientSessionTransportManager.wsManApiStaticData.WSManAPIHandle, errorCode)); } } }
private static extern int WSManGetSessionOptionAsString( IntPtr wsManSessionHandle, WSManNativeApi.WSManSessionOption option, int optionLength, byte[] optionAsString, out int optionLengthUsed);
internal static extern void WSManGetSessionOptionAsDword( IntPtr wsManSessionHandle, WSManNativeApi.WSManSessionOption option, out int value);
internal static extern int WSManSetSessionOption( IntPtr wsManSessionHandle, WSManNativeApi.WSManSessionOption option, IntPtr data);