From 5c2d85fbd663f809ec8693187513204b74f50c50 Mon Sep 17 00:00:00 2001 From: FunkyFr3sh Date: Wed, 11 Aug 2021 01:36:12 +0200 Subject: [PATCH] improve IAT hooks --- src/hook.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/hook.c b/src/hook.c index 07980fe..1c1a711 100644 --- a/src/hook.c +++ b/src/hook.c @@ -278,7 +278,9 @@ void hook_create(HOOKLIST* hooks, BOOL initial_hook) _strcmpi(mod_filename, "Shw32") == 0) continue; - if (_strnicmp(game_dir, mod_dir, strlen(game_dir)) == 0) + if (_strnicmp(game_dir, mod_dir, strlen(game_dir)) == 0 || + _strcmpi(mod_filename, "quartz") == 0 || + _strcmpi(mod_filename, "winmm") == 0) { hook_patch_iat_list(hmod, FALSE, hooks); } @@ -331,6 +333,7 @@ void hook_revert(HOOKLIST* hooks) char mod_path[MAX_PATH] = { 0 }; char mod_dir[MAX_PATH] = { 0 }; + char mod_filename[MAX_PATH] = { 0 }; HMODULE hmod = NULL; HANDLE process = NULL; @@ -349,9 +352,11 @@ void hook_revert(HOOKLIST* hooks) if (GetModuleFileNameA(hmod, mod_path, MAX_PATH)) { - _splitpath(mod_path, NULL, mod_dir, NULL, NULL); + _splitpath(mod_path, NULL, mod_dir, mod_filename, NULL); - if (_strnicmp(game_dir, mod_dir, strlen(game_dir)) == 0) + if (_strnicmp(game_dir, mod_dir, strlen(game_dir)) == 0 || + _strcmpi(mod_filename, "quartz") == 0 || + _strcmpi(mod_filename, "winmm") == 0) { hook_patch_iat_list(hmod, TRUE, hooks); }