Skip to content

Instantly share code, notes, and snippets.

@equalent
Last active May 6, 2020 20:20
Show Gist options
  • Save equalent/1f9e7fc51d94eaa298684c27258af2ee to your computer and use it in GitHub Desktop.
Save equalent/1f9e7fc51d94eaa298684c27258af2ee to your computer and use it in GitHub Desktop.
Detect running Cheat Engine (simple anti-cheat)
#include <Windows.h>
#include <Psapi.h>
#include <TlHelp32.h>
#include <string.h>
BOOL IsCheatEngineRunning()
{
PROCESSENTRY32 pe32 = { sizeof(PROCESSENTRY32) };
HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (hSnapshot == INVALID_HANDLE_VALUE)
return FALSE;
if (Process32First(hSnapshot, &pe32))
{
do {
if ((strcmp(pe32.szExeFile, "cheatengine-i386.exe") == 0)||(strcmp(pe32.szExeFile, "cheatengine-x86_64.exe") == 0))
{
CloseHandle(hSnapshot);
return TRUE;
}
} while (Process32Next(hSnapshot, &pe32));
}
CloseHandle(hSnapshot);
return FALSE;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment