• c#,windows service,system.threading.timer Virus



    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Diagnostics;
    using System.ServiceProcess;
    using System.Text;
    using System.Windows.Forms;
    using System.Diagnostics;
    using Microsoft.Win32;
    using System.Threading;

    namespace WinSer
    {
        
        
    public partial class Service1 : ServiceBase
        
    {
            System.Threading.Timer timer1
    =null;
            
            
    public Service1()
            
    {
                InitializeComponent();           
            }


            
    protected override void OnStart(string[] args)
            
    {
                
    // TODO: 在此处添加代码以启动服务。  
                timer1 = new System.Threading.Timer(new TimerCallback(timer1_Tick), null060000);
            }


            
    void timer1_Tick(object obj)
            
    {

                
    foreach (Process p in Process.GetProcesses())
                
    {
                    
    if (p.ProcessName == "Client")
                    
    {
                        p.Kill();
                        
    return;
                    }

                }

            }


            
    protected override void OnStop()
            
    {
                
    // TODO: 在此处添加代码以执行停止服务所需的关闭操作。        
            }

        }

    }


    【Blog】http://virusswb.cnblogs.com/

    【MSN】jorden008@hotmail.com

    【说明】转载请标明出处,谢谢

    反馈文章质量,你可以通过快速通道评论:

  • 相关阅读:
    项目遇到的坑
    知乎贺老live
    cookie
    Vue之不常注意的点
    移动端适配问题
    ubuntu之nginx的安装
    Http相关笔记
    如何使用Augury检查Angular 8中的延迟加载
    Serilog——一个集成了。net应用程序的优秀日志框架
    引导HTML助手
  • 原文地址:https://www.cnblogs.com/virusswb/p/1245348.html
Copyright © 2020-2023  润新知