• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Net.Interop类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Net.Interop的典型用法代码示例。如果您正苦于以下问题:C# Interop类的具体用法?C# Interop怎么用?C# Interop使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Interop类属于System.Net命名空间,在下文中一共展示了Interop类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: OperationReturnedSomething

 public void OperationReturnedSomething(string operation, Interop.SECURITY_STATUS errorCode)
 {
     if (IsEnabled())
     {
         WriteEvent(OperationReturnedSomethingId, operation, errorCode);
     }
 }
开发者ID:dotnet,项目名称:corefx,代码行数:7,代码来源:NetEventSource.Security.Windows.cs


示例2: InitializeSecurityContext

 public void InitializeSecurityContext(SafeFreeCredentials credential, SafeDeleteContext context, string targetName, Interop.SspiCli.ContextFlags inFlags)
 {
     if (IsEnabled())
     {
         InitializeSecurityContext(IdOf(credential), IdOf(context), targetName, inFlags);
     }
 }
开发者ID:dotnet,项目名称:corefx,代码行数:7,代码来源:NetEventSource.Security.Windows.cs


示例3: AcceptSecurityContext

 public void AcceptSecurityContext(SafeFreeCredentials credential, SafeDeleteContext context, Interop.SspiCli.ContextFlags inFlags)
 {
     if (IsEnabled())
     {
         AcceptSecurityContext(IdOf(credential), IdOf(context), inFlags);
     }
 }
开发者ID:dotnet,项目名称:corefx,代码行数:7,代码来源:NetEventSource.Security.Windows.cs


示例4: AcquireCredentialsHandle

 public void AcquireCredentialsHandle(string packageName, Interop.SspiCli.CredentialUse intent, object authdata)
 {
     if (IsEnabled())
     {
         AcquireCredentialsHandle(packageName, intent, IdOf(authdata));
     }
 }
开发者ID:dotnet,项目名称:corefx,代码行数:7,代码来源:NetEventSource.Security.Windows.cs


示例5: SetTimespanTimeout

        private void SetTimespanTimeout(Interop.HttpApi.HTTP_TIMEOUT_TYPE type, TimeSpan value)
        {
            Int64 timeoutValue;

            //
            // All timeouts are defined as USHORT in native layer (except MinSendRate, which is ULONG). Make sure that
            // timeout value is within range.
            //
            timeoutValue = Convert.ToInt64(value.TotalSeconds);

            if (timeoutValue < 0 || timeoutValue > ushort.MaxValue)
            {
                throw new ArgumentOutOfRangeException(nameof(value));
            }

            //
            // Use local state to get values for other timeouts. Call into the native layer and if that 
            // call succeeds, update local state.
            //

            int[] currentTimeouts = _timeouts;
            currentTimeouts[(int)type] = (int)timeoutValue;
            _listener.SetServerTimeout(currentTimeouts, _minSendBytesPerSecond);
            _timeouts[(int)type] = (int)timeoutValue;
        }
开发者ID:dotnet,项目名称:corefx,代码行数:25,代码来源:HttpListenerTimeoutManager.Windows.cs


示例6: AcquireDefaultCredential

 public void AcquireDefaultCredential(string packageName, Interop.SspiCli.CredentialUse intent)
 {
     if (IsEnabled())
     {
         WriteEvent(AcquireDefaultCredentialId, packageName, intent);
     }
 }
开发者ID:dotnet,项目名称:corefx,代码行数:7,代码来源:NetEventSource.Security.Windows.cs


示例7: GetTimeout

 private TimeSpan GetTimeout(Interop.HttpApi.HTTP_TIMEOUT_TYPE type)
 {
     //
     // Since we maintain local state, GET is local.
     //
     return new TimeSpan(0, 0, (int)_timeouts[(int)type]);
 }
开发者ID:dotnet,项目名称:corefx,代码行数:7,代码来源:HttpListenerTimeoutManager.Windows.cs


示例8: MicrosecondsToTimeValue

        private static void MicrosecondsToTimeValue(long microseconds, ref Interop.Winsock.TimeValue socketTime)
        {
            const int microcnv = 1000000;

            socketTime.Seconds = (int)(microseconds / microcnv);
            socketTime.Microseconds = (int)(microseconds % microcnv);
        }
开发者ID:vbouret,项目名称:corefx,代码行数:7,代码来源:SocketPal.Windows.cs


示例9: FillFdSetFromSocketList

        internal static int FillFdSetFromSocketList(ref Interop.Sys.FdSet fdset, IList socketList)
        {
            if (socketList == null || socketList.Count == 0)
            {
                return 0;
            }

            int maxFd = -1;
            for (int i = 0; i < socketList.Count; i++)
            {
                var socket = socketList[i] as Socket;
                if (socket == null)
                {
                    throw new ArgumentException(SR.Format(SR.net_sockets_select, socketList[i].GetType().FullName, typeof(System.Net.Sockets.Socket).FullName), "socketList");
                }

                int fd = socket._handle.FileDescriptor;
                fdset.Set(fd);

                if (fd > maxFd)
                {
                    maxFd = fd;
                }
            }

            return maxFd + 1;
        }
开发者ID:JonHanna,项目名称:corefx,代码行数:27,代码来源:Socket.Unix.cs


示例10: SecurityContextInputBuffers

 public void SecurityContextInputBuffers(string context, int inputBuffersSize, int outputBufferSize, Interop.SECURITY_STATUS errorCode)
 {
     if (IsEnabled())
     {
         WriteEvent(SecurityContextInputBuffersId, context, inputBuffersSize, outputBufferSize, (int)errorCode);
     }
 }
开发者ID:dotnet,项目名称:corefx,代码行数:7,代码来源:NetEventSource.Security.Windows.cs


示例11: CreateIPHostEntry

        private static unsafe IPHostEntry CreateIPHostEntry(Interop.Sys.HostEntry hostEntry)
        {
            string hostName = null;
            if (hostEntry.CanonicalName != null)
            {
                hostName = Marshal.PtrToStringAnsi((IntPtr)hostEntry.CanonicalName);
            }

            int numAddresses = hostEntry.IPAddressCount;

            IPAddress[] ipAddresses;
            if (numAddresses == 0)
            {
                ipAddresses = Array.Empty<IPAddress>();
            }
            else
            {
                ipAddresses = new IPAddress[numAddresses];

                void* addressListHandle = hostEntry.AddressListHandle;
                var nativeIPAddress = default(Interop.Sys.IPAddress);
                for (int i = 0; i < numAddresses; i++)
                {
                    int err = Interop.Sys.GetNextIPAddress(&hostEntry, &addressListHandle, &nativeIPAddress);
                    Debug.Assert(err == 0);

                    ipAddresses[i] = nativeIPAddress.GetIPAddress();
                }
            }

            int numAliases;
            for (numAliases = 0; hostEntry.Aliases[numAliases] != null; numAliases++)
            {
            }

            string[] aliases;
            if (numAliases == 0)
            {
                aliases = Array.Empty<string>();
            }
            else
            {
                aliases = new string[numAliases];
                for (int i = 0; i < numAliases; i++)
                {
                    Debug.Assert(hostEntry.Aliases[i] != null);
                    aliases[i] = Marshal.PtrToStringAnsi((IntPtr)hostEntry.Aliases[i]);
                }
            }

            Interop.Sys.FreeHostEntry(&hostEntry);

            return new IPHostEntry
            {
                HostName = hostName,
                AddressList = ipAddresses,
                Aliases = aliases
            };
        }
开发者ID:noahfalk,项目名称:corefx,代码行数:59,代码来源:NameResolutionPal.Unix.cs


示例12: SslConnectionInfo

 internal SslConnectionInfo(Interop.libssl.SSL_CIPHER cipher)
 {
     Protocol = (int) MapProtocol(cipher.algorithm_ssl);
     DataCipherAlg = (int) MapCipherAlgorithmType(cipher.algorithm_enc);
     KeyExchangeAlg = (int) MapExchangeAlgorithmType(cipher.algorithm_mkey);
     DataHashAlg = (int) MapHashAlgorithmType(cipher.algorithm_mac);
     // TODO: map key sizes
 }
开发者ID:TAdityaAnirudh,项目名称:corefx,代码行数:8,代码来源:SslConnectionInfo.cs


示例13: SslConnectionInfo

 internal SslConnectionInfo(Interop.libssl.SSL_CIPHER cipher, string protocol)
 {
     Protocol = (int) MapProtocolVersion(protocol);
     DataCipherAlg = (int) MapCipherAlgorithmType((Interop.libssl.CipherAlgorithm) cipher.algorithm_enc);
     KeyExchangeAlg = (int) MapExchangeAlgorithmType((Interop.libssl.KeyExchangeAlgorithm) cipher.algorithm_mkey);
     DataHashAlg = (int) MapHashAlgorithmType((Interop.libssl.DataHashAlgorithm) cipher.algorithm_mac);
     DataKeySize = cipher.alg_bits;
     // TODO (Issue #3362) map key sizes
 }
开发者ID:vbouret,项目名称:corefx,代码行数:9,代码来源:SslConnectionInfo.cs


示例14: CreateHostEntry

        private static unsafe IPHostEntry CreateHostEntry(Interop.libc.hostent* hostent)
        {
            string hostName = null;
            if (hostent->h_name != null)
            {
                hostName = Marshal.PtrToStringAnsi((IntPtr)hostent->h_name);
            }

            int numAddresses;
            for (numAddresses = 0; hostent->h_addr_list[numAddresses] != null; numAddresses++)
            {
            }

            IPAddress[] ipAddresses;
            if (numAddresses == 0)
            {
                ipAddresses = Array.Empty<IPAddress>();
            }
            else
            {
                ipAddresses = new IPAddress[numAddresses];
                for (int i = 0; i < numAddresses; i++)
                {
                    Debug.Assert(hostent->h_addr_list[i] != null);
                    ipAddresses[i] = new IPAddress(*(int*)hostent->h_addr_list[i]);
                }
            }

            int numAliases;
            for (numAliases = 0; hostent->h_aliases[numAliases] != null; numAliases++)
            {
            }

            string[] aliases;
            if (numAliases == 0)
            {
                aliases = Array.Empty<string>();
            }
            else
            {
                aliases = new string[numAliases];
                for (int i = 0; i < numAliases; i++)
                {
                    Debug.Assert(hostent->h_aliases[i] != null);
                    aliases[i] = Marshal.PtrToStringAnsi((IntPtr)hostent->h_aliases[i]);
                }
            }

            return new IPHostEntry
            {
                HostName = hostName,
                AddressList = ipAddresses,
                Aliases = aliases
            };
        }
开发者ID:nblumhardt,项目名称:corefx,代码行数:55,代码来源:NameResolutionPal.Unix.cs


示例15: GetSecurityStatusPalFromInterop

        internal static SecurityStatusPal GetSecurityStatusPalFromInterop(Interop.SecurityStatus win32SecurityStatus)
        {
            SecurityStatusPalErrorCode statusCode;

            if (!s_statusDictionary.TryGetForward(win32SecurityStatus, out statusCode))
            {
                Debug.Fail("Unknown Interop.SecurityStatus value: " + win32SecurityStatus);
                throw new InternalException();
            }
            return new SecurityStatusPal(statusCode);
        }
开发者ID:ESgarbi,项目名称:corefx,代码行数:11,代码来源:SecurityStatusAdapterPal.Windows.cs


示例16: EncryptMessage

        public int EncryptMessage(SafeDeleteContext context, Interop.Secur32.SecurityBufferDescriptor inputOutput, uint sequenceNumber)
        {
            int status = (int)Interop.SecurityStatus.InvalidHandle;
            bool ignore = false;

            context.DangerousAddRef(ref ignore);
            status = Interop.Secur32.EncryptMessage(ref context._handle, 0, inputOutput, sequenceNumber);
            context.DangerousRelease();

            return status;
        }
开发者ID:nnyamhon,项目名称:corefx,代码行数:11,代码来源:SSPIAuthType.cs


示例17: BaseConstruction

 // Must call this from derived class' constructors.
 protected void BaseConstruction(Interop.HttpApi.HTTP_REQUEST* requestBlob)
 {
     if (requestBlob == null)
     {
         GC.SuppressFinalize(this);
     }
     else
     {
         _memoryBlob = requestBlob;
     }
 }
开发者ID:dotnet,项目名称:corefx,代码行数:12,代码来源:RequestContextBase.cs


示例18: GetContextFlagsPalFromInterop

        internal static ContextFlagsPal GetContextFlagsPalFromInterop(Interop.NetSecurityNative.GssFlags gssFlags)
        {
            ContextFlagsPal flags = ContextFlagsPal.None;
            foreach (ContextFlagMapping mapping in s_contextFlagMapping)
            {
                if ((gssFlags & mapping.GssFlags) == mapping.GssFlags)
                {
                    flags |= mapping.ContextFlag;
                }
            }

            return flags;
        }
开发者ID:SGuyGe,项目名称:corefx,代码行数:13,代码来源:ContextFlagsAdapterPal.Unix.cs


示例19: AcquireCredentialsHandle

 internal static void AcquireCredentialsHandle(string packageName, Interop.Secur32.CredentialUse intent, object authdata)
 {
     if (!s_log.IsEnabled())
     {
         return;
     }
     string arg1Str = "";
     if (packageName != null)
     {
         arg1Str = packageName;
     }
     s_log.AcquireCredentialsHandle(arg1Str, intent, LoggingHash.GetObjectName(authdata));
 }
开发者ID:noahfalk,项目名称:corefx,代码行数:13,代码来源:SecurityEventSource.Windows.cs


示例20: EncryptMessage

 public int EncryptMessage(SafeDeleteContext context, Interop.SspiCli.SecBufferDesc inputOutput, uint sequenceNumber)
 {
     try
     {
         bool ignore = false;
         context.DangerousAddRef(ref ignore);
         return Interop.SspiCli.EncryptMessage(ref context._handle, 0, inputOutput, sequenceNumber);
     }
     finally
     {
         context.DangerousRelease();
     }
 }
开发者ID:naamunds,项目名称:corefx,代码行数:13,代码来源:SSPISecureChannelType.cs



注:本文中的System.Net.Interop类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Net.NetworkCredential类代码示例发布时间:2022-05-26
下一篇:
C# Net.IPHostEntry类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap