mirror of
https://gitea.tendokyu.moe/TeamTofuShop/capnhook.git
synced 2026-10-07 14:28:02 +03:00
allow iohook and serial_hook to land on DLLs loaded after initialization
This commit is contained in:
+10
-5
@@ -229,11 +229,7 @@ static void iohook_init(void)
|
||||
|
||||
/* Splice iohook into IAT entries referencing Win32 I/O APIs */
|
||||
|
||||
hook_table_apply(
|
||||
NULL,
|
||||
"kernel32.dll",
|
||||
iohook_kernel32_syms,
|
||||
_countof(iohook_kernel32_syms));
|
||||
iohook_apply_hooks(NULL);
|
||||
|
||||
/* Here be dragons:
|
||||
|
||||
@@ -281,6 +277,15 @@ static void iohook_init(void)
|
||||
LeaveCriticalSection(&iohook_lock);
|
||||
}
|
||||
|
||||
void iohook_apply_hooks(HMODULE target)
|
||||
{
|
||||
hook_table_apply(
|
||||
target,
|
||||
"kernel32.dll",
|
||||
iohook_kernel32_syms,
|
||||
_countof(iohook_kernel32_syms));
|
||||
}
|
||||
|
||||
// Deprecated
|
||||
HANDLE iohook_open_dummy_fd(void)
|
||||
{
|
||||
|
||||
@@ -48,3 +48,4 @@ __attribute__((deprecated("Use iohook_open_nul_fd instead")))
|
||||
HRESULT iohook_open_nul_fd(HANDLE *fd);
|
||||
HRESULT iohook_push_handler(iohook_fn_t fn);
|
||||
HRESULT iohook_invoke_next(struct irp *irp);
|
||||
void iohook_apply_hooks(HMODULE target);
|
||||
|
||||
+5
-1
@@ -84,10 +84,14 @@ void serial_hook_init(void)
|
||||
return;
|
||||
}
|
||||
|
||||
hook_table_apply(NULL, "kernel32.dll", serial_syms, _countof(serial_syms));
|
||||
serial_hook_apply_hooks(NULL);
|
||||
serial_hook_initted = true;
|
||||
}
|
||||
|
||||
void serial_hook_apply_hooks(HMODULE target) {
|
||||
hook_table_apply(target, "kernel32.dll", serial_syms, _countof(serial_syms));
|
||||
}
|
||||
|
||||
static BOOL WINAPI my_ClearCommError(
|
||||
HANDLE fd,
|
||||
uint32_t *errors,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#pragma once
|
||||
|
||||
void serial_hook_init(void);
|
||||
void serial_hook_apply_hooks(HMODULE target);
|
||||
|
||||
Reference in New Issue
Block a user