-
-
Notifications
You must be signed in to change notification settings - Fork 260
/
Copy pathgumprocess.h
124 lines (105 loc) · 4.33 KB
/
gumprocess.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/*
* Copyright (C) 2008-2024 Ole André Vadla Ravnås <[email protected]>
* Copyright (C) 2020-2024 Francesco Tamagni <[email protected]>
* Copyright (C) 2023 Grant Douglas <[email protected]>
* Copyright (C) 2024 Håvard Sørbø <[email protected]>
*
* Licence: wxWindows Library Licence, Version 3.1
*/
#ifndef __GUM_PROCESS_H__
#define __GUM_PROCESS_H__
#include <gum/gummemory.h>
#include <gum/gummodule.h>
#define GUM_THREAD_ID_INVALID ((GumThreadId) -1)
#define GUM_TYPE_MODULE_DETAILS (gum_module_details_get_type ())
G_BEGIN_DECLS
typedef guint GumProcessId;
typedef gsize GumThreadId;
typedef struct _GumThreadDetails GumThreadDetails;
typedef struct _GumMallocRangeDetails GumMallocRangeDetails;
typedef enum {
GUM_TEARDOWN_REQUIREMENT_FULL,
GUM_TEARDOWN_REQUIREMENT_MINIMAL
} GumTeardownRequirement;
typedef enum {
GUM_CODE_SIGNING_OPTIONAL,
GUM_CODE_SIGNING_REQUIRED
} GumCodeSigningPolicy;
typedef enum {
GUM_MODIFY_THREAD_FLAGS_NONE = 0,
GUM_MODIFY_THREAD_FLAGS_ABORT_SAFELY = (1 << 0),
} GumModifyThreadFlags;
typedef enum {
GUM_THREAD_RUNNING = 1,
GUM_THREAD_STOPPED,
GUM_THREAD_WAITING,
GUM_THREAD_UNINTERRUPTIBLE,
GUM_THREAD_HALTED
} GumThreadState;
struct _GumThreadDetails
{
GumThreadId id;
const gchar * name;
GumThreadState state;
GumCpuContext cpu_context;
};
typedef enum {
GUM_WATCH_READ = (1 << 0),
GUM_WATCH_WRITE = (1 << 1),
} GumWatchConditions;
struct _GumMallocRangeDetails
{
const GumMemoryRange * range;
};
typedef void (* GumModifyThreadFunc) (GumThreadId thread_id,
GumCpuContext * cpu_context, gpointer user_data);
typedef gboolean (* GumFoundThreadFunc) (const GumThreadDetails * details,
gpointer user_data);
typedef gboolean (* GumFoundModuleFunc) (GumModule * module,
gpointer user_data);
typedef gboolean (* GumFoundMallocRangeFunc) (
const GumMallocRangeDetails * details, gpointer user_data);
GUM_API GumOS gum_process_get_native_os (void);
GUM_API GumTeardownRequirement gum_process_get_teardown_requirement (void);
GUM_API void gum_process_set_teardown_requirement (
GumTeardownRequirement requirement);
GUM_API GumCodeSigningPolicy gum_process_get_code_signing_policy (void);
GUM_API void gum_process_set_code_signing_policy (GumCodeSigningPolicy policy);
GUM_API gboolean gum_process_is_debugger_attached (void);
GUM_API GumProcessId gum_process_get_id (void);
GUM_API GumThreadId gum_process_get_current_thread_id (void);
GUM_API gboolean gum_process_has_thread (GumThreadId thread_id);
GUM_API gboolean gum_process_modify_thread (GumThreadId thread_id,
GumModifyThreadFunc func, gpointer user_data, GumModifyThreadFlags flags);
GUM_API void gum_process_enumerate_threads (GumFoundThreadFunc func,
gpointer user_data);
GUM_API GumModule * gum_process_get_main_module (void);
GUM_API GumModule * gum_process_get_libc_module (void);
GUM_API GumModule * gum_process_find_module_by_name (const gchar * name);
GUM_API GumModule * gum_process_find_module_by_address (GumAddress address);
GUM_API void gum_process_enumerate_modules (GumFoundModuleFunc func,
gpointer user_data);
GUM_API void gum_process_enumerate_ranges (GumPageProtection prot,
GumFoundRangeFunc func, gpointer user_data);
GUM_API void gum_process_enumerate_malloc_ranges (
GumFoundMallocRangeFunc func, gpointer user_data);
GUM_API guint gum_thread_try_get_ranges (GumMemoryRange * ranges,
guint max_length);
GUM_API gint gum_thread_get_system_error (void);
GUM_API void gum_thread_set_system_error (gint value);
GUM_API gboolean gum_thread_suspend (GumThreadId thread_id, GError ** error);
GUM_API gboolean gum_thread_resume (GumThreadId thread_id, GError ** error);
GUM_API gboolean gum_thread_set_hardware_breakpoint (GumThreadId thread_id,
guint breakpoint_id, GumAddress address, GError ** error);
GUM_API gboolean gum_thread_unset_hardware_breakpoint (GumThreadId thread_id,
guint breakpoint_id, GError ** error);
GUM_API gboolean gum_thread_set_hardware_watchpoint (GumThreadId thread_id,
guint watchpoint_id, GumAddress address, gsize size, GumWatchConditions wc,
GError ** error);
GUM_API gboolean gum_thread_unset_hardware_watchpoint (GumThreadId thread_id,
guint watchpoint_id, GError ** error);
GUM_API const gchar * gum_code_signing_policy_to_string (
GumCodeSigningPolicy policy);
GUM_API const gchar * gum_symbol_type_to_string (GumSymbolType type);
G_END_DECLS
#endif