清除ssl状态C++
#include "stdafx.h"
#include "windows.h"
#include "tchar.h"
typedef BOOL (__stdcall * SSL_EMPTY_CACHE_FN_A) (LPSTR, DWORD);
typedef BOOL (__stdcall * SSL_EMPTY_CACHE_FN_W) (LPWSTR, DWORD);
typedef BOOL (__stdcall * INCREMENTURLCACHEHEADERDATA_FN) (DWORD, LPDWORD);
VOID ClearSslState(VOID)
{
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");
hWinInet = ::LoadLibrary(_T("WININET.DLL"));
if (hWinInet) pfnIncrementUrlCacheHeaderData = (INCREMENTURLCACHEHEADERDATA_FN) ::GetProcAddress(hWinInet, "IncrementUrlCacheHeaderData");
if (pfnSslEmptyCacheW) pfnSslEmptyCacheW (NULL, 0);
if (pfnIncrementUrlCacheHeaderData) pfnIncrementUrlCacheHeaderData(14, &dwData);
if (hSchannel)
FreeLibrary(hSchannel);
if (hWinInet)
FreeLibrary(hWinInet); }