| |
| |
|
|
| using System; |
| using System.Collections; |
| using System.Collections.Generic; |
| using System.ComponentModel; |
| using System.Diagnostics.CodeAnalysis; |
| using System.IO; |
| using System.Management.Automation; |
| using System.Management.Automation.Provider; |
| using System.Reflection; |
| using System.Runtime.CompilerServices; |
| using System.Runtime.InteropServices; |
| using System.Text; |
| using System.Xml; |
|
|
| #pragma warning disable 1591 |
|
|
| namespace Microsoft.WSMan.Management |
| { |
| #region "public Api" |
|
|
| #region WsManEnumFlags |
| |
| [SuppressMessage("Microsoft.Design", "CA1027:MarkEnumsWithFlags")] |
| [TypeLibType((short)0)] |
| public enum WSManEnumFlags |
| { |
| |
| WSManFlagNonXmlText = 1, |
|
|
| |
| WSManFlagReturnObject = 0, |
|
|
| |
| [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "EPR")] |
| WSManFlagReturnEPR = 2, |
|
|
| |
| [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "EPR")] |
| WSManFlagReturnObjectAndEPR = 4, |
|
|
| |
| WSManFlagHierarchyDeep = 0, |
|
|
| |
| WSManFlagHierarchyShallow = 32, |
|
|
| |
| WSManFlagHierarchyDeepBasePropsOnly = 64, |
|
|
| |
| WSManFlagAssociationInstance = 128 |
| } |
|
|
| #endregion WsManEnumFlags |
|
|
| #region WsManSessionFlags |
| |
| [SuppressMessage("Microsoft.Design", "CA1027:MarkEnumsWithFlags")] |
| [TypeLibType((short)0)] |
| public enum WSManSessionFlags |
| { |
| |
| WSManNone = 0, |
|
|
| |
| WSManFlagUtf8 = 1, |
|
|
| |
| [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Cred")] |
| WSManFlagCredUserNamePassword = 4096, |
|
|
| |
| WSManFlagSkipCACheck = 8192, |
|
|
| |
| WSManFlagSkipCNCheck = 16384, |
|
|
| |
| WSManFlagUseNoAuthentication = 32768, |
|
|
| |
| WSManFlagUseDigest = 65536, |
|
|
| |
| WSManFlagUseNegotiate = 131072, |
|
|
| |
| WSManFlagUseBasic = 262144, |
|
|
| |
| WSManFlagUseKerberos = 524288, |
|
|
| |
| WSManFlagNoEncryption = 1048576, |
|
|
| |
| [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Spn")] |
| WSManFlagEnableSpnServerPort = 4194304, |
|
|
| |
| WSManFlagUtf16 = 8388608, |
|
|
| |
| [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Ssp")] |
| [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Cred")] |
| WSManFlagUseCredSsp = 16777216, |
|
|
| |
| WSManFlagUseClientCertificate = 2097152, |
|
|
| |
| WSManFlagSkipRevocationCheck = 33554432, |
|
|
| |
| WSManFlagAllowNegotiateImplicitCredentials = 67108864, |
|
|
| |
| WSManFlagUseSsl = 134217728 |
| } |
| #endregion WsManSessionFlags |
|
|
| #region AuthenticationMechanism |
| |
| [SuppressMessage("Microsoft.Design", "CA1027:MarkEnumsWithFlags")] |
| public enum AuthenticationMechanism |
| { |
| |
| |
| |
| None = 0x0, |
| |
| |
| |
| Default = 0x1, |
| |
| |
| |
| Digest = 0x2, |
| |
| |
| |
| Negotiate = 0x4, |
| |
| |
| |
| Basic = 0x8, |
| |
| |
| |
| Kerberos = 0x10, |
| |
| |
| |
| ClientCertificate = 0x20, |
| |
| |
| |
| [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Credssp")] |
| Credssp = 0x80, |
| } |
|
|
| #endregion AuthenticationMechanism |
|
|
| #region IWsMan |
|
|
| |
| [SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Error")] |
| [SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get")] |
| [Guid("190D8637-5CD3-496D-AD24-69636BB5A3B5")] |
| [ComImport] |
| [TypeLibType((short)4304)] |
| #if CORECLR |
| [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] |
| #else |
| [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)] |
| #endif |
|
|
| public interface IWSMan |
| { |
| #if CORECLR |
| [return: MarshalAs(UnmanagedType.IUnknown)] |
| object GetTypeInfoCount(); |
|
|
| [return: MarshalAs(UnmanagedType.IUnknown)] |
| object GetTypeInfo(); |
|
|
| [return: MarshalAs(UnmanagedType.IUnknown)] |
| object GetIDsOfNames(); |
|
|
| [return: MarshalAs(UnmanagedType.IUnknown)] |
| object Invoke(); |
| #endif |
|
|
| |
| |
| |
|
|
| [DispId(1)] |
| #if CORECLR |
| [return: MarshalAs(UnmanagedType.IUnknown)] |
| object CreateSession([MarshalAs(UnmanagedType.BStr)] string connection, int flags, [MarshalAs(UnmanagedType.IUnknown)] object connectionOptions); |
| #else |
| [return: MarshalAs(UnmanagedType.IDispatch)] |
| object CreateSession([MarshalAs(UnmanagedType.BStr)] string connection, int flags, [MarshalAs(UnmanagedType.IDispatch)] object connectionOptions); |
| #endif |
| |
| |
| |
| |
| [DispId(2)] |
| #if CORECLR |
| [return: MarshalAs(UnmanagedType.IUnknown)] |
| #else |
| [return: MarshalAs(UnmanagedType.IDispatch)] |
| #endif |
| object CreateConnectionOptions(); |
|
|
| |
| |
| |
| |
| string CommandLine |
| { |
| |
|
|
| [DispId(3)] |
| [return: MarshalAs(UnmanagedType.BStr)] |
| get; |
| } |
|
|
| |
| |
| |
| |
|
|
| [SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Error")] |
| string Error |
| { |
| |
|
|
| [SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Error")] |
| [DispId(4)] |
| [return: MarshalAs(UnmanagedType.BStr)] |
| get; |
| } |
| } |
| #endregion IWsMan |
|
|
| #region IWSManConnectionOptions |
| |
| [Guid("F704E861-9E52-464F-B786-DA5EB2320FDD")] |
| [ComImport] |
| [TypeLibType((short)4288)] |
| #if CORECLR |
| [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] |
| #else |
| [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)] |
| #endif |
| [SuppressMessage("Microsoft.Design", "CA1044:PropertiesShouldNotBeWriteOnly")] |
| public interface IWSManConnectionOptions |
| { |
| #if CORECLR |
| [return: MarshalAs(UnmanagedType.IUnknown)] |
| object GetTypeInfoCount(); |
|
|
| [return: MarshalAs(UnmanagedType.IUnknown)] |
| object GetTypeInfo(); |
|
|
| [return: MarshalAs(UnmanagedType.IUnknown)] |
| object GetIDsOfNames(); |
|
|
| [return: MarshalAs(UnmanagedType.IUnknown)] |
| object Invoke(); |
| #endif |
| |
| |
| |
|
|
| string UserName |
| { |
| |
|
|
| [DispId(1)] |
| [return: MarshalAs(UnmanagedType.BStr)] |
| get; |
| |
|
|
| [DispId(1)] |
| set; |
| } |
|
|
| |
| |
| |
|
|
| [SuppressMessage("Microsoft.Design", "CA1044:PropertiesShouldNotBeWriteOnly")] |
| string Password |
| { |
| |
|
|
| [SuppressMessage("Microsoft.Design", "CA1044:PropertiesShouldNotBeWriteOnly")] |
| [DispId(2)] |
| set; |
| } |
| } |
|
|
| |
| [Guid("EF43EDF7-2A48-4d93-9526-8BD6AB6D4A6B")] |
| [ComImport] |
| [TypeLibType((short)4288)] |
| #if CORECLR |
| [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] |
| #else |
| [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)] |
| #endif |
| [SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")] |
| public interface IWSManConnectionOptionsEx : IWSManConnectionOptions |
| { |
| |
| string CertificateThumbprint |
| { |
| [DispId(3)] |
| [return: MarshalAs(UnmanagedType.BStr)] |
| get; |
|
|
| [DispId(1)] |
| set; |
| } |
| } |
|
|
| |
| [Guid("F500C9EC-24EE-48ab-B38D-FC9A164C658E")] |
| [ComImport] |
| [TypeLibType((short)4288)] |
| #if CORECLR |
| [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] |
| #else |
| [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)] |
| #endif |
| public interface IWSManConnectionOptionsEx2 : IWSManConnectionOptionsEx |
| { |
| |
| [DispId(4)] |
| void SetProxy(int accessType, |
| int authenticationMechanism, |
| [In, MarshalAs(UnmanagedType.BStr)] string userName, |
| [In, MarshalAs(UnmanagedType.BStr)] string password); |
|
|
| |
| [DispId(5)] |
| int ProxyIEConfig(); |
|
|
| |
| [DispId(6)] |
| int ProxyWinHttpConfig(); |
|
|
| |
| [DispId(7)] |
| int ProxyAutoDetect(); |
|
|
| |
| [DispId(8)] |
| int ProxyNoProxyServer(); |
|
|
| |
| [DispId(9)] |
| int ProxyAuthenticationUseNegotiate(); |
|
|
| |
| [DispId(10)] |
| int ProxyAuthenticationUseBasic(); |
|
|
| |
| [DispId(11)] |
| int ProxyAuthenticationUseDigest(); |
| } |
|
|
| #endregion IWSManConnectionOptions |
|
|
| #region IWSManEnumerator |
| |
| [Guid("F3457CA9-ABB9-4FA5-B850-90E8CA300E7F")] |
| [ComImport] |
| [TypeLibType((short)4288)] |
| #if CORECLR |
| [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] |
| #else |
| [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)] |
| #endif |
|
|
| public interface IWSManEnumerator |
| { |
| #if CORECLR |
| [return: MarshalAs(UnmanagedType.IUnknown)] |
| object GetTypeInfoCount(); |
|
|
| [return: MarshalAs(UnmanagedType.IUnknown)] |
| object GetTypeInfo(); |
|
|
| [return: MarshalAs(UnmanagedType.IUnknown)] |
| object GetIDsOfNames(); |
|
|
| [return: MarshalAs(UnmanagedType.IUnknown)] |
| object Invoke(); |
| #endif |
|
|
| |
| |
| |
|
|
| [DispId(1)] |
| [return: MarshalAs(UnmanagedType.BStr)] |
| string ReadItem(); |
|
|
| |
| |
| |
|
|
| bool AtEndOfStream |
| { |
| |
|
|
| [DispId(2)] |
| [return: MarshalAs(UnmanagedType.Bool)] |
| get; |
| } |
|
|
| |
| |
| |
| [SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Error")] |
| string Error |
| { |
| |
| [SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Error")] |
| [DispId(8)] |
| [return: MarshalAs(UnmanagedType.BStr)] |
| get; |
| } |
| } |
| #endregion IWSManEnumerator |
|
|
| #region IWSManEx |
| |
| [Guid("2D53BDAA-798E-49E6-A1AA-74D01256F411")] |
| [ComImport] |
| [TypeLibType((short)4304)] |
| [SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")] |
| #if CORECLR |
| [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] |
| #else |
| [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)] |
| #endif |
| [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "str")] |
| [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Cred")] |
| [SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "Username")] |
| [SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Error")] |
| public interface IWSManEx |
| { |
| #if CORECLR |
| [return: MarshalAs(UnmanagedType.IUnknown)] |
| object GetTypeInfoCount(); |
|
|
| [return: MarshalAs(UnmanagedType.IUnknown)] |
| object GetTypeInfo(); |
|
|
| [return: MarshalAs(UnmanagedType.IUnknown)] |
| object GetIDsOfNames(); |
|
|
| [return: MarshalAs(UnmanagedType.IUnknown)] |
| object Invoke(); |
| #endif |
|
|
| |
| |
| |
|
|
| [DispId(1)] |
| #if CORECLR |
| [return: MarshalAs(UnmanagedType.IUnknown)] |
| object CreateSession([MarshalAs(UnmanagedType.BStr)] string connection, int flags, [MarshalAs(UnmanagedType.IUnknown)] object connectionOptions); |
| #else |
| [return: MarshalAs(UnmanagedType.IDispatch)] |
| object CreateSession([MarshalAs(UnmanagedType.BStr)] string connection, int flags, [MarshalAs(UnmanagedType.IDispatch)] object connectionOptions); |
| #endif |
|
|
| |
| |
| |
|
|
| [DispId(2)] |
| #if CORECLR |
| [return: MarshalAs(UnmanagedType.IUnknown)] |
| #else |
| [return: MarshalAs(UnmanagedType.IDispatch)] |
| #endif |
| object CreateConnectionOptions(); |
|
|
| |
| |
| |
| string CommandLine |
| { |
| |
|
|
| [DispId(3)] |
| [return: MarshalAs(UnmanagedType.BStr)] |
| get; |
| } |
|
|
| |
| |
| |
|
|
| [SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Error")] |
| string Error |
| { |
| |
|
|
| [SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Error")] |
| [DispId(4)] |
| [return: MarshalAs(UnmanagedType.BStr)] |
| get; |
| } |
|
|
| |
| |
| |
|
|
| [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "str")] |
| [DispId(5)] |
| #if CORECLR |
| [return: MarshalAs(UnmanagedType.IUnknown)] |
| #else |
| [return: MarshalAs(UnmanagedType.IDispatch)] |
| #endif |
| object CreateResourceLocator([MarshalAs(UnmanagedType.BStr)] string strResourceLocator); |
|
|
| |
| |
| |
|
|
| [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "UTF")] |
| [DispId(6)] |
| int SessionFlagUTF8(); |
|
|
| |
| |
| |
|
|
| [SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "Username")] |
| [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Cred")] |
| [DispId(7)] |
| int SessionFlagCredUsernamePassword(); |
|
|
| |
| |
| |
|
|
| [DispId(8)] |
| int SessionFlagSkipCACheck(); |
|
|
| |
| |
| |
|
|
| [DispId(9)] |
| int SessionFlagSkipCNCheck(); |
|
|
| |
| |
| |
|
|
| [DispId(10)] |
| int SessionFlagUseDigest(); |
|
|
| |
| |
| |
|
|
| [DispId(11)] |
| int SessionFlagUseNegotiate(); |
|
|
| |
| |
| |
|
|
| [DispId(12)] |
| int SessionFlagUseBasic(); |
|
|
| |
| |
| |
|
|
| [DispId(13)] |
| int SessionFlagUseKerberos(); |
|
|
| |
| |
| |
|
|
| [DispId(14)] |
| int SessionFlagNoEncryption(); |
|
|
| |
| |
| |
|
|
| [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "SPN")] |
| [DispId(15)] |
| int SessionFlagEnableSPNServerPort(); |
|
|
| |
| |
| |
|
|
| [DispId(16)] |
| int SessionFlagUseNoAuthentication(); |
|
|
| |
| |
| |
|
|
| [DispId(17)] |
| int EnumerationFlagNonXmlText(); |
|
|
| |
| |
| |
|
|
| [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "EPR")] |
| [DispId(18)] |
| int EnumerationFlagReturnEPR(); |
|
|
| |
| |
| |
|
|
| [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "EPR")] |
| [DispId(19)] |
| int EnumerationFlagReturnObjectAndEPR(); |
|
|
| |
| |
| |
|
|
| [DispId(20)] |
| [return: MarshalAs(UnmanagedType.BStr)] |
| string GetErrorMessage(uint errorNumber); |
|
|
| |
| |
| |
|
|
| [DispId(21)] |
| int EnumerationFlagHierarchyDeep(); |
|
|
| |
| |
| |
|
|
| [DispId(22)] |
| int EnumerationFlagHierarchyShallow(); |
|
|
| |
| |
| |
|
|
| [DispId(23)] |
| int EnumerationFlagHierarchyDeepBasePropsOnly(); |
|
|
| |
| |
| |
|
|
| [DispId(24)] |
| int EnumerationFlagReturnObject(); |
|
|
| |
| |
| |
| [DispId(28)] |
| int EnumerationFlagAssociationInstance(); |
|
|
| |
| |
| |
| [DispId(29)] |
| int EnumerationFlagAssociatedInstance(); |
| } |
| #endregion IWsManEx |
|
|
| #region IWsManResourceLocator |
|
|
| |
| [SuppressMessage("Microsoft.Design", "CA1040:AvoidEmptyInterfaces")] |
|
|
| [SuppressMessage("Microsoft.Design", "CA1056:UriPropertiesShouldNotBeStrings")] |
|
|
| [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Sel")] |
|
|
| [Guid("A7A1BA28-DE41-466A-AD0A-C4059EAD7428")] |
| [ComImport] |
| [TypeLibType((short)4288)] |
| #if CORECLR |
| [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] |
| #else |
| [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)] |
| #endif |
|
|
| public interface IWSManResourceLocator |
| { |
| #if CORECLR |
| [return: MarshalAs(UnmanagedType.IUnknown)] |
| object GetTypeInfoCount(); |
|
|
| [return: MarshalAs(UnmanagedType.IUnknown)] |
| object GetTypeInfo(); |
|
|
| [return: MarshalAs(UnmanagedType.IUnknown)] |
| object GetIDsOfNames(); |
|
|
| [return: MarshalAs(UnmanagedType.IUnknown)] |
| object Invoke(); |
| #endif |
| |
| |
| |
| |
| [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "resource")] |
| [SuppressMessage("Microsoft.Design", "CA1056:UriPropertiesShouldNotBeStrings")] |
| string ResourceUri |
| { |
| |
| [SuppressMessage("StyleCop.CSharp.OrderingRules", "SA1212:PropertyAccessorsMustFollowOrder", Justification = "COM interface defines put_ before get_.")] |
| [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "resource")] |
| [SuppressMessage("Microsoft.Design", "CA1056:UriPropertiesShouldNotBeStrings")] |
| [DispId(1)] |
| set; |
|
|
| |
| [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "resource")] |
| [SuppressMessage("Microsoft.Design", "CA1056:UriPropertiesShouldNotBeStrings")] |
| [DispId(1)] |
| [return: MarshalAs(UnmanagedType.BStr)] |
| get; |
| } |
|
|
| |
| |
| |
| |
|
|
| [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "resource")] |
| [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "sel")] |
| [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Sel")] |
| [DispId(2)] |
| void AddSelector([MarshalAs(UnmanagedType.BStr)] string resourceSelName, object selValue); |
|
|
| |
| |
| |
| |
|
|
| [DispId(3)] |
| void ClearSelectors(); |
|
|
| |
| |
| |
| |
|
|
| string FragmentPath |
| { |
| |
|
|
| [DispId(4)] |
| [return: MarshalAs(UnmanagedType.BStr)] |
| get; |
| |
|
|
| [DispId(4)] |
| set; |
| } |
|
|
| |
| |
| |
| |
|
|
| string FragmentDialect |
| { |
| |
|
|
| [DispId(5)] |
| [return: MarshalAs(UnmanagedType.BStr)] |
| get; |
| |
|
|
| [DispId(5)] |
| set; |
| } |
|
|
| |
| |
| |
| |
| [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "Option")] |
| [DispId(6)] |
| void AddOption([MarshalAs(UnmanagedType.BStr)] string OptionName, object OptionValue, int mustComply); |
|
|
| |
| |
| |
| |
|
|
| int MustUnderstandOptions |
| { |
| |
|
|
| [SuppressMessage("StyleCop.CSharp.OrderingRules", "SA1212:PropertyAccessorsMustFollowOrder", Justification = "COM interface defines put_ before get_.")] |
| [DispId(7)] |
| set; |
|
|
| |
|
|
| [DispId(7)] |
| get; |
| } |
|
|
| |
| |
| |
| |
|
|
| [DispId(8)] |
| void ClearOptions(); |
|
|
| |
| |
| |
|
|
| [SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Error")] |
| string Error |
| { |
| |
|
|
| [SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Error")] |
| [DispId(9)] |
| [SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Error")] |
| [return: MarshalAs(UnmanagedType.BStr)] |
| get; |
| } |
| } |
| #endregion IWsManResourceLocator |
|
|
| #region IWSManSession |
| |
| [Guid("FC84FC58-1286-40C4-9DA0-C8EF6EC241E0")] |
| [ComImport] |
| [TypeLibType((short)4288)] |
| #if CORECLR |
| [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] |
| #else |
| [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)] |
| #endif |
|
|
| [SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Error")] |
| [SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get")] |
| [SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings", MessageId = "0#")] |
| [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "URI")] |
| public interface IWSManSession |
| { |
| #if CORECLR |
| [return: MarshalAs(UnmanagedType.IUnknown)] |
| object GetTypeInfoCount(); |
|
|
| [return: MarshalAs(UnmanagedType.IUnknown)] |
| object GetTypeInfo(); |
|
|
| [return: MarshalAs(UnmanagedType.IUnknown)] |
| object GetIDsOfNames(); |
|
|
| [return: MarshalAs(UnmanagedType.IUnknown)] |
| object Invoke(); |
| #endif |
|
|
| |
| |
| |
|
|
| [SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get")] |
| [DispId(1)] |
| [return: MarshalAs(UnmanagedType.BStr)] |
| string Get(object resourceUri, int flags); |
|
|
| |
| |
| |
|
|
| [DispId(2)] |
| [return: MarshalAs(UnmanagedType.BStr)] |
| string Put(object resourceUri, [MarshalAs(UnmanagedType.BStr)] string resource, int flags); |
|
|
| |
| |
| |
|
|
| [DispId(3)] |
| [return: MarshalAs(UnmanagedType.BStr)] |
| string Create(object resourceUri, [MarshalAs(UnmanagedType.BStr)] string resource, int flags); |
|
|
| |
| |
| |
|
|
| [DispId(4)] |
| void Delete(object resourceUri, int flags); |
|
|
| |
| |
| |
| |
| |
| |
| |
| [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "URI")] |
| [SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings", MessageId = "0#")] |
| [DispId(5)] |
| string Invoke([MarshalAs(UnmanagedType.BStr)] string actionURI, [In] object resourceUri, [MarshalAs(UnmanagedType.BStr)] string parameters, [In] int flags); |
|
|
| |
| |
| |
|
|
| [DispId(6)] |
| #if CORECLR |
| [return: MarshalAs(UnmanagedType.IUnknown)] |
| #else |
| [return: MarshalAs(UnmanagedType.IDispatch)] |
| #endif |
| object Enumerate(object resourceUri, [MarshalAs(UnmanagedType.BStr)] string filter, [MarshalAs(UnmanagedType.BStr)] string dialect, int flags); |
|
|
| |
| |
| |
|
|
| [DispId(7)] |
| [return: MarshalAs(UnmanagedType.BStr)] |
| string Identify(int flags); |
|
|
| |
| |
| |
|
|
| [SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Error")] |
| string Error |
| { |
| |
|
|
| [SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Error")] |
| [DispId(8)] |
| [return: MarshalAs(UnmanagedType.BStr)] |
| get; |
| } |
|
|
| |
| |
| |
|
|
| int BatchItems |
| { |
| |
|
|
| [DispId(9)] |
| get; |
| |
|
|
| [DispId(9)] |
| set; |
| } |
|
|
| |
| |
| |
|
|
| int Timeout |
| { |
| |
|
|
| [DispId(10)] |
| get; |
| |
|
|
| [DispId(10)] |
| set; |
| } |
| } |
|
|
| #endregion IWSManSession |
|
|
| #region IWSManResourceLocatorInternal |
| |
| [Guid("EFFAEAD7-7EC8-4716-B9BE-F2E7E9FB4ADB")] |
| [ComImport] |
| [TypeLibType((short)400)] |
| #if CORECLR |
| [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] |
| #else |
| [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)] |
| #endif |
| [SuppressMessage("Microsoft.Design", "CA1040:AvoidEmptyInterfaces")] |
| public interface IWSManResourceLocatorInternal |
| { |
| #if CORECLR |
| [return: MarshalAs(UnmanagedType.IUnknown)] |
| object GetTypeInfoCount(); |
|
|
| [return: MarshalAs(UnmanagedType.IUnknown)] |
| object GetTypeInfo(); |
|
|
| [return: MarshalAs(UnmanagedType.IUnknown)] |
| object GetIDsOfNames(); |
|
|
| [return: MarshalAs(UnmanagedType.IUnknown)] |
| object Invoke(); |
| #endif |
| } |
|
|
| #endregion IWSManResourceLocatorInternal |
|
|
| |
| [Guid("BCED617B-EC03-420b-8508-977DC7A686BD")] |
| [ComImport] |
| #if CORECLR |
| [ClassInterface(ClassInterfaceType.None)] |
| #else |
| [ClassInterface(ClassInterfaceType.AutoDual)] |
| #endif |
| public class WSManClass |
| { |
| } |
|
|
| #region IGroupPolicyObject |
|
|
| |
| [Guid("EA502722-A23D-11d1-A7D3-0000F87571E3")] |
| [ComImport] |
| [ClassInterface(ClassInterfaceType.None)] |
| public class GPClass |
| { |
| } |
|
|
| [ComImport, Guid("EA502723-A23D-11d1-A7D3-0000F87571E3"), |
| InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] |
| internal interface IGroupPolicyObject |
| { |
| void New( |
| [MarshalAs(UnmanagedType.LPWStr)] string pszDomainName, |
| [MarshalAs(UnmanagedType.LPWStr)] string pszDisplayName, |
| uint dwFlags); |
|
|
| void OpenDSGPO( |
| [MarshalAs(UnmanagedType.LPWStr)] string pszPath, |
| uint dwFlags); |
|
|
| void OpenLocalMachineGPO(uint dwFlags); |
|
|
| void OpenRemoteMachineGPO( |
| [MarshalAs(UnmanagedType.LPWStr)] string pszComputerName, |
| uint dwFlags); |
|
|
| void Save( |
| [MarshalAs(UnmanagedType.Bool)] bool bMachine, |
| [MarshalAs(UnmanagedType.Bool)] bool bAdd, |
| [MarshalAs(UnmanagedType.LPStruct)] Guid pGuidExtension, |
| [MarshalAs(UnmanagedType.LPStruct)] Guid pGuid); |
|
|
| void Delete(); |
|
|
| void GetName( |
| [MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszName, |
| int cchMaxLength); |
|
|
| void GetDisplayName( |
| [MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszName, |
| int cchMaxLength); |
|
|
| void SetDisplayName( |
| [MarshalAs(UnmanagedType.LPWStr)] string pszName); |
|
|
| void GetPath( |
| [MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszPath, |
| int cchMaxPath); |
|
|
| void GetDSPath( |
| uint dwSection, |
| [MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszPath, |
| int cchMaxPath); |
|
|
| void GetFileSysPath( |
| uint dwSection, |
| [MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszPath, |
| int cchMaxPath); |
|
|
| IntPtr GetRegistryKey(uint dwSection); |
|
|
| uint GetOptions(); |
|
|
| void SetOptions(uint dwOptions, uint dwMask); |
|
|
| void GetMachineName( |
| [MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszName, |
| int cchMaxLength); |
|
|
| uint GetPropertySheetPages(out IntPtr hPages); |
| } |
|
|
| #endregion IGroupPolicyObject |
|
|
| |
| public sealed class GpoNativeApi |
| { |
| private GpoNativeApi() { } |
|
|
| [DllImport("Userenv.dll", CharSet = CharSet.Unicode, SetLastError = true)] |
| internal static extern System.IntPtr EnterCriticalPolicySection( |
| [In, MarshalAs(UnmanagedType.Bool)] bool bMachine); |
|
|
| [DllImport("Userenv.dll", CharSet = CharSet.Unicode, SetLastError = true)] |
| [return: MarshalAs(UnmanagedType.Bool)] |
| internal static extern bool LeaveCriticalPolicySection( |
| [In] System.IntPtr hSection); |
| } |
| #endregion |
| } |
|
|
| #pragma warning restore 1591 |
|
|