bananatools/taikohook/network.c

60 lines
1.3 KiB
C

#include <windows.h>
#include "taikohook/network.h"
#include "hook/table.h"
#include "util/dprintf.h"
/*
* Forces Taiko to use TLS v1.2 instead of 1.0
* This was made to solve a niche issue with
* the server stack I was using. Recomend
* leaving it disabled.
*/
void network_insert_hooks(HMODULE target);
static uint64_t my_TLSv1_method(uint64_t a1, uint64_t flag);
static uint64_t (*next_TLSv1_2_method)(uint64_t a1, uint64_t flag);
static uint64_t (*next_TLSv1_method)(uint64_t a1, uint64_t flag);
static const struct hook_symbol nethook_syms[] = {
{
.link = (void *) &next_TLSv1_2_method,
.ordinal = 341
},
{
.patch = my_TLSv1_method,
.link = (void *) &next_TLSv1_method,
.ordinal = 172
},
};
HRESULT network_hook_init(const struct taiko_network_config *cfg)
{
if (!cfg->enable) {
return S_FALSE;
}
dprintf("Nethook: Init\n");
network_insert_hooks(NULL);
return S_OK;
}
void network_insert_hooks(HMODULE target)
{
hook_table_apply(
target,
"SSLEAY32.dll",
nethook_syms,
_countof(nethook_syms)
);
}
static uint64_t my_TLSv1_method(uint64_t a1, uint64_t flag)
{
dprintf("Nethook: Redirect TLS v1.0 to v1.2\n");
return next_TLSv1_2_method(a1, flag);
}