WEB开发网
开发学院软件开发VC VC中实现历史记录的全面清除 阅读

VC中实现历史记录的全面清除

 2009-10-15 20:31:28 来源:WEB开发网   
核心提示:2、Cookie的清除TCHAR szPath[MAX_PATH];DeleteUrlCache(Cookie);if (SHGetSpecialFolderPath(NULL, szPath, CSIDL_COOKIES, FALSE)){//得到目录,并清空 EmptyDirectory(szPath);}3、浏览

2、Cookie的清除

TCHAR szPath[MAX_PATH];
DeleteUrlCache(Cookie);
if (SHGetSpecialFolderPath(NULL, szPath, CSIDL_COOKIES, FALSE))
{//得到目录,并清空
   EmptyDirectory(szPath);
}

3、浏览器地址栏历史地址的清除

SHDeleteKey(HKEY_CURRENT_USER,
  _T("Software\\Microsoft\\Internet Explorer\\TypedURLs"));

4、清除表单自动完成历史记录

CString sKey;
DWORD dwRet;
if (IsWindows2k() || IsWindowsNT())//先判断系统
{
CString sBaseKey;
SECURITY_DESCRIPTOR NewSD;
BYTE* pOldSD;
PACL pDacl = NULL;
PSID pSid = NULL;
TCHAR szSid[256];
if (GetUserSid(&pSid))
{
//get the hiden key name
GetSidString(pSid, szSid);
sKey = _T("Software\\Microsoft\\Protected Storage System Provider\\");
sKey += szSid;
//get old SD
sBaseKey = sKey;
GetOldSD(HKEY_CURRENT_USER, sBaseKey, &pOldSD);
//set new SD and then clear
if (CreateNewSD(pSid, &NewSD, &pDacl))
{
RegSetPrivilege(HKEY_CURRENT_USER, sKey, &NewSD, FALSE);
sKey += _T("\\Data");
RegSetPrivilege(HKEY_CURRENT_USER, sKey, &NewSD, FALSE);
sKey += _T("\\e161255a-37c3-11d2-bcaa-00c04fd929db");
RegSetPrivilege(HKEY_CURRENT_USER, sKey, &NewSD, TRUE);
dwRet = SHDeleteKey(HKEY_CURRENT_USER, sKey);
}
if (pDacl != NULL)
HeapFree(GetProcessHeap(), 0, pDacl);
//restore old SD
if (pOldSD)
{
RegSetPrivilege(HKEY_CURRENT_USER, sBaseKey,
(SECURITY_DESCRIPTOR*)pOldSD, FALSE);
delete pOldSD;
}
}
if (pSid)
HeapFree(GetProcessHeap(), 0, pSid);
}
//win9x
DWORD dwSize = MAX_PATH;
TCHAR szUserName[MAX_PATH];
GetUserName(szUserName, &dwSize);
sKey = _T("Software\\Microsoft\\Protected Storage System Provider\\");
sKey += szUserName;
sKey += _T("\\Data\\e161255a-37c3-11d2-bcaa-00c04fd929db");
dwRet = SHDeleteKey(HKEY_LOCAL_MACHINE, sKey);

5、清除自动密码历史记录

SHDeleteKey(HKEY_CURRENT_USER,
    _T("Software\\Microsoft\\Internet Explorer\\IntelliForms"));

上一页  1 2 3 4  下一页

Tags:VC 实现 历史

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接