2023-01-03 05:35:53 +01:00
|
|
|
#include <windows.h>
|
|
|
|
|
|
|
|
#include "taikohook/network.h"
|
|
|
|
|
|
|
|
#include "hook/table.h"
|
|
|
|
|
|
|
|
#include "util/dprintf.h"
|
|
|
|
|
2023-07-11 05:21:36 +02:00
|
|
|
/*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2023-01-03 05:35:53 +01:00
|
|
|
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
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2023-07-11 05:21:36 +02:00
|
|
|
HRESULT network_hook_init(const struct taiko_network_config *cfg)
|
2023-01-03 05:35:53 +01:00
|
|
|
{
|
|
|
|
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);
|
|
|
|
}
|