当前位置: 代码迷 >> C语言 >> 注册表停用与开启
  详细解决方案

注册表停用与开启

热度:305   发布时间:2007-10-24 23:32:26.0
注册表停用与开启
/*
Name: 注册表停用与开启
Copyright:
Author: 随心
Date: 15-10-07 13:07
Description:
*/
#include <iostream>
#include <cstdlib>
#include <process.h>
using namespace std;
char *start={"Windows Registry Editor Version 5.00\n\n[HKEY_CURRENT_USER\\\
Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System]\n\"DisableRegistryTools\"\
=dword:00000000 "};
char *stop={"Windows Registry Editor Version 5.00\n\n[HKEY_CURRENT_USER\\\
Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System]\n\"DisableRegistryTools\"\
=dword:1 "};
class regedit
{
public:
void actStart()
{
FILE *output;
if(output=fopen("$$$$$","w"))
fprintf(output,start);
fclose(output);
spawnl(1,"c:\\windows\\regedit.exe"," /s $$$$$",NULL);
cout<<"已开启"<<endl;
}
void actStop()
{
FILE *output;
if(output=fopen("$$$$$","w"))
fprintf(output,stop);
fclose(output);
spawnl(1,"c:\\windows\\regedit.exe"," /s $$$$$",NULL);
cout<<"已停用"<<endl;
}
};
void menu()
{
cout<<"============================"<<endl;
cout<<"1 停用注册表"<<endl;
cout<<"2 开启注册表"<<endl;
cout<<"0 退出"<<endl;
cout<<"============================"<<endl;
cout<<"choice:"<<flush;
}
void back()
{
system("pause");
system("cls");
menu();
}
int main()
{
int choice=0;
regedit text;
menu();
while(1)
{
cin>>choice;
switch(choice)
{
case 0:system("del $$$$$");exit(0);break; //保护环境,人人有责
case 1:text.actStop();back();break;
case 2:text.actStart();back();break;
default :cout<<"error!"<<endl;
}
}
return 0;
}
搜索更多相关的解决方案: 注册表  

----------------解决方案--------------------------------------------------------
  相关解决方案