refactor/feat: Signature scan improvements

> use reverse pattern search instead, fixes performance issue for some hooks
> sigscan still requires overhead of module copy for each operation
This commit is contained in:
[ ]
2026-02-18 07:42:11 +09:00
parent 82439962d6
commit 0834646097
4 changed files with 104 additions and 70 deletions
+2 -8
View File
@@ -92,14 +92,8 @@ bool on_thum_exists_(void *titleUTF_getter, int32_t id, char flag)
void attach(HINSTANCE hmodule)
{
// Reverse lookup function head (PUSH RDI) for ThumExists() specific signature, quietly fail if invalid
intptr_t beg, match, TX_ThumExists;
TX_ThumExists = beg = match = find_pattern_from(hmodule, "83f801750c4084ff750732c0", "XXXXXXXXXXXX", 0, 0, 0);
while (beg > sizeof(void *) && match >= TX_ThumExists)
{
beg -= sizeof(void *);
match = find_pattern_from(hmodule, "4057", "XX", 0, 0, beg - reinterpret_cast<intptr_t>(hmodule));
}
TX_ThumExists = match;
intptr_t TX_ThumExists = find_pattern_from(hmodule, "4057", "XX", 0, 0,
find_pattern_from(hmodule, "83f801750c4084ff750732c0", "XXXXXXXXXXXX", 0, 0, 0) - reinterpret_cast<intptr_t>(hmodule), true);
log_info("hooks::wmisc::thumbnail", "Hooking ThumExists({})", reinterpret_cast<void *>(TX_ThumExists));
detour::trampoline_try(reinterpret_cast<void *>(TX_ThumExists), reinterpret_cast<void *>(on_thum_exists_), reinterpret_cast<void **>(&ThumExists));
}