From b4a9e8fd79dabeecb3c2ede06731aca54d34fde6 Mon Sep 17 00:00:00 2001 From: acidicoala <67734819+acidicoala@users.noreply.github.com> Date: Sat, 20 Sep 2025 07:36:49 +0500 Subject: [PATCH] Switch to DLL_MAIN helper --- KoalaBox | 2 +- src/main_win.cpp | 7 ++++--- src/smoke_api/smoke_api.cpp | 4 ++-- src/smoke_api/smoke_api.hpp | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/KoalaBox b/KoalaBox index a658f5b..83fb5af 160000 --- a/KoalaBox +++ b/KoalaBox @@ -1 +1 @@ -Subproject commit a658f5b179dd6734598d5a9c1ef18ca326c192c0 +Subproject commit 83fb5af5e2f0a864d361cd885c25342d19264586 diff --git a/src/main_win.cpp b/src/main_win.cpp index b7f16af..7af96fa 100644 --- a/src/main_win.cpp +++ b/src/main_win.cpp @@ -1,13 +1,14 @@ +#include + #include "smoke_api/smoke_api.hpp" // This header will be populated at build time #include "linker_exports_for_steam_api.h" #include "linker_exports_for_version.h" -EXTERN_C [[maybe_unused]] BOOL WINAPI -DllMain(const HMODULE module_handle, const DWORD reason, LPVOID) { +DLL_MAIN(void* handle, const uint32_t reason, void*) { if(reason == DLL_PROCESS_ATTACH) { - smoke_api::init(module_handle); + smoke_api::init(handle); } else if(reason == DLL_PROCESS_DETACH) { smoke_api::shutdown(); } diff --git a/src/smoke_api/smoke_api.cpp b/src/smoke_api/smoke_api.cpp index 6932236..96674d5 100644 --- a/src/smoke_api/smoke_api.cpp +++ b/src/smoke_api/smoke_api.cpp @@ -114,7 +114,7 @@ namespace { } namespace smoke_api { - void init(const HMODULE module_handle) { + void init(void* module_handle) { try { kb::globals::init_globals(module_handle, PROJECT_NAME); @@ -131,7 +131,7 @@ namespace smoke_api { const auto exe_name = kb::path::to_str(exe_path.filename()); LOG_DEBUG("Process name: '{}' [{}-bit]", exe_name, kb::util::BITNESS); - LOG_DEBUG("Self handle: {}", reinterpret_cast(module_handle)); + LOG_DEBUG("Self handle: {}", module_handle); // We need to hook functions in either mode kb::hook::init(true); diff --git a/src/smoke_api/smoke_api.hpp b/src/smoke_api/smoke_api.hpp index 5eb4dd2..c52d416 100644 --- a/src/smoke_api/smoke_api.hpp +++ b/src/smoke_api/smoke_api.hpp @@ -16,7 +16,7 @@ constexpr auto STEAM_GAME_SERVER = "SteamGameServer"; namespace smoke_api { - void init(HMODULE module_handle); + void init(void* module_handle); void shutdown(); AppId_t get_app_id();