forked from Hay1tsme/segatools
util/clock.c: Add hook to prevent date/time changes
This commit is contained in:
parent
acfa53fc5c
commit
851ea65609
39
util/clock.c
Normal file
39
util/clock.c
Normal file
@ -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;
|
||||
}
|
3
util/clock.h
Normal file
3
util/clock.h
Normal file
@ -0,0 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
void clock_hook_init(void);
|
@ -7,6 +7,8 @@ util_lib = static_library(
|
||||
capnhook.get_variable('hook_dep'),
|
||||
],
|
||||
sources : [
|
||||
'clock.c',
|
||||
'clock.h',
|
||||
'crc.c',
|
||||
'crc.h',
|
||||
'dprintf.c',
|
||||
|
Loading…
Reference in New Issue
Block a user