Combine both clock hooks

Turns out the clock skew doesn't really work unless RTC and TZ
changes are blocked as well.
This commit is contained in:
Tau 2018-11-23 14:23:16 -05:00
parent 1725cfb9ac
commit 51994d59ff
4 changed files with 9 additions and 30 deletions

View File

@ -43,8 +43,7 @@ static DWORD CALLBACK chuni_pre_startup(void)
/* Hook Win32 APIs */
clock_set_hook_init();
clock_skew_hook_init();
clock_hook_init();
gfx_hook_init();
serial_hook_init();

View File

@ -17,7 +17,7 @@ static DWORD CALLBACK app_pre_startup(void)
ds_hook_init();
nusec_hook_init();
clock_skew_hook_init();
clock_hook_init();
spike_hook_init("minispike.txt");
dprintf("--- End %s ---\n", __func__);

View File

@ -16,18 +16,12 @@ 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_skew_hook_syms[] = {
/* Canonical time */
static const struct hook_symbol clock_hook_syms[] = {
{
.name = "GetSystemTimeAsFileTime",
.patch = my_GetSystemTimeAsFileTime,
.link = (void **) &next_GetSystemTimeAsFileTime,
},
/* Derived time */
{
}, {
.name = "GetLocalTime",
.patch = my_GetLocalTime,
}, {
@ -36,11 +30,7 @@ static const struct hook_symbol clock_skew_hook_syms[] = {
}, {
.name = "GetTimeZoneInformation",
.patch = my_GetTimeZoneInformation,
},
};
static const struct hook_symbol clock_set_hook_syms[] = {
{
}, {
.name = "SetSystemTime",
.patch = my_SetSystemTime,
}, {
@ -182,20 +172,11 @@ static BOOL WINAPI my_SetTimeZoneInformation(TIME_ZONE_INFORMATION *in)
return TRUE;
}
void clock_set_hook_init(void)
void clock_hook_init(void)
{
hook_table_apply(
NULL,
"kernel32.dll",
clock_set_hook_syms,
_countof(clock_set_hook_syms));
}
void clock_skew_hook_init(void)
{
hook_table_apply(
NULL,
"kernel32.dll",
clock_skew_hook_syms,
_countof(clock_skew_hook_syms));
clock_hook_syms,
_countof(clock_hook_syms));
}

View File

@ -1,4 +1,3 @@
#pragma once
void clock_set_hook_init(void);
void clock_skew_hook_init(void);
void clock_hook_init(void);