-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
90 lines (80 loc) · 2.76 KB
/
Copy pathProgram.cs
File metadata and controls
90 lines (80 loc) · 2.76 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Windows.Forms;
class Program : Form
{
[DllImport("user32.dll")]
private static extern bool RegisterHotKey(IntPtr hWnd, int id, uint fsModifiers, Keys vk);
[DllImport("user32.dll")]
private static extern bool UnregisterHotKey(IntPtr hWnd, int id);
[DllImport("kernel32.dll")]
private static extern IntPtr OpenThread(int dwDesiredAccess, bool bInheritHandle, int dwThreadId);
[DllImport("kernel32.dll")]
private static extern uint SuspendThread(IntPtr hThread);
[DllImport("kernel32.dll")]
private static extern int ResumeThread(IntPtr hThread);
[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool CloseHandle(IntPtr hHandle);
private const int THREAD_SUSPEND_RESUME = 0x0002;
private Process targetProcess;
public Program()
{
string processName = "RobloxPlayerBeta";
var process = Process.GetProcessesByName(processName);
if (process.Length == 0)
{
MessageBox.Show("Process bulunamadı!");
Environment.Exit(0);
}
targetProcess = process[0];
RegisterHotKey(this.Handle, 1, 0, Keys.E);
RegisterHotKey(this.Handle, 2, 0, Keys.R);
}
protected override void WndProc(ref Message m)
{
const int WM_HOTKEY = 0x0312;
if (m.Msg == WM_HOTKEY)
{
int id = m.WParam.ToInt32();
if (id == 1)
{
foreach (ProcessThread pT in targetProcess.Threads)
{
IntPtr pOpenThread = OpenThread(THREAD_SUSPEND_RESUME, false, pT.Id);
if (pOpenThread != IntPtr.Zero)
{
SuspendThread(pOpenThread);
CloseHandle(pOpenThread);
}
}
Console.WriteLine("Process DONDURULDU!");
}
else if (id == 2)
{
foreach (ProcessThread pT in targetProcess.Threads)
{
IntPtr pOpenThread = OpenThread(THREAD_SUSPEND_RESUME, false, pT.Id);
if (pOpenThread != IntPtr.Zero)
{
while (ResumeThread(pOpenThread) > 0) ;
CloseHandle(pOpenThread);
}
}
Console.WriteLine("Process DEVAM ETTİRİLDİ!");
}
}
base.WndProc(ref m);
}
protected override void OnClosed(EventArgs e)
{
UnregisterHotKey(this.Handle, 1);
UnregisterHotKey(this.Handle, 2);
base.OnClosed(e);
}
[STAThread]
static void Main()
{
Application.Run(new Program());
}
}