forked from Hay1tsme/segatools
add vsprintf hook
This commit is contained in:
parent
ba9fb5d0b9
commit
eb93c6cf75
@ -229,7 +229,6 @@ static HRESULT touch_cmd_dispatch(char* cmd, struct iobuf *dest, uint8_t side)
|
|||||||
|
|
||||||
else if (!strcmp(cmd, CMD_HALT)) {
|
else if (!strcmp(cmd, CMD_HALT)) {
|
||||||
dprintf("Mai2 touch%d: Halt\n", side);
|
dprintf("Mai2 touch%d: Halt\n", side);
|
||||||
Sleep(1001); // ?
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
#include "util/dprintf.h"
|
#include "util/dprintf.h"
|
||||||
|
|
||||||
static BOOL WINAPI misc_ExitWindowsEx(unsigned int flags, uint32_t reason);
|
static BOOL WINAPI misc_ExitWindowsEx(unsigned int flags, uint32_t reason);
|
||||||
|
static int my_vsprintf(char *const buffer, const char *const format, va_list args);
|
||||||
|
static int (*next_vsprintf)(char *const buffer, const char *const format, va_list args);
|
||||||
|
|
||||||
static HRESULT misc_read_os_version(void *bytes, uint32_t *nbytes);
|
static HRESULT misc_read_os_version(void *bytes, uint32_t *nbytes);
|
||||||
static HRESULT misc_read_app_loader_count(void *bytes, uint32_t *nbytes);
|
static HRESULT misc_read_app_loader_count(void *bytes, uint32_t *nbytes);
|
||||||
@ -29,6 +31,14 @@ static const struct hook_symbol misc_syms[] = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const struct hook_symbol logging_sym[] = {
|
||||||
|
{
|
||||||
|
.name = "vsprintf",
|
||||||
|
.patch = my_vsprintf,
|
||||||
|
.link = (void **) &next_vsprintf,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
static const struct reg_hook_val misc_root_keys[] = {
|
static const struct reg_hook_val misc_root_keys[] = {
|
||||||
{
|
{
|
||||||
.name = L"OSVersion",
|
.name = L"OSVersion",
|
||||||
@ -130,6 +140,7 @@ HRESULT misc_hook_init(const struct misc_config *cfg, const char *platform_id)
|
|||||||
/* Apply function hooks */
|
/* Apply function hooks */
|
||||||
|
|
||||||
hook_table_apply(NULL, "user32.dll", misc_syms, _countof(misc_syms));
|
hook_table_apply(NULL, "user32.dll", misc_syms, _countof(misc_syms));
|
||||||
|
hook_table_apply(NULL, "msvcr110.dll", logging_sym, _countof(logging_sym));
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
@ -170,3 +181,10 @@ static HRESULT misc_read_platform_name(void *bytes, uint32_t *nbytes)
|
|||||||
{
|
{
|
||||||
return reg_hook_read_wstr(bytes, nbytes, L"ALLS MX2.1"); // TODO: Dynamic
|
return reg_hook_read_wstr(bytes, nbytes, L"ALLS MX2.1"); // TODO: Dynamic
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int my_vsprintf(char *const buffer, const char *const format, va_list args)
|
||||||
|
{
|
||||||
|
int ret = next_vsprintf(buffer, format, args);
|
||||||
|
dprintf("%s\n", buffer);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user