forked from masterpastaa/Face-Injector-V3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtarget.cpp
47 lines (37 loc) · 1.22 KB
/
target.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 "Target.h"
#include <Windows.h>
#include <tlhelp32.h>
std::vector<TargetProcess> Target::potential_targets = {
{ "Fortnite", "FortniteClient-Win64-Shipping.exe", "nigger.dll", X64, false },
};
int Target::is_valid_target(std::string target_name) {
Architecture_t architecture = (Architecture_t)(sizeof(void*) == 8);
for (size_t i = 0; i < potential_targets.size(); i++) {
TargetProcess& potential_target = potential_targets.at(i);
if (potential_target.architecture == architecture && potential_target.process_name.compare(target_name) == 0) {
return (int)i;
}
}
return -1;
}
int Target::find_target(TargetProcess* target) {
HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, NULL);
if (hSnapshot == INVALID_HANDLE_VALUE)
return -1;
PROCESSENTRY32 entry = { NULL };
entry.dwSize = sizeof(PROCESSENTRY32);
if (!Process32First(hSnapshot, &entry)) {
CloseHandle(hSnapshot);
return -1;
}
do {
int potential_target_id = is_valid_target(entry.szExeFile);
if (potential_target_id != -1) {
CloseHandle(hSnapshot);
*target = potential_targets.at(potential_target_id);
return entry.th32ProcessID;
}
} while (Process32Next(hSnapshot, &entry));
CloseHandle(hSnapshot);
return -1;
}