tekken: fix io

platform: add gethostbyname hook
This commit is contained in:
2023-11-12 05:13:44 -05:00
parent 5e5614d24b
commit cd10a98dcc
12 changed files with 177 additions and 29 deletions

View File

@ -16,12 +16,14 @@
static BOOL WINAPI my_BlockInput(BOOL fBlockIt);
static int WINAPI my_ShowCursor(BOOL bShow);
static BOOL WINAPI my_GetCursorInfo(PCURSORINFO pci);
static UINT WINAPI my_GetDriveTypeA(LPCSTR lpRootPathName);
static HRESULT reg_read_sys_ver(void *bytes, uint32_t *nbytes);
static BOOL (WINAPI *next_BlockInput)(BOOL fBlockIt);
static int (WINAPI *next_ShowCursor)(BOOL bShow);
static BOOL (WINAPI *next_GetCursorInfo)(PCURSORINFO pci);
static UINT (WINAPI *next_GetDriveTypeA)(LPCSTR lpRootPathName);
static struct misc_config config;
static int real_cursor_state = 0;
@ -42,6 +44,14 @@ static const struct hook_symbol misc_hook_syms[] = {
}
};
static const struct hook_symbol misc_k32_syms[] = {
{
.name = "GetDriveTypeA",
.patch = my_GetDriveTypeA,
.link = (void **) &next_GetDriveTypeA,
},
};
static const struct reg_hook_val nbgi_reg[] = {
{
.name = L"SystemVersion",
@ -63,6 +73,12 @@ HRESULT misc_hook_init(const struct misc_config *cfg)
"User32.dll",
misc_hook_syms,
_countof(misc_hook_syms));
hook_table_apply(
NULL,
"kernel32.dll",
misc_k32_syms,
_countof(misc_k32_syms));
reg_hook_push_key(
HKEY_LOCAL_MACHINE,
@ -124,4 +140,29 @@ static HRESULT reg_read_sys_ver(void *bytes, uint32_t *nbytes)
{
dprintf("Misc: Get system version\n");
return reg_hook_read_wstr(bytes, nbytes, config.system_version);
}
static UINT WINAPI my_GetDriveTypeA(LPCSTR lpRootPathName)
{
dprintf("Misc: Get Drive Type for %s\n", lpRootPathName);
switch (lpRootPathName[0]) {
case 'C':
case 'c':
case 'D':
case 'd':
case 'E':
case 'e':
case 'F':
case 'f':
case 'G':
case 'g':
case 'H':
case 'h':
case 'I':
case 'i':
case 'J':
case 'j': return DRIVE_FIXED;
default: return next_GetDriveTypeA(lpRootPathName);
}
}