misc: add _snprintf hook
This commit is contained in:
parent
47196e0ac4
commit
42bdad96a6
@ -18,6 +18,9 @@ static int WINAPI my_ShowCursor(BOOL bShow);
|
||||
static BOOL WINAPI my_GetCursorInfo(PCURSORINFO pci);
|
||||
static UINT WINAPI my_GetDriveTypeA(LPCSTR lpRootPathName);
|
||||
|
||||
static int my_snprintf(char *const buffer, const size_t buffer_count, const char *const format, ...);
|
||||
static int (*next_snprintf)(char *const buffer, const size_t buffer_count, const char *const format, ...);
|
||||
|
||||
static HRESULT reg_read_sys_ver(void *bytes, uint32_t *nbytes);
|
||||
|
||||
static BOOL (WINAPI *next_BlockInput)(BOOL fBlockIt);
|
||||
@ -52,6 +55,14 @@ static const struct hook_symbol misc_k32_syms[] = {
|
||||
},
|
||||
};
|
||||
|
||||
static const struct hook_symbol misc_msvcr120_syms[] = {
|
||||
{
|
||||
.name = "_snprintf",
|
||||
.patch = my_snprintf,
|
||||
.link = (void **) &next_snprintf,
|
||||
},
|
||||
};
|
||||
|
||||
static const struct reg_hook_val nbgi_reg[] = {
|
||||
{
|
||||
.name = L"SystemVersion",
|
||||
@ -80,6 +91,12 @@ HRESULT misc_hook_init(const struct misc_config *cfg)
|
||||
misc_k32_syms,
|
||||
_countof(misc_k32_syms));
|
||||
|
||||
hook_table_apply(
|
||||
NULL,
|
||||
"MSVCR120.dll",
|
||||
misc_msvcr120_syms,
|
||||
_countof(misc_msvcr120_syms));
|
||||
|
||||
reg_hook_push_key(
|
||||
HKEY_LOCAL_MACHINE,
|
||||
L"SOFTWARE\\NBGI",
|
||||
@ -166,3 +183,14 @@ static UINT WINAPI my_GetDriveTypeA(LPCSTR lpRootPathName)
|
||||
default: return next_GetDriveTypeA(lpRootPathName);
|
||||
}
|
||||
}
|
||||
|
||||
static int my_snprintf(char *const buffer, const size_t buffer_count, const char *const format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
int ret = 0;
|
||||
|
||||
va_start(ap, format);
|
||||
ret = next_snprintf(buffer, buffer_count, format, ap);
|
||||
OutputDebugStringA(buffer);
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user