zoukankan      html  css  js  c++  java
  • 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

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

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

  • 相关阅读:
    子集和的另外一个问题
    LCS
    表达式求值
    Singleton in java
    自绘ListBox的两种效果
    动态创建、压缩Access数据库(*.MDB)
    C# 中用stopwatch测试代码运行时间
    MVC学习笔记之数据传递
    ATM应用实现
    html的基本语法
  • 原文地址:https://www.cnblogs.com/virusswb/p/1245348.html
Copyright © 2011-2022 走看看