如何用SslEmptyCache系统API来清除SSL状态

bo18 2011-12-02 10:40:43
using System;
using System.Runtime.InteropServices;

namespace Demo
{
public class Ssl
{
[DllImport("kernel32.dll")]
internal static extern IntPtr LoadLibrary(String dllname);

[DllImport("kernel32.dll")]
internal static extern IntPtr GetProcAddress(IntPtr hModule, String procname);

internal delegate bool SslEmptyCacheHelper(IntPtr targetName, int flags);

/// <summary>
/// UNICODE版
/// </summary>
/// <returns></returns>
public bool SslEmptyCacheW()
{
IntPtr schannel = LoadLibrary("Schannel.dll");
IntPtr procaddr = GetProcAddress(schannel, "SslEmptyCacheW");
SslEmptyCacheHelper helper = (SslEmptyCacheHelper)Marshal.GetDelegateForFunctionPointer(procaddr, typeof(SslEmptyCacheHelper));
return helper(IntPtr.Zero, 0);
}

/// <summary>
/// ANSI版
/// </summary>
/// <returns></returns>
public bool SslEmptyCacheA()
{
IntPtr schannel = LoadLibrary("Schannel.dll");
IntPtr procaddr = GetProcAddress(schannel, "SslEmptyCacheA");
SslEmptyCacheHelper helper = (SslEmptyCacheHelper)Marshal.GetDelegateForFunctionPointer(procaddr, typeof(SslEmptyCacheHelper));
return helper(IntPtr.Zero, 0);
}
}

}

c#的 如何改成vb.net
...全文
149 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
段传涛 2011-12-02
  • 打赏
  • 举报
回复
既然有代码了,按照格式复制一遍吧。
bo18 2011-12-02
  • 打赏
  • 举报
回复
没人要分?

16,552

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧