-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathsys_hook.h
More file actions
38 lines (28 loc) · 722 Bytes
/
sys_hook.h
File metadata and controls
38 lines (28 loc) · 722 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#pragma once
#include "types.h"
struct sys_hook {
unsigned int *x86_sct;
unsigned long long *x64_sct;
struct sys_hook_ent *head, *tail;
};
enum sys_hook_type {
SHT_X86,
SHT_X64,
};
struct sys_hook_ent {
struct sys_hook_ent *next;
unsigned int syscall_id;
uintptr_t original, hooked;
enum sys_hook_type type;
};
#define CR0_WRITE_PROTECT (1 << 16)
struct sys_hook *
sys_hook_init(uintptr_t k32, uintptr_t k64);
bool_t
sys_hook_add64(struct sys_hook *, unsigned int syscall_id, void *func);
bool_t
sys_hook_del64(struct sys_hook *, unsigned int syscall_id);
uintptr_t
sys_hook_get_orig64(struct sys_hook *, unsigned int syscall_id);
void
sys_hook_free(struct sys_hook *hook);