防止模拟键盘一类工具操作自己的系统的“简单实现”

using System.Diagnostics;

 在关键事件中加入检查方法.
检查进程,一旦发现这样的进程立即Kill掉,另外直接退出或,反回到上一步操作!
 private void ChecHookProcessess()
        {
            foreach (Process p in Process.GetProcesses())
            {
                if (p.MainWindowTitle.ToUpper().Contains ("按键精灵") ||
                    p.MainWindowTitle.ToUpper().Contains ("模拟精灵")||
                    p.MainWindowTitle.ToUpper().Contains ("模拟")||
                    p.MainWindowTitle.ToUpper().Contains ("精灵")||
                    p.MainWindowTitle.ToUpper().Contains ("按键")||
                    p.MainWindowTitle.ToUpper().Contains ("FAIRY")||
                    p.MainWindowTitle.ToUpper().Contains ("键盘")||
                    p.MainWindowTitle.ToUpper().Contains ("按键")||
                    p.MainWindowTitle.ToUpper().Contains ("外挂")||
                    p.MainWindowTitle.ToUpper().Contains("SIMULATOR")||
                    p.MainWindowTitle.ToUpper().Contains("KEYBOARD") ||
                   
                    p.ProcessName.ToUpper().Contains ("按键精灵") ||
                    p.ProcessName.ToUpper().Contains ("模拟精灵")||
                    p.ProcessName.ToUpper().Contains ("模拟")||
                    p.ProcessName.ToUpper().Contains ("精灵")||
                    p.ProcessName.ToUpper().Contains ("按键")||
                    p.ProcessName.ToUpper().Contains ("FAIRY")||
                    p.ProcessName.ToUpper().Contains ("键盘")||
                    p.ProcessName.ToUpper().Contains ("按键")||
                    p.ProcessName.ToUpper().Contains ("外挂")||
                    p.ProcessName.ToUpper().Contains("SIMULATOR") ||
                    p.ProcessName.ToUpper().Contains("KEYBOARD")
                    )
                {
                    p.Kill();
                    MessageBox.Show("请退出外挂程序,否则无法正常售票!","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Warning);
                    return;
                }
            }
        }

你可能感兴趣的:(工具)