资源简介
安全等级 添加网站列表 弹出窗口 设置代理服务器 C++,IE浏览器的一些常规设置,主要是找到对应的注册表,全部在IE11实践成功。
如果没有积分,请私信我留下邮箱,我会尽快发过去
代码片段和文件信息
// localInternet.cpp : Defines the entry point for the console application.
//
#include “stdafx.h“
#include
#include
#include
#include
#include
#include
using namespace std;
#pragma comment(lib“wininet.lib“)//InternetSetOption 函数使用
void SetValue()//设置安全等级等的值,第一步
{
DWORD dwtype sl = 256;
int sz[256];
HKEY hKeyResult = NULL;
string strUrl = “Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\Zones\\3“;//安全级别
//string strUrl = “Software\\Microsoft\\Internet Explorer\\New Windows“;//组织弹出 PopupMgr
//string strUrl = “Software\\Microsoft\\Internet Explorer\\Download“;//允许运行或安装软件,即使签名无效 RunInvalidSignatures 第四步
if(ERROR_SUCCESS == ::RegOpenKeyEx(HKEY_CURRENT_USER strUrl.c_str() 0 KEY_ALL_ACCESS &hKeyResult))
{
printf(“RegOpenKeyEx success!\n“);
}
if(ERROR_SUCCESS ==RegQueryValueEx(hKeyResult “CurrentLevel“ NULL &dwtype (LPBYTE)sz &sl))
{
printf(“RegQueryValueEx success!\n“);
}
//12000级别为高,十进制73728;11500,十进制70912;11000,十进制69632
DWORD m_newValue = 73728;//设置需要进行改变的值;
if(ERROR_SUCCESS ==RegSetValueEx(hKeyResult “CurrentLevel“ NULLREG_DWORD(unsigned char*)&m_newValuesizeof(DWORD)))
{
printf(“RegSetValueEx success!\n“);
}
RegCloseKey(hKeyResult);
}
int __stdcall GetCountOfSite()//选择受信任站点
{
int iRet = 0;
CString str strTemp;
str.Format(“%d“iRet+1);
CString strKeyName = “Range“ + str;
HKEY hKEY;
HKEY hKeyRoot = HKEY_CURRENT_USER;
LPCTSTR lp = “Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ZoneMap\\Ranges\\“;
while(::RegOpenKeyEx(hKeyRoot lp + strKeyName 0 KEY_READ &hKEY) == ERROR_SUCCESS)//如果无法打开hKEY则中止程序的执行
{
++iRet;
str.Format(“%d“iRet+1);
strKeyName = “Range“ + str;
}
::RegCloseKey(hKEY);
return iRet;
}
void AddSite()//添加受信任的站点的网站列表
{
CString strSite = “https://0000“; //此处即为需要添加的网站地址
int iIndex = strSite.Find(“:“);
CString strIp = strSite.Mid(iIndex+3);
CString strHead = strSite.Left(iIndex+3);
if (((strHead == “http://“) || (strHead == “https://“)))
{
//查找注册表Index
int iCount = GetCountOfSite();
//插入注册表
DWORD dwData = 2;
CString str strTemp;
str.Format(“%d“iCount+1);
CString strKeyName = “Range“ + str;
DWORD dwTemp;
HKEY hKEY;
HKEY hKeyRoot = HKEY_CURRENT_USER;
LPCTSTR lp = “Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ZoneMap\\Ranges\\“;
if(::RegCreateKeyEx(hKeyRoot lp + strKeyName 0 REG_NONE REG_OPTION_NON_VOLATILE KEY_ALL_ACCESS NULL &hKEY &dwTemp) == ERROR_SUCCESS)
{
::RegSetValueEx(hKEY “:Range“ 0 REG_SZ (BYTE*)strIp.GetBuffer() strIp.GetLength());
::RegSetValueEx(hKEY (strHead.Left(strHead.Find(“:“))).GetBuffer() 0 REG_DWORD (BYTE*)&dwData sizeof(DWORD));
}
::RegCloseKey(hKEY);
}
}
void SetValuePop()//设置弹出窗口阻止程序
{
DWORD dwtype sl = 256;
int sz[256];
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-05-09 10:21 localInternet\
目录 0 2018-05-09 10:01 localInternet\Debug\
文件 103936 2018-05-09 10:02 localInternet\Debug\localInternet.exe
文件 689732 2018-05-09 10:02 localInternet\Debug\localInternet.ilk
文件 1272832 2018-05-09 10:02 localInternet\Debug\localInternet.pdb
目录 0 2018-05-09 10:21 localInternet\Release\
文件 17920 2018-05-09 10:21 localInternet\Release\localInternet.exe
文件 650240 2018-05-09 10:21 localInternet\Release\localInternet.pdb
目录 0 2018-05-09 10:21 localInternet\localInternet\
目录 0 2018-05-09 10:02 localInternet\localInternet\Debug\
文件 7402 2018-05-09 10:02 localInternet\localInternet\Debug\BuildLog.htm
文件 663 2018-05-09 10:01 localInternet\localInternet\Debug\localInternet.exe.em
文件 728 2018-05-09 10:01 localInternet\localInternet\Debug\localInternet.exe.em
文件 621 2018-05-09 10:02 localInternet\localInternet\Debug\localInternet.exe.intermediate.manifest
文件 203133 2018-05-09 10:02 localInternet\localInternet\Debug\localInternet.obj
文件 4128768 2018-05-09 10:01 localInternet\localInternet\Debug\localInternet.pch
文件 67 2018-05-09 10:02 localInternet\localInternet\Debug\mt.dep
文件 11797 2018-05-09 10:01 localInternet\localInternet\Debug\stdafx.obj
文件 592896 2018-05-09 10:02 localInternet\localInternet\Debug\vc90.idb
文件 520192 2018-05-09 10:02 localInternet\localInternet\Debug\vc90.pdb
文件 1338 2018-05-09 09:23 localInternet\localInternet\ReadMe.txt
目录 0 2018-05-09 10:21 localInternet\localInternet\Release\
文件 8670 2018-05-09 10:21 localInternet\localInternet\Release\BuildLog.htm
文件 616 2018-05-09 10:21 localInternet\localInternet\Release\localInternet.exe.intermediate.manifest
文件 1161123 2018-05-09 10:21 localInternet\localInternet\Release\localInternet.obj
文件 4128768 2018-05-09 10:21 localInternet\localInternet\Release\localInternet.pch
文件 67 2018-05-09 10:21 localInternet\localInternet\Release\mt.dep
文件 67805 2018-05-09 10:21 localInternet\localInternet\Release\stdafx.obj
文件 232448 2018-05-09 10:21 localInternet\localInternet\Release\vc90.idb
文件 421888 2018-05-09 10:21 localInternet\localInternet\Release\vc90.pdb
文件 6233 2018-05-09 10:21 localInternet\localInternet\localInternet.cpp
............此处省略8个文件信息
- 上一篇:传智博客-ob
jective-C PPT - 下一篇:图片切割工具
评论
共有 条评论