阻止魔兽争霸3-冰封王座运行

最近,同学老是用我的电脑玩war3,我就想了个办法,去检索进程列表中是否有War3.exe这个进程,然后把它给结束掉,再提示它"好好学习了".
using  System;
using  System.Collections.Generic;
using  System.ComponentModel;
using  System.Data;
using  System.Drawing;
using  System.Text;
using  System.Windows.Forms;

using  System.Diagnostics;
using  System.Collections;
using  Microsoft.Win32;

namespace  KillProcess
{
    
public partial class KillWar3 : Form
    
{
        
public KillWar3()
        
{
            InitializeComponent();
        }


        
private void Form1_Load(object sender, EventArgs e)
        
{
            
this.listBox1.DataSource = ShowAllProcess();
            
this.listBox1.SelectedIndex = -1;
            
this.ShowInTaskbar = false;
            
this.Visible = false;
            
this.lblStatus.Text = "一共有" + this.listBox1.Items.Count.ToString() + "进程";
            
//this.listBox1.dataBind()没有绑定,只需设置其数据源
            if (EnableMyTimer() == true)
            
{
                timer1.Enabled 
= true;
                timer1.Interval 
= 5000;
                timer1.Start();
            }

            ImportDataToRegedit();
        }


        
private void button1_Click(object sender, EventArgs e)
        
{
            
if(KillProcess(this.listBox1.SelectedItem.ToString())==true)
                 MessageBox.Show(
"已经被杀死");
            btnRefresh_Click(
thisnull);
        }




        
private void btnRefresh_Click(object sender, EventArgs e)
        
{
            
this.listBox1.DataSource = ShowAllProcess();
            
this.lblStatus.Text = "一共有"+this.listBox1.Items.Count.ToString()+"进程";
         
        }


        
...

        
private void button2_Click(object sender, EventArgs e)
        
{
            
//KillProcess("War3");
        }


        
private void timer1_Tick(object sender, EventArgs e)
        
{
            
bool result=KillProcess("War3");
            
if (result == true)
                MessageBox.Show(
"好好学习""war3 小提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            btnRefresh_Click(
thisnull);//每隔五秒自动刷新
        }



        
//控制我的timer启动与否能力
        private bool EnableMyTimer()
        
{
            
int NowHour=System.DateTime.Now.Hour;
            
if(NowHour  >=8 && NowHour <=13)
            
{
                
return true;
            }

            
return false;
        }


        
/*
         * 将要启动的应用程序路径写到注册表中具体的路径是:
        HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionRun
        只需要在上面的路径下写一个键并为此键设置一个当前应用程序的路径即开机自载  
         
*/

        
private void ImportDataToRegedit()
        
{
            RegistryKey hklm 
= Registry.LocalMachine;
            RegistryKey software 
= hklm.OpenSubKey("software");
            RegistryKey Microsoft 
= software.OpenSubKey("Microsoft");
            RegistryKey Windows 
= Microsoft.OpenSubKey("Windows");
            RegistryKey CurrentVersion 
= Windows.OpenSubKey("CurrentVersion");
            RegistryKey run 
= CurrentVersion.OpenSubKey("Run",true);//一定要这个true,否则它会提示没有权限来修改注册表 
            foreach(string sValName in run.GetValueNames())   
              
//开始遍历由指定子键拥有的键值名称组成的字符串数组   
              {   
                  
// listBox1.Items.Add   (   "   "   +   sValName   +   ":   "   +   sitekey.GetValue   (   sValName   )   )   ;   
                  
//在列表中加入键名称和对应的键值  
                  if (run.GetValue(sValName).ToString() == "KillProcess")
                  
{
                      run.DeleteValue(
"KillProcess");
                  }

                
//  RegistryKey kill = run.CreateSubKey("Kill");
                  run.SetValue("KillProcess",Application.ExecutablePath  );// 直接在run下创建一个键值
               }
   
            
            
           
 
        }

    }

}

/*
 下面的代码示例演示如何在 HKEY_CURRENT_USER 下创建一个子项,处理相应的内容,然后删除该子项。

C#  复制代码 
using System;
using System.Security.Permissions;
using Microsoft.Win32;

[assembly: RegistryPermissionAttribute(SecurityAction.RequestMinimum,
    ViewAndModify = "HKEY_CURRENT_USER")]

class RegKey
{
    static void Main()
    {
        // Create a subkey named Test9999 under HKEY_CURRENT_USER.
        RegistryKey test9999 = 
            Registry.CurrentUser.CreateSubKey("Test9999");
        // Create two subkeys under HKEY_CURRENT_USERTest9999. The
        // keys are disposed when execution exits the using statement.
        using(RegistryKey 
            testName = test9999.CreateSubKey("TestName"),
            testSettings = test9999.CreateSubKey("TestSettings"))
        {
            // Create data for the TestSettings subkey.
            testSettings.SetValue("Language", "French");
            testSettings.SetValue("Level", "Intermediate");
            testSettings.SetValue("ID", 123);
        }

        // Print the information from the Test9999 subkey.
        Console.WriteLine("There are {0} subkeys under {1}.", 
            test9999.SubKeyCount.ToString(), test9999.Name);
        foreach(string subKeyName in test9999.GetSubKeyNames())
        {
            using(RegistryKey 
                tempKey = test9999.OpenSubKey(subKeyName))
            {
                Console.WriteLine(" There are {0} values for {1}.", 
                    tempKey.ValueCount.ToString(), tempKey.Name);
                foreach(string valueName in tempKey.GetValueNames())
                {
                    Console.WriteLine("{0,-8}: {1}", valueName, 
                        tempKey.GetValue(valueName).ToString());
                }
            }
        }

        using(RegistryKey 
            testSettings = test9999.OpenSubKey("TestSettings", true))
        {
            // Delete the ID value.
            testSettings.DeleteValue("id");

            // Verify the deletion.
            Console.WriteLine((string)testSettings.GetValue(
                "id", "ID not found."));
        }

        // Delete or close the new subkey.
        Console.Write(" Delete newly created registry key? (Y/N) ");
        if(Char.ToUpper(Convert.ToChar(Console.Read())) == 'Y')
        {
            Registry.CurrentUser.DeleteSubKeyTree("Test9999");
            Console.WriteLine(" Registry key {0} deleted.", 
                test9999.Name);
        }
        else
        {
            Console.WriteLine(" Registry key {0} closed.", 
                test9999.ToString());
            test9999.Close();
        }
    }
}

 
*/

 

1,为了不让别人看到我的窗体,就把this.visible设为false

2,为了一开机运行,把它加载到run下,故对注册表进行访问.

3,列出所有进程.

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
### 回答1: 魔兽争霸3 J2B加密是指在游戏的开发过程中,使用了一种名为J2B的加密方式来对游戏文件进行加密。这种加密方式可以有效地保护游戏文件的安全性,防止非法盗版和修改。 J2B加密是一种独特的加密方式,它采用了一种专门的算法对游戏文件进行加密和压缩,可以大大降低游戏文件的大小,提高游戏的运行速度和效率。同时,J2B加密还能够对游戏文件进行校验和验证,确保游戏文件的完整性和正确性。 由于J2B加密具有高强度、高安全性和高效率等特点,因此被广泛应用于游戏开发、软件保护和数据传输等领域。在魔兽争霸3中,J2B加密起到了至关重要的作用,可以有效地保护游戏的安全性和完整性,为玩家提供更加稳定和流畅的游戏体验。 总之,魔兽争霸3 J2B加密是一种非常实用和有效的加密方式,在游戏和软件开发中发挥了重要作用,为用户提供了更加安全和稳定的服务。 ### 回答2: 魔兽争霸3是一款非常经典的游戏,在游戏文件中存在j2b加密方式。j2b加密是一种基于xor运算的加密方式。其中,xor运算是一种位运算,其英文全称为“Exclusive Or”,简称为“异或运算”,常用符号为“^”。它是一个二元的逻辑运算符,表示在两个比特位相同的情况下其结果为0,不同的情况下结果为1。 在j2b加密中,数据会被按一定规则处理后再进行异或运算,这样就可以得到加密后的数据。而解密时,只需要按照相同的规则进行异或运算即可还原出原始数据。 需要注意的是,虽然j2b加密可以增强文件的安全性,但是在现今的技术条件下,已经不再安全可靠。因此,如果您需要保护重要的数据文件,建议使用更加先进的加密方式,如AES加密,以确保您的数据的安全性。 ### 回答3: 魔兽争霸3 j2b加密是一种针对游戏地图进行加密的方式。由于魔兽争霸3是一款自带地图编辑器的游戏,玩家可以使用该编辑器创建自己的游戏地图,这也为游戏的社区开发带来了很大的活力。 然而,由于一些不良分子利用地图编辑器为游戏添加了一些恶意代码,以实现作弊和攻击其他玩家等不道德行为。在这种情况下,游戏开发商Blizzard为了保证游戏的公正性和稳定性,采取了j2b加密技术,对游戏地图进行加密保护,防止地图被恶意篡改。 j2b加密技术是一种非对称加密技术,加密算法采用的是RSA公钥加密算法。玩家在使用地图编辑器创建地图时,地图文件会被加密为j2b格式,只有经过Blizzard的密钥才能解密,否则无法识别和运行地图。这样就保证了游戏地图的安全性和保密性,也防止了一些不道德行为的出现。 总之,魔兽争霸3 j2b加密是一项非常重要的技术保障,对游戏的公正性和用户体验都起到了重要的作用。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值