bananatools/saohook/touch.c

41 lines
864 B
C

#include <windows.h>
#include "hook/table.h"
#include "hooklib/reg.h"
#include "util/dprintf.h"
#include "saohook/touch.h"
static int WINAPI my_GetSystemMetrics(int nIndex);
static int (WINAPI *next_GetSystemMetrics)(int nIndex);
static const struct hook_symbol touch_user32_syms[] = {
{
.name = "GetSystemMetrics",
.patch = my_GetSystemMetrics,
.link = (void **) &next_GetSystemMetrics,
},
};
HRESULT sao_touch_hook_init(const struct sao_touch_config *cfg)
{
if (!cfg->enable) {
return S_OK;
}
hook_table_apply(
NULL,
"User32.dll",
touch_user32_syms,
_countof(touch_user32_syms));
return S_OK;
}
static int WINAPI my_GetSystemMetrics(int nIndex)
{
if (nIndex == SM_DIGITIZER) {
return NID_MULTI_INPUT;
}
return next_GetSystemMetrics(nIndex);
}