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:
+2
-8
@@ -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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user