Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <windows.h>
- #include <stdio.h>
- #include <tchar.h>
- #include <psapi.h>
- #include <string>
- extern "C" __declspec(dllexport) double __cdecl detectTAS();
- using namespace std;
- string ProcessIsRunning(DWORD processID)
- {
- TCHAR szProcessName[MAX_PATH] = TEXT("<unknown>");
- // Get a handle to the process.
- HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION |
- PROCESS_VM_READ,
- FALSE, processID);
- // Get the process name.
- if (NULL != hProcess)
- {
- HMODULE hMod;
- DWORD cbNeeded;
- if (EnumProcessModules(hProcess, &hMod, sizeof(hMod),
- &cbNeeded))
- {
- GetModuleBaseName(hProcess, hMod, szProcessName,
- sizeof(szProcessName) / sizeof(TCHAR));
- }
- }
- CloseHandle(hProcess);
- return szProcessName;
- }
- __declspec(dllexport) double __cdecl detectTAS()
- {
- DWORD aProcesses[1024], cbNeeded, cProcesses;
- unsigned int i;
- if (!EnumProcesses(aProcesses, sizeof(aProcesses), &cbNeeded))
- {
- return 0.0;
- }
- cProcesses = cbNeeded / sizeof(DWORD);
- for (i = 0; i < cProcesses; i++)
- {
- if (aProcesses[i] != 0)
- {
- string name = ProcessIsRunning(aProcesses[i]);
- for (int i = 0; i < name.size(); ++i)
- name[i] = tolower(name[i]);
- if (name.find("cheatengine") != std::string::npos) {
- return 1.0;
- }
- if (name.find("hourglass") != std::string::npos) {
- return 1.0;
- }
- }
- }
- return 0.0;
- }
Add Comment
Please, Sign In to add comment