102 Patches: Detours to the Rescue
C reference for DttR maintainers and modders.
Loading...
Searching...
No Matches
dttr_core.h
Go to the documentation of this file.
1
4
5#ifndef DTTR_Core_H
6#define DTTR_Core_H
7
8#include <stdbool.h>
9#include <stddef.h>
10#include <stdint.h>
11
12#include <windows.h>
13
14#include <dttr_result.h>
15#include <dttr_runtime.h>
16
17#ifndef DTTR_ARRAY_COUNT
18#define DTTR_ARRAY_COUNT(array) (sizeof(array) / sizeof((array)[0]))
19#endif
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
27
37
51
60
68 const char *aob,
69 uintptr_t *out_addr
70);
71
80 const char *sig,
81 const char *mask,
82 uintptr_t *out_addr
83);
84
90DTTR_Result DTTR_Core_AOBFindInModule(HMODULE mod, const char *aob, uintptr_t *out_addr);
91
100 const DTTR_Core_Context *ctx,
101 uintptr_t address,
102 const uint8_t *bytes,
103 size_t size,
104 DTTR_Core_Patch **out_patch
105);
106
117 const DTTR_Core_Context *ctx,
118 uintptr_t address,
119 int prologue_size,
120 void *detour,
121 void **out_original,
122 DTTR_Core_Hook **out_hook
123);
124
135 const DTTR_Core_Context *ctx,
136 const char *aob,
137 intptr_t offset,
138 int prologue_size,
139 void *detour,
140 void **out_original,
141 DTTR_Core_Hook **out_hook
142);
143
151 const DTTR_Core_Context *ctx,
152 uintptr_t address,
153 void *detour,
154 DTTR_Core_Patch **out_patch
155);
156
165 const DTTR_Core_Context *ctx,
166 const char *aob,
167 intptr_t offset,
168 void *detour,
169 DTTR_Core_Patch **out_patch
170);
171
180 const DTTR_Core_Context *ctx,
181 uintptr_t address,
182 void *new_value,
183 void **out_original,
184 DTTR_Core_Hook **out_hook
185);
186
189
194
200 const DTTR_Core_Context *ctx,
201 DTTR_Core_PatchGroup **out_group
202);
203
208
214
220
230 uintptr_t address,
231 const uint8_t *bytes,
232 size_t size,
233 DTTR_Core_Patch **out_patch
234);
235
246 uintptr_t address,
247 int prologue_size,
248 void *detour,
249 void **out_original,
250 DTTR_Core_Hook **out_hook
251);
252
262 uintptr_t address,
263 void *new_value,
264 void **out_original,
265 DTTR_Core_Hook **out_hook
266);
267
276 uintptr_t address,
277 void *detour,
278 DTTR_Core_Patch **out_patch
279);
280
290 const DTTR_Core_TargetSpec *targets,
291 size_t target_count,
292 DTTR_Core_TargetReport *out_report
293);
294
295#ifdef __cplusplus
296}
297#endif
298
299#endif // DTTR_Core_H
void void * ctx
const DWORD size
DTTR_Result DTTR_Core_PatchGroupDestroy(DTTR_Core_PatchGroup *group)
Definition core.c:642
DTTR_Core_Hook DTTR_Core_Patch
Definition dttr_core.h:26
DTTR_Result DTTR_Core_HookFunction(const DTTR_Core_Context *ctx, uintptr_t address, int prologue_size, void *detour, void **out_original, DTTR_Core_Hook **out_hook)
Definition core.c:336
DTTR_Result DTTR_Core_AOBFindInModule(HMODULE mod, const char *aob, uintptr_t *out_addr)
Definition core.c:238
DTTR_Result DTTR_Core_SignatureFind(const DTTR_Core_Context *ctx, const char *sig, const char *mask, uintptr_t *out_addr)
Definition core.c:269
DTTR_Result DTTR_Core_PatchRel32Jump(const DTTR_Core_Context *ctx, uintptr_t address, void *detour, DTTR_Core_Patch **out_patch)
Definition core.c:421
DTTR_Result DTTR_Core_PatchGroupCreate(const DTTR_Core_Context *ctx, DTTR_Core_PatchGroup **out_group)
Definition core.c:607
DTTR_Result DTTR_Core_PatchAOBRel32Jump(const DTTR_Core_Context *ctx, const char *aob, intptr_t offset, void *detour, DTTR_Core_Patch **out_patch)
Definition core.c:446
DTTR_Result DTTR_Core_PatchGroupPatchRel32Jump(DTTR_Core_PatchGroup *group, uintptr_t address, void *detour, DTTR_Core_Patch **out_patch)
Definition core.c:786
DTTR_Result DTTR_Core_PatchGroupHookPointer(DTTR_Core_PatchGroup *group, uintptr_t address, void *new_value, void **out_original, DTTR_Core_Hook **out_hook)
Definition core.c:757
DTTR_Result DTTR_Core_PatchGroupRelease(DTTR_Core_PatchGroup **group)
Definition core.c:657
DTTR_Result DTTR_Core_Unpatch(DTTR_Core_Patch *patch)
Detach a byte patch created by the SDK runtime.
Definition core.c:509
DTTR_Result DTTR_Core_HookAOB(const DTTR_Core_Context *ctx, const char *aob, intptr_t offset, int prologue_size, void *detour, void **out_original, DTTR_Core_Hook **out_hook)
Definition core.c:380
DTTR_Result DTTR_Core_PatchGroupUninstall(DTTR_Core_PatchGroup *group)
Definition core.c:634
DTTR_Result DTTR_Core_AOBFind(const DTTR_Core_Context *ctx, const char *aob, uintptr_t *out_addr)
Definition core.c:247
DTTR_Result DTTR_Core_PatchBytes(const DTTR_Core_Context *ctx, uintptr_t address, const uint8_t *bytes, size_t size, DTTR_Core_Patch **out_patch)
Definition core.c:302
DTTR_Result DTTR_Core_HookPointer(const DTTR_Core_Context *ctx, uintptr_t address, void *new_value, void **out_original, DTTR_Core_Hook **out_hook)
Definition core.c:472
DTTR_Result DTTR_Core_PatchGroupHookFunction(DTTR_Core_PatchGroup *group, uintptr_t address, int prologue_size, void *detour, void **out_original, DTTR_Core_Hook **out_hook)
Definition core.c:726
DTTR_Core_TargetKind
Definition dttr_core.h:28
@ DTTR_TARGET_ADDRESS_REL32_JMP
Definition dttr_core.h:34
@ DTTR_TARGET_ADDRESS_HOOK
Definition dttr_core.h:31
@ DTTR_TARGET_POINTER_HOOK
Definition dttr_core.h:33
@ DTTR_TARGET_ADDRESS_PATCH
Definition dttr_core.h:29
@ DTTR_TARGET_AOB_PATCH
Definition dttr_core.h:30
@ DTTR_TARGET_AOB_REL32_JMP
Definition dttr_core.h:35
@ DTTR_TARGET_AOB_HOOK
Definition dttr_core.h:32
DTTR_Result DTTR_Core_Unhook(DTTR_Core_Hook *hook)
Definition core.c:517
DTTR_Result DTTR_Core_PatchGroupInstallTargets(DTTR_Core_PatchGroup *group, const DTTR_Core_TargetSpec *targets, size_t target_count, DTTR_Core_TargetReport *out_report)
Definition core.c:826
DTTR_Result DTTR_Core_PatchGroupPatchBytes(DTTR_Core_PatchGroup *group, uintptr_t address, const uint8_t *bytes, size_t size, DTTR_Core_Patch **out_patch)
Definition core.c:697
struct DTTR_Core_PatchGroup DTTR_Core_PatchGroup
Definition dttr_core.h:25
DTTR_Status
Definition dttr_result.h:13
const char * message
Definition dttr_core.h:58
DTTR_Core_TargetKind kind
Definition dttr_core.h:39
const uint8_t * patch_bytes
Definition dttr_core.h:44
const char * aob
Definition dttr_core.h:42