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

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

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

原文地址:https://www.cnblogs.com/virusswb/p/1245348.html