From 60f1311dba9864896784b0eb7f76ed1bccb7efed Mon Sep 17 00:00:00 2001 From: Alexandr <94700659+alexvann@users.noreply.github.com> Date: Tue, 21 Dec 2021 19:09:34 +0300 Subject: [PATCH] Added export function GetModuleBaseAddress() Added export function to get the actual sokuroll base address --- modules/SWRSokuRoll/SWRSokuRoll.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/SWRSokuRoll/SWRSokuRoll.cpp b/modules/SWRSokuRoll/SWRSokuRoll.cpp index 95d669fb..8cde8724 100644 --- a/modules/SWRSokuRoll/SWRSokuRoll.cpp +++ b/modules/SWRSokuRoll/SWRSokuRoll.cpp @@ -7,6 +7,7 @@ const BYTE TARGET_HASH[16] = {0xdf, 0x35, 0xd1, 0xfb, 0xc7, 0xb5, 0x83, 0x31, 0x7a, 0xda, 0xbe, 0x8c, 0xd9, 0xf5, 0x3b, 0x2e}; static char s_profilePath[1024 + MAX_PATH]; +static HMEMORYMODULE handle = nullptr; #pragma pack(push, 1) struct SokuRollParams { @@ -26,7 +27,7 @@ unsigned __stdcall loadDelay(void *) { // but wasting 1 second here is fine and mimicks the current manual behaviour anyways. Sleep(1000); - HMEMORYMODULE handle = MemoryLoadLibrary(&sokuroll_data, sokuroll_size); + handle = MemoryLoadLibrary(&sokuroll_data, sokuroll_size); if (handle == NULL) { return 0; } @@ -36,6 +37,10 @@ unsigned __stdcall loadDelay(void *) { } extern "C" { + __declspec(dllexport) HMODULE GetModuleBaseAddress() { + return (HMODULE)(static_cast(handle)->codeBase); + } + __declspec(dllexport) bool CheckVersion(const BYTE hash[16]) { return ::memcmp(TARGET_HASH, hash, sizeof TARGET_HASH) == 0; }