hooklib/clock.c: Split clock read and write hooks

This commit is contained in:
Tau
2019-08-21 12:52:39 -04:00
parent 65ccaf55f3
commit 94005de9e9
6 changed files with 27 additions and 10 deletions

View File

@ -17,7 +17,7 @@ static BOOL WINAPI my_SetTimeZoneInformation(TIME_ZONE_INFORMATION *tzinfo);
static BOOL (WINAPI * next_GetSystemTimeAsFileTime)(FILETIME *out);
static int64_t clock_current_day;
static const struct hook_symbol clock_hook_syms[] = {
static const struct hook_symbol clock_read_hook_syms[] = {
{
.name = "GetSystemTimeAsFileTime",
.patch = my_GetSystemTimeAsFileTime,
@ -31,7 +31,11 @@ static const struct hook_symbol clock_hook_syms[] = {
}, {
.name = "GetTimeZoneInformation",
.patch = my_GetTimeZoneInformation,
}, {
},
};
static const struct hook_symbol clock_write_hook_syms[] = {
{
.name = "SetLocalTime",
.patch = my_SetLocalTime,
}, {
@ -203,11 +207,20 @@ static BOOL WINAPI my_SetTimeZoneInformation(TIME_ZONE_INFORMATION *in)
return TRUE;
}
void clock_hook_init(void)
void clock_read_hook_init(void)
{
hook_table_apply(
NULL,
"kernel32.dll",
clock_hook_syms,
_countof(clock_hook_syms));
clock_read_hook_syms,
_countof(clock_read_hook_syms));
}
void clock_write_hook_init(void)
{
hook_table_apply(
NULL,
"kernel32.dll",
clock_write_hook_syms,
_countof(clock_write_hook_syms));
}

View File

@ -1,3 +1,4 @@
#pragma once
void clock_hook_init(void);
void clock_read_hook_init(void);
void clock_write_hook_init(void);