本帖最后由 MC2213198020 于 2019-8-9 12:02 编辑
好久不见,这个小工具是根据某人写的同款工具,原本想直接用他的关闭WindowsDefender,结果我使用的时候用他的出了点小问题,他用易语言写的,我用C#写的,功能一样,但是他的代码不是很严谨,我就顺手用C#写了个功能一样的小工具,此软件涉及到了C#的注册表读写既然开源,那么下方是源代码:[C#] 纯文本查看 复制代码 using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Microsoft.Win32;
//BY-MCtech
namespace 关闭Windows_defender
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
RegistryKey key1 = Registry.LocalMachine;
RegistryKey software1 = key1.OpenSubKey(@"SYSTEM\CurrentControlSet\Services\SecurityHealthService");
string GetValue1 = software1.GetValue("Start").ToString();
if(GetValue1 == "2")
{
label1.Text = "状态: 已开启!";
}
else if (GetValue1 == "3")
{
label1.Text = "状态: 已被第三方软件接管!";
}
else if (GetValue1 == "4")
{
label1.Text = "状态: 已关闭!";
}
RegistryKey key2 = Registry.LocalMachine;
RegistryKey software2 = key2.OpenSubKey(@"SYSTEM\CurrentControlSet\Services\wscsvc");
string GetValue2 = software2.GetValue("Start").ToString();
if (GetValue2 == "2")
{
label2.Text = "状态: 已开启!";
}
else if (GetValue2 == "4")
{
label2.Text = "状态: 已关闭!";
}
}
private void Button1_Click(object sender, EventArgs e)
{
//开启安全健康服务
RegistryKey key1 = Registry.LocalMachine;
RegistryKey software1 = key1.OpenSubKey(@"SYSTEM\CurrentControlSet\Services\SecurityHealthService", true);
software1.SetValue("Start",2);
string GetValue1 = software1.GetValue("Start").ToString();
if (GetValue1 == "2")
{
MessageBox.Show("开启成功!重启生效");
label1.Text = "状态: 已开启!";
}
else
{
MessageBox.Show("错误!请以管理员权限运行若仍未解决我也没办法!");
}
}
private void Button2_Click(object sender, EventArgs e)
{
//关闭安全健康服务
RegistryKey key1 = Registry.LocalMachine;
RegistryKey software1 = key1.OpenSubKey(@"SYSTEM\CurrentControlSet\Services\SecurityHealthService", true);
software1.SetValue("Start", 4);
string GetValue1 = software1.GetValue("Start").ToString();
if (GetValue1 == "4") {
MessageBox.Show("关闭成功!重启生效");
label1.Text = "状态: 已关闭!";
}
else { MessageBox.Show("错误!请以管理员权限运行若仍未解决我也没办法!"); }
}
private void Label1_Click(object sender, EventArgs e)
{
//安全健康服务状态
}
private void Label2_Click(object sender, EventArgs e)
{
//安全中心服务状态
}
private void Button4_Click(object sender, EventArgs e)
{
//关闭window Defender安全中心服务
RegistryKey key2 = Registry.LocalMachine;
RegistryKey software2 = key2.OpenSubKey(@"SYSTEM\CurrentControlSet\Services\wscsvc", true);
software2.SetValue("Start", 4);
string GetValue2 = software2.GetValue("Start").ToString();
if (GetValue2 == "4") {
MessageBox.Show("关闭成功!重启生效");
label2.Text = "状态: 已关闭!";
}
else
{
MessageBox.Show("错误!请以管理员权限运行若仍未解决我也没办法!");
}
}
private void Button3_Click(object sender, EventArgs e)
{
//开启window Defender安全中心服务
RegistryKey key2 = Registry.LocalMachine;
RegistryKey software2 = key2.OpenSubKey(@"SYSTEM\CurrentControlSet\Services\wscsvc", true);
software2.SetValue("Start", 2);
string GetValue2 = software2.GetValue("Start").ToString();
if (GetValue2 == "2")
{
MessageBox.Show("开启成功!重启生效");
label2.Text = "状态: 已开启!";
}
else
{
MessageBox.Show("错误!请以管理员权限运行若仍未解决我也没办法!");
}
}
private void GroupBox1_Enter(object sender, EventArgs e)
{
}
private void Form1_Load(object sender, EventArgs e)
{
}
}
}
嘿嘿,注册表好好玩啊,这是源代码。
上图:
请以管理员权限运行!请以管理员权限运行!请以管理员权限运行!重启生效,
运行环境:.NETFramework,Version=v4.6.1
成品地址:链接:https://pan.baidu.com/s/144qgh-hAILnSKCRZRmn28w
提取码:j5fd
复制这段内容后打开百度网盘手机App,操作更方便哦
文件名称:关闭Windows Defender
MD5:c00f1da4d58d19e2dae064ef6a593b40
腾讯哈勃链接:https://habo.qq.com/file/showdetail?pk=ADcGZ11uB2UIMVs8U2c%3D
轻度风险
功能:开启关闭Windows Defender 健康中心,开启关闭Windows Defender安全中心服务
土豪走下面 |