This commit is contained in:
恍兮惚兮 2024-10-30 13:39:02 +08:00
parent d80d92f586
commit 05de2db240
2 changed files with 31 additions and 1 deletions

View File

@ -32,6 +32,11 @@ namespace
if (i < 4) if (i < 4)
{ {
hp->offset = i << 2; hp->offset = i << 2;
if (i == 2 && hp->user_value != 1)
{
hp->split = get_stack(1);
hp->type |= USING_SPLIT;
}
*data = val; *data = val;
*len = 2; *len = 2;
hp->text_fun = nullptr; hp->text_fun = nullptr;
@ -66,6 +71,21 @@ namespace
return false; return false;
if (DWORD i = SafeFindEnclosingAlignedFunction((DWORD)s, 0x200)) 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; HookParam hp;
hp.address = i; hp.address = i;
hp.text_fun = SpecialHookRUGP1; hp.text_fun = SpecialHookRUGP1;

View File

@ -93,7 +93,17 @@ uintptr_t getasbaddr(const HookParam &hp)
{ {
if (hp.type & FUNCTION_OFFSET) 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; address += (uint64_t)function;
else else
return ConsoleOutput(FUNC_MISSING), 0; return ConsoleOutput(FUNC_MISSING), 0;