From 1c6ae05dcb10f7b31aa8699e831872f3d5156358 Mon Sep 17 00:00:00 2001 From: momo5502 Date: Tue, 25 Dec 2018 00:32:21 +0100 Subject: [PATCH] Fix warnings and issues --- src/launcher/window.cpp | 6 +- src/loader/module_loader.cpp | 24 ++--- src/std_include.hpp | 2 - .../interfaces/{SteamApps.cpp => apps.cpp} | 1 + .../interfaces/{SteamApps.hpp => apps.hpp} | 0 .../{SteamFriends.cpp => friends.cpp} | 1 + .../{SteamFriends.hpp => friends.hpp} | 0 .../{SteamGameServer.cpp => game_server.cpp} | 1 + .../{SteamGameServer.hpp => game_server.hpp} | 0 ...rUpdater.cpp => master_server_updater.cpp} | 1 + ...rUpdater.hpp => master_server_updater.hpp} | 0 .../{SteamMatchmaking.cpp => matchmaking.cpp} | 1 + .../{SteamMatchmaking.hpp => matchmaking.hpp} | 0 ...ingServers.cpp => matchmaking_servers.cpp} | 1 + ...ingServers.hpp => matchmaking_servers.hpp} | 0 .../{SteamNetworking.cpp => networking.cpp} | 1 + .../{SteamNetworking.hpp => networking.hpp} | 0 ...amRemoteStorage.cpp => remote_storage.cpp} | 1 + ...amRemoteStorage.hpp => remote_storage.hpp} | 0 .../interfaces/{SteamUser.cpp => user.cpp} | 1 + .../interfaces/{SteamUser.hpp => user.hpp} | 0 .../{SteamUserStats.cpp => user_stats.cpp} | 1 + .../{SteamUserStats.hpp => user_stats.hpp} | 0 .../interfaces/{SteamUtils.cpp => utils.cpp} | 10 +- .../interfaces/{SteamUtils.hpp => utils.hpp} | 0 src/steam/steam.cpp | 98 ++++++++++--------- src/steam/steam.hpp | 47 ++++----- src/utils/hook.cpp | 8 +- src/utils/hook.hpp | 3 + 29 files changed, 110 insertions(+), 98 deletions(-) rename src/steam/interfaces/{SteamApps.cpp => apps.cpp} (97%) rename src/steam/interfaces/{SteamApps.hpp => apps.hpp} (100%) rename src/steam/interfaces/{SteamFriends.cpp => friends.cpp} (99%) rename src/steam/interfaces/{SteamFriends.hpp => friends.hpp} (100%) rename src/steam/interfaces/{SteamGameServer.cpp => game_server.cpp} (98%) rename src/steam/interfaces/{SteamGameServer.hpp => game_server.hpp} (100%) rename src/steam/interfaces/{SteamMasterServerUpdater.cpp => master_server_updater.cpp} (98%) rename src/steam/interfaces/{SteamMasterServerUpdater.hpp => master_server_updater.hpp} (100%) rename src/steam/interfaces/{SteamMatchmaking.cpp => matchmaking.cpp} (99%) rename src/steam/interfaces/{SteamMatchmaking.hpp => matchmaking.hpp} (100%) rename src/steam/interfaces/{SteamMatchmakingServers.cpp => matchmaking_servers.cpp} (98%) rename src/steam/interfaces/{SteamMatchmakingServers.hpp => matchmaking_servers.hpp} (100%) rename src/steam/interfaces/{SteamNetworking.cpp => networking.cpp} (99%) rename src/steam/interfaces/{SteamNetworking.hpp => networking.hpp} (100%) rename src/steam/interfaces/{SteamRemoteStorage.cpp => remote_storage.cpp} (96%) rename src/steam/interfaces/{SteamRemoteStorage.hpp => remote_storage.hpp} (100%) rename src/steam/interfaces/{SteamUser.cpp => user.cpp} (99%) rename src/steam/interfaces/{SteamUser.hpp => user.hpp} (100%) rename src/steam/interfaces/{SteamUserStats.cpp => user_stats.cpp} (99%) rename src/steam/interfaces/{SteamUserStats.hpp => user_stats.hpp} (100%) rename src/steam/interfaces/{SteamUtils.cpp => utils.cpp} (88%) rename src/steam/interfaces/{SteamUtils.hpp => utils.hpp} (100%) diff --git a/src/launcher/window.cpp b/src/launcher/window.cpp index 4dc5f3c..fdded0a 100644 --- a/src/launcher/window.cpp +++ b/src/launcher/window.cpp @@ -12,19 +12,19 @@ window::window(const std::string& title, const int width, const int height) this->wc_.cbSize = sizeof(this->wc_); this->wc_.style = CS_HREDRAW | CS_VREDRAW; - this->wc_.lpfnWndProc = window::static_processor; + this->wc_.lpfnWndProc = static_processor; this->wc_.hInstance = handle; this->wc_.hCursor = LoadCursor(nullptr, IDC_ARROW); this->wc_.hIcon = LoadIcon(handle, MAKEINTRESOURCE(102)); this->wc_.hIconSm = this->wc_.hIcon; this->wc_.hbrBackground = CreateSolidBrush(RGB(35, 35, 35)); - this->wc_.lpszClassName = L"omw3_window"; + this->wc_.lpszClassName = L"lul_window"; RegisterClassEx(&this->wc_); const auto x = (GetSystemMetrics(SM_CXSCREEN) - width) / 2; const auto y = (GetSystemMetrics(SM_CYSCREEN) - height) / 2; - this->handle_ = CreateWindowExA(NULL, "omw3_window", title.data(), + this->handle_ = CreateWindowExA(NULL, "lul_window", title.data(), (WS_OVERLAPPEDWINDOW | WS_VISIBLE) & ~(WS_THICKFRAME | WS_MAXIMIZEBOX), x, y, width, height, nullptr, nullptr, handle, nullptr); diff --git a/src/loader/module_loader.cpp b/src/loader/module_loader.cpp index a8d886a..63cd21f 100644 --- a/src/loader/module_loader.cpp +++ b/src/loader/module_loader.cpp @@ -5,22 +5,22 @@ std::vector>* module_loader::modules_ = nullptr; void module_loader::register_module(std::unique_ptr&& module_) { - if (!module_loader::modules_) + if (!modules_) { - module_loader::modules_ = new std::vector>(); - atexit(module_loader::destroy_modules); + modules_ = new std::vector>(); + atexit(destroy_modules); } - module_loader::modules_->push_back(std::move(module_)); + modules_->push_back(std::move(module_)); } void module_loader::post_load() { static auto handled = false; - if (handled || !module_loader::modules_) return; + if (handled || !modules_) return; handled = true; - for (const auto& module_ : *module_loader::modules_) + for (const auto& module_ : *modules_) { module_->post_load(); } @@ -29,10 +29,10 @@ void module_loader::post_load() void module_loader::pre_destroy() { static auto handled = false; - if (handled || !module_loader::modules_) return; + if (handled || !modules_) return; handled = true; - for (const auto& module_ : *module_loader::modules_) + for (const auto& module_ : *modules_) { module_->pre_destroy(); } @@ -40,10 +40,10 @@ void module_loader::pre_destroy() void module_loader::destroy_modules() { - module_loader::pre_destroy(); + pre_destroy(); - if (!module_loader::modules_) return; + if (!modules_) return; - delete module_loader::modules_; - module_loader::modules_ = nullptr; + delete modules_; + modules_ = nullptr; } diff --git a/src/std_include.hpp b/src/std_include.hpp index e8985ab..4579ff5 100644 --- a/src/std_include.hpp +++ b/src/std_include.hpp @@ -28,5 +28,3 @@ using namespace std::literals; #pragma warning(disable: 4100) #include "resource.hpp" - -#include "steam/steam.hpp" diff --git a/src/steam/interfaces/SteamApps.cpp b/src/steam/interfaces/apps.cpp similarity index 97% rename from src/steam/interfaces/SteamApps.cpp rename to src/steam/interfaces/apps.cpp index e966817..6ed09f5 100644 --- a/src/steam/interfaces/SteamApps.cpp +++ b/src/steam/interfaces/apps.cpp @@ -1,4 +1,5 @@ #include +#include "steam/steam.hpp" namespace steam { diff --git a/src/steam/interfaces/SteamApps.hpp b/src/steam/interfaces/apps.hpp similarity index 100% rename from src/steam/interfaces/SteamApps.hpp rename to src/steam/interfaces/apps.hpp diff --git a/src/steam/interfaces/SteamFriends.cpp b/src/steam/interfaces/friends.cpp similarity index 99% rename from src/steam/interfaces/SteamFriends.cpp rename to src/steam/interfaces/friends.cpp index 555dffb..524fec6 100644 --- a/src/steam/interfaces/SteamFriends.cpp +++ b/src/steam/interfaces/friends.cpp @@ -1,4 +1,5 @@ #include +#include "steam/steam.hpp" namespace steam { diff --git a/src/steam/interfaces/SteamFriends.hpp b/src/steam/interfaces/friends.hpp similarity index 100% rename from src/steam/interfaces/SteamFriends.hpp rename to src/steam/interfaces/friends.hpp diff --git a/src/steam/interfaces/SteamGameServer.cpp b/src/steam/interfaces/game_server.cpp similarity index 98% rename from src/steam/interfaces/SteamGameServer.cpp rename to src/steam/interfaces/game_server.cpp index d3b580e..addb0c0 100644 --- a/src/steam/interfaces/SteamGameServer.cpp +++ b/src/steam/interfaces/game_server.cpp @@ -1,4 +1,5 @@ #include +#include "steam/steam.hpp" namespace steam { diff --git a/src/steam/interfaces/SteamGameServer.hpp b/src/steam/interfaces/game_server.hpp similarity index 100% rename from src/steam/interfaces/SteamGameServer.hpp rename to src/steam/interfaces/game_server.hpp diff --git a/src/steam/interfaces/SteamMasterServerUpdater.cpp b/src/steam/interfaces/master_server_updater.cpp similarity index 98% rename from src/steam/interfaces/SteamMasterServerUpdater.cpp rename to src/steam/interfaces/master_server_updater.cpp index ab6778b..f3f5102 100644 --- a/src/steam/interfaces/SteamMasterServerUpdater.cpp +++ b/src/steam/interfaces/master_server_updater.cpp @@ -1,4 +1,5 @@ #include +#include "steam/steam.hpp" namespace steam { diff --git a/src/steam/interfaces/SteamMasterServerUpdater.hpp b/src/steam/interfaces/master_server_updater.hpp similarity index 100% rename from src/steam/interfaces/SteamMasterServerUpdater.hpp rename to src/steam/interfaces/master_server_updater.hpp diff --git a/src/steam/interfaces/SteamMatchmaking.cpp b/src/steam/interfaces/matchmaking.cpp similarity index 99% rename from src/steam/interfaces/SteamMatchmaking.cpp rename to src/steam/interfaces/matchmaking.cpp index 040ab09..4dbccef 100644 --- a/src/steam/interfaces/SteamMatchmaking.cpp +++ b/src/steam/interfaces/matchmaking.cpp @@ -1,4 +1,5 @@ #include +#include "steam/steam.hpp" namespace steam { diff --git a/src/steam/interfaces/SteamMatchmaking.hpp b/src/steam/interfaces/matchmaking.hpp similarity index 100% rename from src/steam/interfaces/SteamMatchmaking.hpp rename to src/steam/interfaces/matchmaking.hpp diff --git a/src/steam/interfaces/SteamMatchmakingServers.cpp b/src/steam/interfaces/matchmaking_servers.cpp similarity index 98% rename from src/steam/interfaces/SteamMatchmakingServers.cpp rename to src/steam/interfaces/matchmaking_servers.cpp index 0445566..841dd94 100644 --- a/src/steam/interfaces/SteamMatchmakingServers.cpp +++ b/src/steam/interfaces/matchmaking_servers.cpp @@ -1,4 +1,5 @@ #include +#include "steam/steam.hpp" namespace steam { diff --git a/src/steam/interfaces/SteamMatchmakingServers.hpp b/src/steam/interfaces/matchmaking_servers.hpp similarity index 100% rename from src/steam/interfaces/SteamMatchmakingServers.hpp rename to src/steam/interfaces/matchmaking_servers.hpp diff --git a/src/steam/interfaces/SteamNetworking.cpp b/src/steam/interfaces/networking.cpp similarity index 99% rename from src/steam/interfaces/SteamNetworking.cpp rename to src/steam/interfaces/networking.cpp index c1c43ed..2858dc5 100644 --- a/src/steam/interfaces/SteamNetworking.cpp +++ b/src/steam/interfaces/networking.cpp @@ -1,4 +1,5 @@ #include +#include "steam/steam.hpp" namespace steam { diff --git a/src/steam/interfaces/SteamNetworking.hpp b/src/steam/interfaces/networking.hpp similarity index 100% rename from src/steam/interfaces/SteamNetworking.hpp rename to src/steam/interfaces/networking.hpp diff --git a/src/steam/interfaces/SteamRemoteStorage.cpp b/src/steam/interfaces/remote_storage.cpp similarity index 96% rename from src/steam/interfaces/SteamRemoteStorage.cpp rename to src/steam/interfaces/remote_storage.cpp index c2f5602..14c293f 100644 --- a/src/steam/interfaces/SteamRemoteStorage.cpp +++ b/src/steam/interfaces/remote_storage.cpp @@ -1,4 +1,5 @@ #include +#include "steam/steam.hpp" namespace steam { diff --git a/src/steam/interfaces/SteamRemoteStorage.hpp b/src/steam/interfaces/remote_storage.hpp similarity index 100% rename from src/steam/interfaces/SteamRemoteStorage.hpp rename to src/steam/interfaces/remote_storage.hpp diff --git a/src/steam/interfaces/SteamUser.cpp b/src/steam/interfaces/user.cpp similarity index 99% rename from src/steam/interfaces/SteamUser.cpp rename to src/steam/interfaces/user.cpp index 4ab8c6c..3073f69 100644 --- a/src/steam/interfaces/SteamUser.cpp +++ b/src/steam/interfaces/user.cpp @@ -1,4 +1,5 @@ #include +#include "steam/steam.hpp" namespace steam { diff --git a/src/steam/interfaces/SteamUser.hpp b/src/steam/interfaces/user.hpp similarity index 100% rename from src/steam/interfaces/SteamUser.hpp rename to src/steam/interfaces/user.hpp diff --git a/src/steam/interfaces/SteamUserStats.cpp b/src/steam/interfaces/user_stats.cpp similarity index 99% rename from src/steam/interfaces/SteamUserStats.cpp rename to src/steam/interfaces/user_stats.cpp index 8a2c2c5..acdf49e 100644 --- a/src/steam/interfaces/SteamUserStats.cpp +++ b/src/steam/interfaces/user_stats.cpp @@ -1,4 +1,5 @@ #include +#include "steam/steam.hpp" namespace steam { diff --git a/src/steam/interfaces/SteamUserStats.hpp b/src/steam/interfaces/user_stats.hpp similarity index 100% rename from src/steam/interfaces/SteamUserStats.hpp rename to src/steam/interfaces/user_stats.hpp diff --git a/src/steam/interfaces/SteamUtils.cpp b/src/steam/interfaces/utils.cpp similarity index 88% rename from src/steam/interfaces/SteamUtils.cpp rename to src/steam/interfaces/utils.cpp index c879065..7100f41 100644 --- a/src/steam/interfaces/SteamUtils.cpp +++ b/src/steam/interfaces/utils.cpp @@ -1,4 +1,5 @@ #include +#include "steam/steam.hpp" namespace steam { @@ -54,14 +55,9 @@ namespace steam void utils::SetOverlayNotificationPosition(int eNotificationPosition) { - if (steam::overlay) + if (overlay) { - const auto set_position = GetProcAddress(steam::overlay, "SetNotificationPosition"); - - if (set_position) - { - reinterpret_cast(set_position)(eNotificationPosition); - } + overlay.invoke("SetNotificationPosition", eNotificationPosition); } } diff --git a/src/steam/interfaces/SteamUtils.hpp b/src/steam/interfaces/utils.hpp similarity index 100% rename from src/steam/interfaces/SteamUtils.hpp rename to src/steam/interfaces/utils.hpp diff --git a/src/steam/steam.cpp b/src/steam/steam.cpp index e058797..9dccd81 100644 --- a/src/steam/steam.cpp +++ b/src/steam/steam.cpp @@ -1,8 +1,9 @@ #include +#include "steam/steam.hpp" namespace steam { - HMODULE overlay = nullptr; + ::utils::nt::module overlay(nullptr); uint64_t callbacks::call_id_ = 0; std::recursive_mutex callbacks::mutex_; @@ -13,52 +14,52 @@ namespace steam uint64_t callbacks::register_call() { - std::lock_guard _(callbacks::mutex_); - callbacks::calls_[++callbacks::call_id_] = false; - return callbacks::call_id_; + std::lock_guard _(mutex_); + calls_[++call_id_] = false; + return call_id_; } - void callbacks::register_callback(callbacks::base* handler, const int callback) + void callbacks::register_callback(base* handler, const int callback) { - std::lock_guard _(callbacks::mutex_); + std::lock_guard _(mutex_); handler->set_i_callback(callback); - callbacks::callback_list_.push_back(handler); + callback_list_.push_back(handler); } - void callbacks::register_call_result(const uint64_t call, callbacks::base* result) + void callbacks::register_call_result(const uint64_t call, base* result) { - std::lock_guard _(callbacks::mutex_); - callbacks::result_handlers_[call] = result; + std::lock_guard _(mutex_); + result_handlers_[call] = result; } void callbacks::return_call(void* data, const int size, const int type, const uint64_t call) { - std::lock_guard _(callbacks::mutex_); + std::lock_guard _(mutex_); - callbacks::result result; + result result{}; result.call = call; result.data = data; result.size = size; result.type = type; - callbacks::calls_[call] = true; + calls_[call] = true; - callbacks::results_.push_back(result); + results_.push_back(result); } void callbacks::run_callbacks() { - std::lock_guard _(callbacks::mutex_); + std::lock_guard _(mutex_); - for (auto result : callbacks::results_) + for (auto result : results_) { - if (callbacks::result_handlers_.find(result.call) != callbacks::result_handlers_.end()) + if (result_handlers_.find(result.call) != result_handlers_.end()) { - callbacks::result_handlers_[result.call]->run(result.data, false, result.call); + result_handlers_[result.call]->run(result.data, false, result.call); } - for (auto callback : callbacks::callback_list_) + for (auto callback : callback_list_) { if (callback && callback->get_i_callback() == result.type) { @@ -72,7 +73,7 @@ namespace steam } } - callbacks::results_.clear(); + results_.clear(); } extern "C" @@ -84,7 +85,7 @@ namespace steam bool SteamAPI_Init() { - overlay = GetModuleHandleA("gameoverlayrenderer.dll"); + overlay = ::utils::nt::module("gameoverlayrenderer.dll"); if (!overlay) { @@ -96,11 +97,14 @@ namespace steam RegQueryValueExA(reg_key, "InstallPath", nullptr, nullptr, reinterpret_cast(steam_path), &length); RegCloseKey(reg_key); - SetDllDirectoryA(steam_path); + std::string overlay_path = steam_path; + if(overlay_path.back() != '\\' && overlay_path.back() != '/') + { + overlay_path.push_back('\\'); + } - strcat_s(steam_path, "gameoverlayrenderer.dll"); - - overlay = LoadLibraryA(steam_path); + overlay_path.append("gameoverlayrenderer.dll"); + overlay = ::utils::nt::module::load(overlay_path); } } @@ -149,69 +153,69 @@ namespace steam } - steam::friends* SteamFriends() + friends* SteamFriends() { - static steam::friends friends; + static friends friends; return &friends; } - steam::matchmaking* SteamMatchmaking() + matchmaking* SteamMatchmaking() { - static steam::matchmaking matchmaking; + static matchmaking matchmaking; return &matchmaking; } - steam::matchmaking_servers* SteamMatchmakingServers() + matchmaking_servers* SteamMatchmakingServers() { - static steam::matchmaking_servers matchmaking_servers; + static matchmaking_servers matchmaking_servers; return &matchmaking_servers; } - steam::game_server* SteamGameServer() + game_server* SteamGameServer() { - static steam::game_server game_server; + static game_server game_server; return &game_server; } - steam::master_server_updater* SteamMasterServerUpdater() + master_server_updater* SteamMasterServerUpdater() { - static steam::master_server_updater master_server_updater; + static master_server_updater master_server_updater; return &master_server_updater; } - steam::networking* SteamNetworking() + networking* SteamNetworking() { - static steam::networking networking; + static networking networking; return &networking; } - steam::remote_storage* SteamRemoteStorage() + remote_storage* SteamRemoteStorage() { - static steam::remote_storage remote_storage; + static remote_storage remote_storage; return &remote_storage; } - steam::user* SteamUser() + user* SteamUser() { - static steam::user user; + static user user; return &user; } - steam::utils* SteamUtils() + utils* SteamUtils() { - static steam::utils utils; + static utils utils; return &utils; } - steam::apps* SteamApps() + apps* SteamApps() { - static steam::apps apps; + static apps apps; return &apps; } - steam::user_stats* SteamUserStats() + user_stats* SteamUserStats() { - static steam::user_stats user_stats; + static user_stats user_stats; return &user_stats; } } diff --git a/src/steam/steam.hpp b/src/steam/steam.hpp index e1730bc..8086311 100644 --- a/src/steam/steam.hpp +++ b/src/steam/steam.hpp @@ -1,6 +1,7 @@ #pragma once #define STEAM_EXPORT extern "C" __declspec(dllexport) +#include "utils/nt.hpp" struct raw_steam_id final { @@ -16,17 +17,17 @@ typedef union unsigned long long bits; } steam_id; -#include "interfaces/SteamApps.hpp" -#include "interfaces/SteamUser.hpp" -#include "interfaces/SteamUtils.hpp" -#include "interfaces/SteamFriends.hpp" -#include "interfaces/SteamUserStats.hpp" -#include "interfaces/SteamGameServer.hpp" -#include "interfaces/SteamNetworking.hpp" -#include "interfaces/SteamMatchmaking.hpp" -#include "interfaces/SteamRemoteStorage.hpp" -#include "interfaces/SteamMatchmakingServers.hpp" -#include "interfaces/SteamMasterServerUpdater.hpp" +#include "interfaces/apps.hpp" +#include "interfaces/user.hpp" +#include "interfaces/utils.hpp" +#include "interfaces/friends.hpp" +#include "interfaces/user_stats.hpp" +#include "interfaces/game_server.hpp" +#include "interfaces/networking.hpp" +#include "interfaces/matchmaking.hpp" +#include "interfaces/remote_storage.hpp" +#include "interfaces/matchmaking_servers.hpp" +#include "interfaces/master_server_updater.hpp" namespace steam { @@ -86,17 +87,17 @@ namespace steam STEAM_EXPORT void SteamGameServer_RunCallbacks(); STEAM_EXPORT void SteamGameServer_Shutdown(); - STEAM_EXPORT steam::friends* SteamFriends(); - STEAM_EXPORT steam::matchmaking* SteamMatchmaking(); - STEAM_EXPORT steam::matchmaking_servers* SteamMatchmakingServers(); - STEAM_EXPORT steam::game_server* SteamGameServer(); - STEAM_EXPORT steam::master_server_updater* SteamMasterServerUpdater(); - STEAM_EXPORT steam::networking* SteamNetworking(); - STEAM_EXPORT steam::remote_storage* SteamRemoteStorage(); - STEAM_EXPORT steam::user* SteamUser(); - STEAM_EXPORT steam::utils* SteamUtils(); - STEAM_EXPORT steam::apps* SteamApps(); - STEAM_EXPORT steam::user_stats* SteamUserStats(); + STEAM_EXPORT friends* SteamFriends(); + STEAM_EXPORT matchmaking* SteamMatchmaking(); + STEAM_EXPORT matchmaking_servers* SteamMatchmakingServers(); + STEAM_EXPORT game_server* SteamGameServer(); + STEAM_EXPORT master_server_updater* SteamMasterServerUpdater(); + STEAM_EXPORT networking* SteamNetworking(); + STEAM_EXPORT remote_storage* SteamRemoteStorage(); + STEAM_EXPORT user* SteamUser(); + STEAM_EXPORT utils* SteamUtils(); + STEAM_EXPORT apps* SteamApps(); + STEAM_EXPORT user_stats* SteamUserStats(); - extern HMODULE overlay; + extern ::utils::nt::module overlay; } diff --git a/src/utils/hook.cpp b/src/utils/hook.cpp index a96b390..f966364 100644 --- a/src/utils/hook.cpp +++ b/src/utils/hook.cpp @@ -37,9 +37,9 @@ namespace utils } } - void hook::signature::add(const hook::signature::container& container) + void hook::signature::add(const container& container) { - hook::signature::signatures_.push_back(container); + signatures_.push_back(container); } hook::~hook() @@ -103,9 +103,9 @@ namespace utils void hook::quick() { - if (hook::installed_) + if (this->installed_) { - hook::installed_ = false; + this->installed_ = false; } } diff --git a/src/utils/hook.hpp b/src/utils/hook.hpp index 0c0bae1..5b40650 100644 --- a/src/utils/hook.hpp +++ b/src/utils/hook.hpp @@ -40,6 +40,9 @@ namespace utils hook(const DWORD place, const DWORD stub, const bool use_jump = true) : hook(reinterpret_cast(place), reinterpret_cast(stub), use_jump) {} hook(const DWORD place, void(*stub)(), const bool use_jump = true) : hook(reinterpret_cast(place), reinterpret_cast(stub), use_jump) {} + hook(const hook&) = delete; + hook(const hook&&) = delete; + ~hook(); hook* initialize(void* place, void* stub, bool use_jump = true);