emoney: Add Thinca authentication card stuff #35

Open
Haruka wants to merge 6 commits from Haruka/segatools:thinca_auth into develop
3 changed files with 22 additions and 5 deletions
Showing only changes of commit 6dacc8bad3 - Show all commits

View File

@ -175,20 +175,24 @@ static void dns_hook_init(void)
dns_hook_initted = true;
InitializeCriticalSection(&dns_hook_lock);
dns_hook_apply_hooks(NULL);
}
void dns_hook_apply_hooks(HMODULE mod){
hook_table_apply(
NULL,
mod,
"dnsapi.dll",
dns_hook_syms_dnsapi,
_countof(dns_hook_syms_dnsapi));
hook_table_apply(
NULL,
mod,
"ws2_32.dll",
dns_hook_syms_ws2,
_countof(dns_hook_syms_ws2));
hook_table_apply(
NULL,
mod,
"winhttp.dll",
dns_hook_syms_winhttp,
_countof(dns_hook_syms_winhttp));
@ -488,6 +492,8 @@ static int WSAAPI hook_getaddrinfo(
goto end;
}
dprintf("getaddrinfo: %s, %s\n", pNodeName, pServiceName);
mbstowcs_s(&wstr_c, NULL, 0, pNodeName, 0);
wstr = malloc(wstr_c * sizeof(wchar_t));

View File

@ -7,3 +7,4 @@
// if to_src is NULL, all lookups for from_src will fail
HRESULT dns_hook_push(const wchar_t *from_src, const wchar_t *to_src);
void dns_hook_apply_hooks(HMODULE mod);

View File

@ -7,6 +7,7 @@
#include "hook/table.h"
#include "hooklib/dns.h"
#include "hooklib/reg.h"
#include "platform/epay.h"
@ -172,6 +173,15 @@ HRESULT epay_hook_init(const struct epay_config *cfg) {
return hr;
}
dprintf("EPay: Registry initialized\n");
// HACK:(?) thincahttpclient.dll is loaded dynamically so we just preload it and apply DNS hooks to it
HMODULE thincahttpclient = LoadLibraryA("thincahttpclient.dll");
if (thincahttpclient != NULL){
dns_hook_apply_hooks(thincahttpclient);
dprintf("EPay: DNS hooked\n");
}
if (cfg->hook) {
hook_table_apply(
NULL,
@ -199,7 +209,7 @@ HRESULT epay_hook_init(const struct epay_config *cfg) {
thinca_stub->impl1->unk220 = thinca_unk;
thinca_stub->impl1->unk228 = thinca_unk;
dprintf("Epay: Init\n");
dprintf("Epay: Hooks initialized\n");
}
return hr;