-
Notifications
You must be signed in to change notification settings - Fork 8
/
main.cpp
131 lines (112 loc) · 3.72 KB
/
main.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/**
*
* Title: EQU8 User-Mode Bypass and Injector
* Author: hotline
*
*/
#include <Windows.h>
#include <cstdio>
#include <string>
#include <TlHelp32.h>
#include <iostream>
#include <functional>
#include "globals.hpp"
#include "xor.hpp"
#include "import.hpp"
using namespace std;
auto main(void) -> int
{
try
{
globals::validation::validate_system();
}
catch (std::exception& ex)
{
std::string error = "Something went wrong : ";
error.append(ex.what());
MessageBoxA(nullptr, error.c_str(), "equ8 bypass", MB_ICONERROR | MB_OK);
return 0;
}
LI_FN(SetConsoleTitleA)(xorstr_("equ8 bypass by u55dx"));
std::cout << xorstr_("~ equ8 bypass by u55dx for unknowncheats\n~ github.com/hotline1337") << std::endl << std::endl;
std::cout << "~ successfully launched as system" << std::endl;
/* variables */
int lastError;
int lastErrorHistory = 0;
HANDLE ioctlHandle;
HKEY equ8DriverKey;
CHAR deviceSessionId[MAX_PATH];
DWORD deviceSessionIdLength = sizeof(deviceSessionId);
LSTATUS status = RegOpenKeyExA(HKEY_LOCAL_MACHINE, R"(SYSTEM\CurrentControlSet\Services\EQU8_HELPER_36)", 0,
KEY_READ, &equ8DriverKey);
if (status != ERROR_SUCCESS)
{
std::cout << "~ failed to open equ8 driver key : " << std::hex << status << "\n";
std::cin.get();
return 0;
}
status = RegQueryValueExA(equ8DriverKey, "SessionId", nullptr, nullptr, reinterpret_cast<LPBYTE>(deviceSessionId),
&deviceSessionIdLength);
if (status != ERROR_SUCCESS)
{
std::cout << "~ failed to query equ8 session id : " << std::hex << status << "\n";
std::cin.get();
return 0;
}
const std::string driverDeviceName = "\\??\\" + std::string(deviceSessionId);
std::cout << "~ found equ8 driver : " << driverDeviceName << "\n";
std::cout << "~ waiting for game\n";
do
{
ioctlHandle = LI_FN(CreateFileA).get()(driverDeviceName.c_str(), GENERIC_READ | GENERIC_WRITE, 0, nullptr, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, nullptr);
lastError = GetLastError();
if (lastErrorHistory != lastError)
{
if (lastErrorHistory == 0 && lastError == ERROR_NO_SUCH_DEVICE)
{
std::cout << "~ failed to get device handle\n";
}
if (lastErrorHistory == ERROR_NO_SUCH_DEVICE && lastError != ERROR_SUCCESS)
{
std::cout << "~ failed to find the device\n";
}
lastErrorHistory = lastError;
}
}
while (lastError == ERROR_FILE_NOT_FOUND || lastError == ERROR_ACCESS_DENIED || lastError == ERROR_NO_SUCH_DEVICE);
if (ioctlHandle == INVALID_HANDLE_VALUE)
{
std::cout << "~ failed to get device handle due to unhandled error : " << std::hex << lastError << "\n";
std::cin.get();
return 0;
}
std::cout << "~ successfully opened equ8 driver : " << std::hex << reinterpret_cast<ULONG64>(ioctlHandle) << "\n";
while (globals::process::get_process_pid_by_name("PortalWars-Win64-Shipping.exe") == NULL)
{
Sleep(50);
}
std::cout << "~ received handle to the game\n";
CloseHandle(ioctlHandle);
std::cout << "~ equ8 unloaded successfully\n";
std::cout << "~ waiting for window\n";
while (!FindWindowA(nullptr, "PortalWars "))
{
Sleep(100);
}
DWORD split_gate_pid = 0;
GetWindowThreadProcessId(FindWindowA(nullptr, "PortalWars "), &split_gate_pid);
const HANDLE h_object = OpenProcess(PROCESS_ALL_ACCESS, false, split_gate_pid);
if (!h_object)
{
std::cout << "~ failed to get handle to process\n";
std::cin.get();
return 0;
}
std::cout << "~ opening file dialog\n";
globals::process::inject_dll(h_object, globals::file::open_file_name());
CloseHandle(h_object);
std::cout << "~ successfully loaded the buffer\n";
std::cin.get();
return 0;
}