taiko: dongle and card reader fixes.

FIXME: Crash on entering testmode
This commit is contained in:
Hay1tsme 2025-01-19 17:57:20 -05:00 committed by Dniel97
parent 72d06a99cd
commit 66d88423f5
No known key found for this signature in database
GPG Key ID: DE105D481972329C
6 changed files with 32 additions and 9 deletions

View File

@ -79,6 +79,12 @@ HRESULT dns_platform_hook_init(const struct dns_config *cfg)
return hr;
}
hr = dns_hook_push(L"stable.garm.nbgi-amnet.jp", cfg->startup);
if (FAILED(hr)) {
return hr;
}
// if your ISP resolves bad domains, it will kill the network. These 2
// *cannot* resolve

View File

@ -7,11 +7,12 @@
#include "hook/table.h"
#include "hook/iohook.h"
#include "hook/procaddr.h"
#include "hooklib/setupapi.h"
#include "util/dprintf.h"
#include "util/str.h"
#include "es3sec.h"
#include "platform/es3sec.h"
#define DONGLE_STR_IDX_MANUFACTURER 1
#define DONGLE_STR_IDX_PRODUCT 2
@ -195,7 +196,9 @@ HRESULT es3sec_hook_init(
return hr;
}
hook_table_apply(NULL, "setupapi.dll", cm_syms, _countof(cm_syms));
es3sec_insert_hooks(NULL);
//hook_table_apply(NULL, "setupapi.dll", cm_syms, _countof(cm_syms));
proc_addr_table_push(NULL, "setupapi.dll", cm_syms, _countof(cm_syms));
CM_Locate_DevNodeW(&root_dev_inst, NULL, CM_LOCATE_DEVNODE_NORMAL);
@ -215,6 +218,14 @@ HRESULT es3sec_hook_init(
return S_OK;
}
void es3sec_insert_hooks(HMODULE target) {
hook_table_apply(
target,
"setupapi.dll",
cm_syms,
_countof(cm_syms));
}
static HRESULT es3sec_handle_hub_irp(struct irp *irp)
{
assert(irp != NULL);
@ -332,6 +343,8 @@ static HRESULT es3sec_hub_handle_roothub(struct irp *irp)
size_t size_of_hub_name = sizeof(DEVNAME_HUB);
ULONG actual_length = size_of_hub_name + sizeof(USB_ROOT_HUB_NAME);
HRESULT hr;
dprintf("ES3 Dongle: Request root hub\n");
if (irp->read.nbytes == sizeof(USB_ROOT_HUB_NAME)) { // Root hub name size
USB_ROOT_HUB_NAME rhub;

View File

@ -13,3 +13,5 @@ HRESULT es3sec_hook_init(
USHORT pid,
const wchar_t *manufacturer,
const wchar_t *product);
void es3sec_insert_hooks(HMODULE target);

View File

@ -1,7 +1,7 @@
#include <windows.h>
#include <stdlib.h>
#include "taikohook/config.h"
#include "platform/es3sec.h"
#include "hook/table.h"
#include "hook/iohook.h"
@ -10,6 +10,7 @@
#include "hooklib/path.h"
#include "hooklib/setupapi.h"
#include "hooklib/serial.h"
#include "hook/procaddr.h"
#include "util/dprintf.h"
@ -22,8 +23,8 @@
*/
static const wchar_t *target_modules[] = {
L"AMFrameWork.dll",
L"nbamUsbfinder.dll",
L"bngrw.dll",
};
static const size_t target_modules_len = _countof(target_modules);
@ -48,7 +49,7 @@ static const struct hook_symbol kernel32_syms[] = {
}
};
HRESULT amfw_hook_init(wchar_t serial[13])
HRESULT amfw_hook_init()
{
HANDLE hMod;
@ -66,8 +67,8 @@ HRESULT amfw_hook_init(wchar_t serial[13])
dprintf("AMFW: Found AMFrameWork Handle\n");
path_hook_insert_hooks(hMod);
dll_hook_insert_hooks(hMod);
setupapi_hook_insert_hooks(hMod);
proc_addr_insert_hooks(hMod);
serial_hook_apply_hooks(hMod);
iohook_apply_hooks(hMod);
@ -157,8 +158,9 @@ static HMODULE WINAPI hook_LoadLibraryW(const wchar_t *name)
dprintf("Taiko: Hooked %S\n", target_module);
dll_hook_insert_hooks(result);
// path_hook_insert_hooks(result);
path_hook_insert_hooks(result);
setupapi_hook_insert_hooks(result);
es3sec_insert_hooks(result);
serial_hook_apply_hooks(result);
iohook_apply_hooks(result);

View File

@ -1,4 +1,4 @@
#pragma once
#include <windows.h>
HRESULT amfw_hook_init(wchar_t *serial);
HRESULT amfw_hook_init();

View File

@ -71,7 +71,7 @@ static DWORD CALLBACK taiko_pre_startup(void)
ExitProcess(EXIT_FAILURE);
}
hr = amfw_hook_init(taiko_hook_cfg.platform.dongle.serial);
hr = amfw_hook_init();
if (FAILED(hr)) {
ExitProcess(EXIT_FAILURE);