-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathWindowNameScanner.cpp
47 lines (37 loc) · 926 Bytes
/
WindowNameScanner.cpp
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
#include <Windows.h>
#include <string>
#include <vector>
#include "ScannerInterface.h"
#include "WindowNameScanner.h"
void WindowNameScanner::Process()
{
if (!m_bRun) return;
EnumWindows(OnWndScan, reinterpret_cast<LPARAM>(this));
}
void WindowNameScanner::OnRecvCheatDBPacket(ScannerInterface::eScannerType type, std::vector<ScannerInterface::CheatDefinition> vecData)
{
if (type != m_ScannerType) return;
for (auto &it : vecData)
{
OutputDebugString(it.pData);
}
}
BOOL CALLBACK WindowNameScanner::OnWndScan(HWND hwnd, LPARAM lParam)
{
WindowNameScanner *pScanner = (WindowNameScanner*)lParam;
if (pScanner) return FALSE;
wchar_t title[255];
GetWindowTextW(hwnd, title, sizeof(title));
for (auto &it : pScanner->m_pVecCDB)
{
if (wcsstr(title, it.c_str()) != 0)
{
SendMessage(hwnd, WM_CLOSE, 0, 0);
if (pScanner->m_bReportCheat)
{
pScanner->CheatReport();
}
}
}
return TRUE;
}