VC清除SSL缓存源码实现

VC清除SSL源码 :

DWORD ClearSslState()
{
SSL_EMPTY_CACHE_FN_A            pfnSslEmptyCacheA              = NULL;
SSL_EMPTY_CACHE_FN_W            pfnSslEmptyCacheW              = NULL;
INCREMENTURLCACHEHEADERDATA_FN  pfnIncrementUrlCacheHeaderData = NULL;
HMODULE hSchannel;
HMODULE hWinInet;
DWORD dwData;
hSchannel = ::LoadLibrary(_T(“SCHANNEL.DLL”));
if (hSchannel)
pfnSslEmptyCacheW =(SSL_EMPTY_CACHE_FN_W)GetProcAddress(hSchannel, “SslEmptyCacheW”);
if (hSchannel)
pfnSslEmptyCacheA =(SSL_EMPTY_CACHE_FN_A)GetProcAddress(hSchannel, “SslEmptyCacheA”);
hWinInet = ::LoadLibrary(_T(“WININET.DLL”));
if (hWinInet)
pfnIncrementUrlCacheHeaderData =(INCREMENTURLCACHEHEADERDATA_FN)GetProcAddress(hWinInet, “IncrementUrlCacheHeaderData”);
try{
if (pfnSslEmptyCacheA)
pfnSslEmptyCacheA (NULL, 0);
if (pfnSslEmptyCacheW)
pfnSslEmptyCacheW (NULL, 0);
if (pfnIncrementUrlCacheHeaderData)
pfnIncrementUrlCacheHeaderData(14, &dwData);
}
catch(…)
{

}
if (hSchannel)
FreeLibrary(hSchannel);
if (hWinInet)
FreeLibrary(hWinInet);
return TRUE;
}

原创文章,转载请注明: 转载自IT Code

本文链接地址: VC清除SSL缓存源码实现

VC清除SSL缓存源码实现:等您坐沙发呢!

发表评论

快捷键:Ctrl+Enter