using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace AntiCheat
{
public static class Program
{
[DllImport("kernel32.dll", SetLastError = true)]
private static extern IntPtr GetModuleHandle(string lpModuleName);
[DllImport("kernel32.dll")]
private static extern IntPtr GetProcAddress(IntPtr hModule, string procName);
[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool VirtualProtect(IntPtr lpAddress, uint dwSize, uint flNewProtect, out uint lpflOldProtect);
private delegate bool SetWindowLongDelegate(IntPtr hWnd, int nIndex, int dwNewLong);
private const int GWL_STYLE = -16;
private const int WS_SYSMENU = 0x80000;
[STAThread]
public static void Main()
{
// Dış DLL'lerin yüklenmesini engelleme
var kernel32 = GetModuleHandle("kernel32.dll");
var loadLibraryAddress = GetProcAddress(kernel32, "LoadLibraryA");
uint oldProtect;
VirtualProtect(loadLibraryAddress, (uint)IntPtr.Size, 0x40 /*PAGE_EXECUTE_READWRITE*/, out oldProtect);
Marshal.WriteIntPtr(loadLibraryAddress + 2 * IntPtr.Size + 1 * sizeof(int), IntPtr.Zero);
VirtualProtect(loadLibraryAddress, (uint)IntPtr.Size, oldProtect, out oldProtect);
// Cheat Engine ve Process Hacker'ı izleme
var cheatEngine = "cheatengine";
var processHacker = "processhacker";
// Arka planda işlemleri izleme
new System.Threading.Thread(() =>
{
while (true)
{
foreach (var process in Process.GetProcesses())
{
if (process.ProcessName.ToLower().Contains(cheatEngine) || process.ProcessName.ToLower().Contains(processHacker))
{
MessageBox.Show("Hile yapmak yasaktır!", "Anti-Cheat", MessageBoxButtons.OK,
MessageBoxIcon.Warning);
Environment.Exit(0);
}
}
System.Threading.Thread.Sleep(1000);
}
}).Start();
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}