Leo

软件编程技术

导航

清除ssl状态C++6.0[原创:经过测试成功]

Posted on 2013-03-14 08:31  Leo(binbin)  阅读(1046)  评论(0编辑  收藏  举报

清除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); }

点击这里给我发消息