曲径通幽论坛

 找回密码
 立即注册
搜索
查看: 2590|回复: 0
打印 上一主题 下一主题

修复被篡改的 IE 首页

[复制链接]

716

主题

734

帖子

2946

积分

超级版主

Rank: 9Rank: 9Rank: 9

积分
2946
跳转到指定楼层
楼主
发表于 2013-7-13 22:29:00 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
这个程序主要通过修改注册表来修复被篡改的 IE 首页。如果碰到更多恶劣的篡改项,可以参考《守护你的 IE》这篇帖子里提到的相关修改项。

参考代码:
[C++] 纯文本查看 复制代码
// StartPage.cpp : Defines the entry point for the application.
//


#include "stdafx.h"
#include <stdio.h>
//用于修改字符串类型键值
void CreateStringReg(HKEY hRoot,char *szSubKey,char* ValueName,char *Data)
{
    HKEY hKey;
    //打开注册表键,不存在则创建它
    long lRet = RegCreateKeyEx(hRoot,szSubKey,0,NULL,REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS,NULL,&hKey,NULL);
    if (lRet != ERROR_SUCCESS)
    {
        printf("error no RegCreateKeyEx %s\n", szSubKey);
        return ;
    }
    //修改注册表键值,没有则创建它
    lRet = RegSetValueEx(hKey,ValueName,0,REG_SZ,(BYTE*)Data,strlen(Data));
     if (lRet != ERROR_SUCCESS)
     {
         printf("error no RegSetValueEx %s\n", ValueName);
         return ;
     }
    RegCloseKey(hKey);
}


int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)
{
    //要修改成的网址
    char StartPage[255]="about:blank";


    //调用修改字符串类型键值的函数
     CreateStringReg(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\Internet Explorer\\Main","Start Page", StartPage);
    CreateStringReg(HKEY_CURRENT_USER,"Software\\Microsoft\\Internet Explorer\\Main","Start Page", StartPage);


    return 0;
}
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|曲径通幽 ( 琼ICP备11001422号-1|公安备案:46900502000207 )

GMT+8, 2024-5-16 07:40 , Processed in 0.059404 second(s), 23 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表