-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlibrary.cpp
More file actions
59 lines (42 loc) · 1.84 KB
/
library.cpp
File metadata and controls
59 lines (42 loc) · 1.84 KB
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
#include <windows.h>
#include <minhook.h>
#include <sdk.hpp>
#include "render.h"
#include "view.h"
auto __stdcall thread(void* module) -> void {
MH_Initialize();
LOG("Hello World");
const auto direct = direct_hook::instance();
direct->present_hook_.enable();
direct->resize_hook_.enable();
auto runtime = sdk::runtime::get();
sdk::fstring a{L"hello"};
LOG("fstring: {}", a.to_string());
auto result = runtime.load_engine_version();
LOG("Engine Version: {}, Version Number: {}", std::get<0>(result.value()), std::get<1>(result.value()));
auto gobjects = runtime.load_gobjects();
LOG("GObjects Size: {}, GObjects Chunks: {}", (gobjects->size()), (gobjects->chunks()));
const auto object = gobjects->find_object(0x231);
LOG("{:#x} {}", (uintptr_t)object, object->index_);
static const auto string_library = sdk::uobject::find<sdk::uobject>("/Script/Engine.Default__KismetStringLibrary");
LOG("KismetStringLibrary: {:#x}", (uintptr_t)string_library);
// LOG("UObject Name: {}", object->name_->to_string());
// FreeLibraryAndExitThread(reinterpret_cast<HMODULE>(module), 0);
}
auto __stdcall DllExit(void* module, const unsigned long reason, void*) -> bool {
LOG("DllExit");
// direct_hook::wants_end_.store(true);
// while (!direct_hook::finished_last_render_.load()) {
// std::this_thread::sleep_for(std::chrono::milliseconds(100));
// }
// LOG("Okay deleting hooks");
// auto direct = direct_hook::instance();
// direct->~direct_hook();
// MH_Uninitialize();
return true;
}
[[maybe_unused]] auto __stdcall DllMain(void* module, const unsigned long reason, void*) -> bool {
if (reason == DLL_PROCESS_ATTACH) CreateThread(nullptr, 0, reinterpret_cast<LPTHREAD_START_ROUTINE>(thread), module, 0, nullptr);
else if (reason == DLL_PROCESS_DETACH) return DllExit(module, reason, nullptr);
return true;
}