diff --git a/chunihook/dllmain.c b/chunihook/dllmain.c index b75ce35..c6781fd 100644 --- a/chunihook/dllmain.c +++ b/chunihook/dllmain.c @@ -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(); diff --git a/minihook/dllmain.c b/minihook/dllmain.c index 2a3ba7a..76de549 100644 --- a/minihook/dllmain.c +++ b/minihook/dllmain.c @@ -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__); diff --git a/util/clock.c b/util/clock.c index e22f14f..5e51b70 100644 --- a/util/clock.c +++ b/util/clock.c @@ -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)); } diff --git a/util/clock.h b/util/clock.h index 30e53e8..f3d242e 100644 --- a/util/clock.h +++ b/util/clock.h @@ -1,4 +1,3 @@ #pragma once -void clock_set_hook_init(void); -void clock_skew_hook_init(void); +void clock_hook_init(void);