diff --git a/util/clock.c b/util/clock.c new file mode 100644 index 00000000..60e623a1 --- /dev/null +++ b/util/clock.c @@ -0,0 +1,39 @@ +#include "hook/table.h" + +#include "util/dprintf.h" + +static BOOL WINAPI my_SetSystemTime(void *whatever); +static BOOL WINAPI my_SetTimeZoneInformation(void *whatever); + +static const struct hook_symbol clock_hook_syms[] = { + { + .name = "SetSystemTime", + .patch = my_SetSystemTime, + }, { + .name = "SetTimeZoneInformation", + .patch = my_SetTimeZoneInformation, + } +}; + +void clock_hook_init(void) +{ + hook_table_apply( + NULL, + "kernel32.dll", + clock_hook_syms, + _countof(clock_hook_syms)); +} + +static BOOL WINAPI my_SetSystemTime(void *whatever) +{ + dprintf("Prevented application from screwing with the system clock\n"); + + return TRUE; +} + +static BOOL WINAPI my_SetTimeZoneInformation(void *whatever) +{ + dprintf("Prevented application from screwing with the timezone\n"); + + return TRUE; +} diff --git a/util/clock.h b/util/clock.h new file mode 100644 index 00000000..f3d242e0 --- /dev/null +++ b/util/clock.h @@ -0,0 +1,3 @@ +#pragma once + +void clock_hook_init(void); diff --git a/util/meson.build b/util/meson.build index 0fa3470b..7a8d6fa9 100644 --- a/util/meson.build +++ b/util/meson.build @@ -7,6 +7,8 @@ util_lib = static_library( capnhook.get_variable('hook_dep'), ], sources : [ + 'clock.c', + 'clock.h', 'crc.c', 'crc.h', 'dprintf.c',