悉野小楼

导航

C#读写注册表 二进制写入

msn传送exe rar等文件要杀毒软件检测. 自己写个软件修改注册表, 跳过检测
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Win32;
using System.Runtime.InteropServices;

namespace RegiterMsnAnitVirus
{
    class Program
    {
        static void Main(string[] args)
        {
            //打开注册表 修改msn杀毒软件键值
            RegistryKey key = Registry.Users.OpenSubKey(@"S-1-5-21-2011881525-2935076320-2083711069-500\Software\Microsoft\MSNMessenger"true);
            string strFileName = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;
            byte[] bytes = Encoding.Unicode.GetBytes("\"" + strFileName + "\"\0");
            try
            {
                //byte[] bytes = (byte[])key.GetValue("AntiVirus");
                
//if (bytes == null || bytes.Length < 3)
                
//{
                key.SetValue("AntiVirus", bytes, RegistryValueKind.Binary);
                //}
            }
            catch
            {
                key.SetValue("AntiVirus", bytes, RegistryValueKind.Binary);
            }
        }
    }
}

posted on 2011-12-09 12:56  悉野  阅读(599)  评论(0编辑  收藏  举报