修改CPU型号(重启依然有效)
做这小工具的出发点纯属好玩娱乐,而不是奸商之类为了利益而去行骗。
开发过程总结一句话:操作系统注册表,取得最大权限,通过做成系统服务开机自启达到表面上的修改,重启依然有效,但骗不过专业的类似cpu-z,鲁大师等工具。
开发工具汇总:win10 Professional x64、vs2015 Community、.net Framwork4.0、c#、Windows Service
1、新建windows服务项目
2、添加windows服务的安装程序
在默认Service1设计器界面空白处点击右键->添加安装程序,系统会自动新建一个带有默认配置的安装程序类
新建完安装程序后,需要给默认的serviceInstaller1和serviceProcessInstaller1做一些基本的属性设置。
以上工作完成,安装程序配置完毕。
注意:如果不给服务添加安装程序,后面是没法把服务安装至windows系统里的。
3、添加应用程序配置文件(如果有需要的话)。
4、编写windows服务主代码
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Diagnostics; using System.Linq; using System.ServiceProcess; using System.Text; using Microsoft.Win32; //对注册表进行操作需要引入 namespace WindowsService1 { public partial class Service1 : ServiceBase { public Service1() { InitializeComponent(); } protected override void OnStart(string[] args) { RegistryKey key = Registry.LocalMachine; RegistryKey cpu = key.OpenSubKey("HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0", true); cpu.SetValue("ProcessorNameString", "Intel(R) Core(TM) CPU i5-2697v2 @ 5.40GHz"); key.Close(); } protected override void OnStop() { } } }
5、编译生成,安装windows服务至Windows系统。
完成开发后,对整个项目进行编译生成(右击项目重新生成)。在windows服务开发文件夹“\bin\Debug”下,就是我们需要安装的服务。
然后打开目录C:\Windows\Microsoft.NET\Framework64\v4.0.30319,拷贝里面的InstallUtil.exe文件至\bin\Debug文件夹下)。
注意:我的系统是windows10,64位系统,我的服务也将安装至64位系统下,所以我是进入C:\Windows\Microsoft.NET\Framework64\v4.0.30319目录拷贝InstallUtil.exe文件。各位安装的时候,根据你安装的目标系统,来觉得是拷贝哪个framework哪个版本,具体是64位的还是32位的也由你系统决定。
做好以上工作后就可以安装了,打开cmd就可执行安装了(一定要以管理员身份运行)。
以下是安装命令、启动服务命令、停止服务命令、卸载服务命令:
安装命令:InstallUtil.exe WebService1.exe
启动服务命令:net start cpuRename
关闭服务命令:net stop cpuRename
卸载服务命令:InstallUtil.exe -u WebService1.exe
来源:https://blog.csdn.net/alanlucky/article/details/52102679?utm_source=copy