在WinXP+sp2下的IE有一个选项:“清除SSL状态”,如何编程实现它SslEmptyCacheA 这个函数试过了 没用
解决方案 »
- CFormView初始化问题,我在OnInitialUpdate中发送一个消息,这个消息的处理的禁用CFromView窗口上的某些控件,但是出错...。
- 为什么用HtmlHelp函数调出Context Help窗口,再点击对话框其它部分,使弹出的窗口消失,只要一点击就会报错??
- 请问listctrl控件怎么直接编辑啊?
- 请教:有关TRACE宏的问题?谢谢
- 请大家指点
- 如何锁定键盘和鼠标
- msdn2003 不能安装,有人遇到过吗,如何解决
- 如何比较两幅bmp格式的人脸图象?
- 请教大侠:DLL的中函数的参数类型。
- MFC怎么让编辑框多行显示文本内容!!!!
- 100分 求助vc6.0下图像合成实现 进者有分
- 一个线程在默认的情况下有几个栈?
SslEmptyCacheA(NULL,0)This function has no associated import library. You must use the LoadLibrary and GetProcAddress functions to dynamically link to Schannel.dll.
请问0&是什么?
我用了SslEmptyCacheA(0,0) SslEmptyCacheA(NULL,NULL)
都不行
1、如果失败,报什么错?是不是参数pszTargetName有问题。
2、如果成功,尝试再调用一次SslEmptyCache,看结果如何?
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);
}
}}
谁知道我错在哪里
pDelSSL DelSSL;
HINSTANCE hdll = NULL;
hdll = LoadLibrary("Schannel.dll");
if (hdll != NULL)
{
if((DelSSL = (pDelSSL)GetProcAddress(hdll, _T("SslEmptyCacheA"))) == NULL)
{
//MessageBox("加载函数失败");
}
}
DelSSL(NULL,0);返回值是1
typedef BOOL (CALLBACK *pDelSSL)(LPSTR pszTargetName,DWORD dwFlags);
pDelSSL DelSSL;
HINSTANCE hdll = NULL;
hdll = LoadLibrary("Schannel.dll");
if (hdll != NULL)
{
if((DelSSL = (pDelSSL)GetProcAddress(hdll, _T("SslEmptyCacheA"))) == NULL)
{
//MessageBox("加载函数失败");
}
}
BOOL A = DelSSL(NULL,0);
我这样写有问题吗?
也是不行。我再详细说明一下吧 网上银行的USBKEY的证书登录使用了IE的SSL 在没有清空SSL前,IE会保留SSL状态,导致其他的USBKEY无法正常使用。
我的程序里使用了微软的IE控件CWebBrowser2。
现在即使我使用动态的CWebBrowser2,把控件的指针DELETE掉重新CREATE,也无法清空SSL状态,如果是普通的IE,关掉重新打开后SSL状态则自动清除。
请问大家有什么高见。
Server :Requires Windows Server 2003, Windows 2000 Server, or Windows NT Server 4.0. 以上是该接口SslEmptyCache的应用需求,你的服务器和客户端是否符合要求?
另外,如果DelSSL(NULL,0)的第一个参数指定的话,是什么结果?
2.如果我想清除网银证书的SSL,第一个参数应该指定为什么?另外,我现在还在疑惑为什么我吧控件的内存都释放了重开,SSL状态还在保留?SSL状态是否保留在程序的进程里的?难道要我把应用程序关闭重开才可以吗?
我的程序里使用了微软的IE控件CWebBrowser2。
现在即使我使用动态的CWebBrowser2,把控件的指针DELETE掉重新CREATE,也无法清空SSL状态,如果是普通的IE,关掉重新打开后SSL状态则自动清除。
请问大家有什么高见。
正常登录成功后 执行了动态释放IE控件内存后 执行SslEmptyCache 不插KEY不能正常登录 但无法显示网页,之后正常插入KEY后,仍无法登录,好像是SSL的缓存清空了,没有断开SSL连接,始终保持着没有证书的状态。
另外,登录失败后,即使插KEY, 也不能正常登录。
既然ssl状态已经异常,那么其他的key能用了吗?
其他的KEY同样不能使用
解决办法详见http://emuio.com/
button does. In addition to calling SslEmptyCache — (with parameters (NULL,
0) I believe, but I have no idea what effect it has) — the “Clear SSL
State” button tells WinInet (via an undocumented API call) to unload its
in-memory client certificate cache. There are a couple things you can try to
get WinInet to discard its in-memory certificate cache (in addition to
calling SslEmptyCache):
1. The “brute-force” solution is to close all your WinInet handles,
dynamically unload WinInet.dll using FreeLibary, and then reload the DLL.
This requires that you dynamically link to the WinInet API. This solution
will not work if there are other components within the process that also
have WinInet loaded (since their references to WinInet will keep the DLL
loaded in memory).
2. The “it might work” solution is to close all your WinInet handles and
call InternetSetOption(NULL, INTERNET_OPTION_END_BROWSER_SESSION, 0, 0).
This will cause WinInet to discard any cached socket connections and will
force subsequent HTTPS requests to renegotiate the SSL connection. However,
WinInet will probably still have a client certificate cached in-memory. If
you need to use a different client certificate and know which certificate,
then before calling HttpSendRequest supply the certificate by setting the
INTERNET_OPTION_CLIENT_CERT_CONTEXT option on the request handle.
Yet another solution to consider is using the WinHTTP API instead of
WinInet. WinHTTP is an API similar to WinInet; it supports multi-user
scenarios much better than WinInet, and this SSL caching problem can also be
avoided. WinHTTP is available on Windows 2000 SP3/SP4, Windows XP SP1 and
Windows Server 2003.
h_wininetDLL = LoadLibrary(”wininet.dll”);
h_Increment = (Function)GetProcAddressh_wininetDLL,”IncrementUrlCacheHeaderData”);
DWORD buf;
h_Increment(14,(DWORD)&buf);