move reg and epay hook insert to it's own function

This commit is contained in:
Hay1tsme 2023-12-10 18:48:40 -05:00
parent 103baa269e
commit 49c31853e6
4 changed files with 21 additions and 8 deletions

View File

@ -274,11 +274,16 @@ static void reg_hook_init(void)
}
reg_hook_initted = true;
reg_hook_apply_hooks(NULL);
InitializeCriticalSection(&reg_hook_lock);
dprintf("Reg hook init\n");
}
void reg_hook_apply_hooks(HMODULE target)
{
hook_table_apply(
NULL,
target,
"advapi32.dll",
reg_hook_syms,
_countof(reg_hook_syms));

View File

@ -5,6 +5,8 @@
#include <stddef.h>
#include <stdint.h>
void reg_hook_apply_hooks(HMODULE target);
struct reg_hook_val {
const wchar_t *name;
HRESULT (*read)(void *bytes, uint32_t *nbytes);

View File

@ -163,12 +163,8 @@ HRESULT epay_hook_init(const struct epay_config *cfg) {
epay_tcap_url1_keys,
_countof(epay_tcap_url1_keys));
hook_table_apply(
NULL,
"ThincaPayment.dll",
epay_syms,
_countof(epay_syms));
epay_insert_hook(NULL);
thinca_stub = (struct thinca_main *)malloc(sizeof(struct thinca_main));
thinca_stub->impl1 = (struct thinca_impl *)malloc(sizeof(struct thinca_impl));
@ -194,6 +190,15 @@ HRESULT epay_hook_init(const struct epay_config *cfg) {
return hr;
}
void epay_insert_hook(HMODULE target)
{
hook_table_apply(
target,
"ThincaPayment.dll",
epay_syms,
_countof(epay_syms));
}
static HRESULT misc_read_thinca_adapter(void *bytes, uint32_t *nbytes)
{
return reg_hook_read_wstr(bytes, nbytes, L"aime_rw_adapterMD.dll");

View File

@ -60,4 +60,5 @@ struct thinca_main {
};
#pragma pack(pop)
HRESULT epay_hook_init(const struct epay_config *cfg);
HRESULT epay_hook_init(const struct epay_config *cfg);
void epay_insert_hook(HMODULE target);