这个比较简单就直接上代码了:
using namespace std;
void TestProcess()
{
HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);
if (hSnapshot == INVALID_HANDLE_VALUE)
{
cout << "打开进程快照失败" << endl;
return;
}
PROCESSENTRY32 tempContext{ 0 };
tempContext.dwSize = sizeof(PROCESSENTRY32);
Process32First(hSnapshot, &tempContext);
do
{
if (wcscmp(tempContext.szExeFile,L"x32dbg.exe") ==0)
{
cout << "检测到了xdbg调试进程" << endl;
break;
}
} while (Process32Next(hSnapshot,&tempContext));
CloseHandle(hSnapshot);
}
void CheckWindow()
{
HANDLE hWindow = FindWindowA(0,"x32dbg");
if (hWindow != NULL)
{
cout << "检测到了x32dbg" << endl;
}
}
int main()
{
TestProcess();
CheckWindow();
return 0;
}
#include<Windows.h>#include<iostream>#include<tlhelp32.h>using namespace std;
void TestProcess(){HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);if (hSnapshot == INVALID_HANDLE_VALUE){cout << "打开进程快照失败" << endl;return;}PROCESSENTRY32 tempContext{ 0 };tempContext.dwSize = sizeof(PROCESSENTRY32);Process32First(hSnapshot, &tempContext);do{if (wcscmp(tempContext.szExeFile,L"x32dbg.exe") ==0){cout << "检测到了xdbg调试进程" << endl;break;}} while (Process32Next(hSnapshot,&tempContext));
CloseHandle(hSnapshot);}
void CheckWindow(){HANDLE hWindow = FindWindowA(0,"x32dbg");if (hWindow != NULL){cout << "检测到了x32dbg" << endl;}
}
int main(){TestProcess();CheckWindow();return 0;}