Root/
Source at commit 2283 created 10 years 7 months ago. By pootle, Commit from Pootle by user crazybirdy.: 389 of 389 strings translated (0 fuzzy). | |
---|---|
1 | /*␊ |
2 | * Module Loading functionality␊ |
3 | * Copyright 2009 Evan Lojewski. All rights reserved.␊ |
4 | *␊ |
5 | */␊ |
6 | ␊ |
7 | #include <saio_types.h>␊ |
8 | #include <mach-o/loader.h>␊ |
9 | #include <mach-o/nlist.h>␊ |
10 | ␊ |
11 | ␊ |
12 | #ifndef __BOOT_MODULES_H␊ |
13 | #define __BOOT_MODULES_H␊ |
14 | ␊ |
15 | #define MODULE_PATH␉␉"/Extra/modules/"␊ |
16 | ␊ |
17 | #define SYMBOLS_MODULE "Symbols.dylib"␊ |
18 | #define SYMBOLS_AUTHOR "Chameleon"␊ |
19 | #define SYMBOLS_DESCRIPTION "Chameleon symbols for linking"␊ |
20 | #define SYMBOLS_VERSION 0␊ |
21 | #define SYMBOLS_COMPAT 0␊ |
22 | ␊ |
23 | #define VOID_SYMBOL␉␉"dyld_void_start"␊ |
24 | ␊ |
25 | ␊ |
26 | ␊ |
27 | typedef struct symbolList_t␊ |
28 | {␊ |
29 | ␉char* symbol;␊ |
30 | ␉UInt64 addr;␊ |
31 | ␉struct symbolList_t* next;␊ |
32 | } symbolList_t;␊ |
33 | ␊ |
34 | ␊ |
35 | typedef struct callbackList_t␊ |
36 | {␊ |
37 | ␉void(*callback)(void*, void*, void*, void*);␊ |
38 | ␉struct callbackList_t* next;␊ |
39 | } callbackList_t;␊ |
40 | ␊ |
41 | typedef struct moduleHook_t␊ |
42 | {␊ |
43 | ␉const char* name;␊ |
44 | ␉callbackList_t* callbacks;␊ |
45 | ␉struct moduleHook_t* next;␊ |
46 | } moduleHook_t;␊ |
47 | ␊ |
48 | typedef struct modulesList_t␊ |
49 | {␊ |
50 | ␉const char*␉␉␉␉name;␊ |
51 | const char* author;␊ |
52 | const char* description;␊ |
53 | ␉UInt32␉␉␉␉␉version;␊ |
54 | ␉UInt32␉␉␉␉␉compat;␊ |
55 | ␉struct modulesList_t* next;␊ |
56 | } moduleList_t;␊ |
57 | ␊ |
58 | ␊ |
59 | ␊ |
60 | int init_module_system();␊ |
61 | void load_all_modules();␊ |
62 | ␊ |
63 | void start_built_in_module(const char* name, ␊ |
64 | const char* author, ␊ |
65 | const char* description,␊ |
66 | UInt32 version,␊ |
67 | UInt32 compat,␊ |
68 | void(*start_function)(void));␊ |
69 | ␊ |
70 | int load_module(char* module);␊ |
71 | int is_module_loaded(const char* name);␊ |
72 | void module_loaded(const char* name, const char* author, const char* description, UInt32 version, UInt32 compat);␊ |
73 | ␊ |
74 | ␊ |
75 | ␊ |
76 | ␊ |
77 | /********************************************************************************/␊ |
78 | /*␉Symbol Functions␉␉␉␉␉␉␉␉␉␉␉␉␉␉␉*/␊ |
79 | /********************************************************************************/␊ |
80 | long long␉␉add_symbol(char* symbol, long long addr, char is64);␊ |
81 | unsigned int␉lookup_all_symbols(const char* name);␊ |
82 | ␊ |
83 | ␊ |
84 | ␊ |
85 | /********************************************************************************/␊ |
86 | /*␉Macho Parser␉␉␉␉␉␉␉␉␉␉␉␉␉␉␉␉*/␊ |
87 | /********************************************************************************/␊ |
88 | void*␉␉␉parse_mach(void* binary, ␊ |
89 | ␉␉␉␉␉␉␉int(*dylib_loader)(char*),␊ |
90 | ␉␉␉␉␉␉␉long long(*symbol_handler)(char*, long long, char),␊ |
91 | void (*section_handler)(char* section, char* segment, void* cmd, UInt64 offset, UInt64 address)␊ |
92 | );␊ |
93 | unsigned int␉handle_symtable(UInt32 base,␊ |
94 | ␉␉␉␉␉␉␉ struct symtab_command* symtabCommand,␊ |
95 | ␉␉␉␉␉␉␉ long long(*symbol_handler)(char*, long long, char),␊ |
96 | ␉␉␉␉␉␉␉ char is64);␊ |
97 | void␉␉␉rebase_macho(void* base, char* rebase_stream, UInt32 size);␊ |
98 | inline void␉␉rebase_location(UInt32* location, char* base, int type);␊ |
99 | void␉␉␉bind_macho(void* base, UInt8* bind_stream, UInt32 size);␊ |
100 | inline void␉␉bind_location(UInt32* location, char* value, UInt32 addend, int type);␊ |
101 | ␊ |
102 | ␊ |
103 | ␊ |
104 | ␊ |
105 | /********************************************************************************/␊ |
106 | /*␉Module Interface␉␉␉␉␉␉␉␉␉␉␉␉␉␉*/␊ |
107 | /********************************************************************************/␊ |
108 | int␉␉␉␉replace_function(const char* symbol, void* newAddress);␊ |
109 | int␉␉␉␉execute_hook(const char* name, void*, void*, void*, void*);␊ |
110 | void␉␉␉register_hook_callback(const char* name, void(*callback)(void*, void*, void*, void*));␊ |
111 | moduleHook_t*␉hook_exists(const char* name);␊ |
112 | ␊ |
113 | #if DEBUG_MODULES␊ |
114 | void␉␉␉print_hook_list();␊ |
115 | #endif␊ |
116 | ␊ |
117 | /********************************************************************************/␊ |
118 | /*␉dyld Interface␉␉␉␉␉␉␉␉␉␉␉␉␉␉␉␉*/␊ |
119 | /********************************************************************************/␊ |
120 | void dyld_stub_binder();␊ |
121 | ␊ |
122 | #endif /* __BOOT_MODULES_H */ |