-
Notifications
You must be signed in to change notification settings - Fork 248
/
gumx86relocator.h
72 lines (53 loc) · 2.09 KB
/
gumx86relocator.h
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*
* Copyright (C) 2009-2017 Ole André Vadla Ravnås <[email protected]>
*
* Licence: wxWindows Library Licence, Version 3.1
*/
#ifndef __GUM_X86_RELOCATOR_H__
#define __GUM_X86_RELOCATOR_H__
#include "gumx86writer.h"
#include <capstone.h>
G_BEGIN_DECLS
typedef struct _GumX86Relocator GumX86Relocator;
struct _GumX86Relocator
{
volatile gint ref_count;
csh capstone;
const guint8 * input_start;
const guint8 * input_cur;
GumAddress input_pc;
cs_insn ** input_insns;
GumX86Writer * output;
guint inpos;
guint outpos;
gboolean eob;
gboolean eoi;
};
GUM_API GumX86Relocator * gum_x86_relocator_new (gconstpointer input_code,
GumX86Writer * output);
GUM_API GumX86Relocator * gum_x86_relocator_ref (GumX86Relocator * relocator);
GUM_API void gum_x86_relocator_unref (GumX86Relocator * relocator);
GUM_API void gum_x86_relocator_init (GumX86Relocator * relocator,
gconstpointer input_code, GumX86Writer * output);
GUM_API void gum_x86_relocator_clear (GumX86Relocator * relocator);
GUM_API void gum_x86_relocator_reset (GumX86Relocator * relocator,
gconstpointer input_code, GumX86Writer * output);
GUM_API guint gum_x86_relocator_read_one (GumX86Relocator * self,
const cs_insn ** instruction);
GUM_API cs_insn * gum_x86_relocator_peek_next_write_insn (
GumX86Relocator * self);
GUM_API gpointer gum_x86_relocator_peek_next_write_source (
GumX86Relocator * self);
GUM_API void gum_x86_relocator_skip_one (GumX86Relocator * self);
GUM_API void gum_x86_relocator_skip_one_no_label (GumX86Relocator * self);
GUM_API gboolean gum_x86_relocator_write_one (GumX86Relocator * self);
GUM_API gboolean gum_x86_relocator_write_one_no_label (GumX86Relocator * self);
GUM_API void gum_x86_relocator_write_all (GumX86Relocator * self);
GUM_API gboolean gum_x86_relocator_eob (GumX86Relocator * self);
GUM_API gboolean gum_x86_relocator_eoi (GumX86Relocator * self);
GUM_API gboolean gum_x86_relocator_can_relocate (gpointer address,
guint min_bytes, guint * maximum);
GUM_API guint gum_x86_relocator_relocate (gpointer from, guint min_bytes,
gpointer to);
G_END_DECLS
#endif