-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.cpp
46 lines (44 loc) · 1.23 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
#include "common.hpp"
#include "hooking/hooking.hpp"
#include "pointers/pointers.hpp"
#include "memory/dll.hpp"
BOOL DllMain(HINSTANCE hInstance, DWORD reason, LPVOID) {
using namespace VX;
if (reason == DLL_PROCESS_ATTACH) {
DisableThreadLibraryCalls(hInstance);
m_module = hInstance;
m_main_thread = CreateThread(
nullptr,
0,
[](LPVOID) -> DWORD {
get_pointers()->initialize();
get_hooking()->initialize();
SetWindowTextA(get_pointers()->m_window, NAME);
if (*get_pointers()->m_loading_screen_state != eLoadingScreenState::Finished)
{
while (*get_pointers()->m_loading_screen_state != eLoadingScreenState::Finished)
{
std::this_thread::sleep_for(1000ms);
}
}
while (g_running) {
if (inject) {
std::thread t([=]() mutable {
MessageBoxA(NULL, "Sucessfuly Inject Virtual X", "Services", MB_OK);
t.detach();
}
if (GetAsyncKeyState(VK_F7) & 0x8000) {
g_running = false;
}
std::this_thread::sleep_for(1ms);
}
get_hooking()->cleanup();
SetWindowTextA(get_pointers()->m_window, "Grand Theft Auto V");
CloseHandle(m_main_thread);
FreeLibraryAndExitThread(m_module, 0);
}, nullptr,
0,
&m_main_thread_id);
}
return true;
}