diff --git a/LunaHook/engine32/RUGP.cpp b/LunaHook/engine32/RUGP.cpp index 01940d7..c106446 100644 --- a/LunaHook/engine32/RUGP.cpp +++ b/LunaHook/engine32/RUGP.cpp @@ -32,6 +32,11 @@ namespace if (i < 4) { hp->offset = i << 2; + if (i == 2 && hp->user_value != 1) + { + hp->split = get_stack(1); + hp->type |= USING_SPLIT; + } *data = val; *len = 2; hp->text_fun = nullptr; @@ -66,6 +71,21 @@ namespace return false; if (DWORD i = SafeFindEnclosingAlignedFunction((DWORD)s, 0x200)) { + auto [s, e] = Util::QueryModuleLimits((HMODULE)low); + auto refs = findxref_reverse_checkcallop(i, s, e, 0xe8); + if (refs.size() == 1) + { + auto f2 = findfuncstart(refs[0], 0x100, true); + if (f2) + { + HookParam hp; + hp.address = f2; + hp.text_fun = SpecialHookRUGP1; + hp.user_value = 1; + hp.type = CODEC_ANSI_BE | USING_CHAR; + return NewHook(hp, "rUGP"); + } + } HookParam hp; hp.address = i; hp.text_fun = SpecialHookRUGP1; diff --git a/LunaHook/texthook.cc b/LunaHook/texthook.cc index c366465..5f28856 100644 --- a/LunaHook/texthook.cc +++ b/LunaHook/texthook.cc @@ -93,7 +93,17 @@ uintptr_t getasbaddr(const HookParam &hp) { if (hp.type & FUNCTION_OFFSET) { - if (FARPROC function = GetProcAddress(GetModuleHandleW(hp.module), hp.function)) + FARPROC function = NULL; + try + { + auto ordinal = std::stoi(hp.function); + function = GetProcAddress(GetModuleHandleW(hp.module), (LPCSTR)ordinal); + } + catch (...) + { + function = GetProcAddress(GetModuleHandleW(hp.module), hp.function); + } + if (function) address += (uint64_t)function; else return ConsoleOutput(FUNC_MISSING), 0;