MCPcopy Create free account
hub / github.com/CodingGay/BlackDex / xh_core_ignore

Function xh_core_ignore

Bcore/src/main/cpp/xhook/xh_core.c:178–221  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

176}
177
178int xh_core_ignore(const char *pathname_regex_str, const char *symbol)
179{
180 xh_core_ignore_info_t *ii;
181 regex_t regex;
182
183 if(NULL == pathname_regex_str) return XH_ERRNO_INVAL;
184
185 if(xh_core_inited)
186 {
187 XH_LOG_ERROR("do not ignore hook after refresh(): %s, %s", pathname_regex_str, symbol ? symbol : "ALL");
188 return XH_ERRNO_INVAL;
189 }
190
191 if(0 != regcomp(&regex, pathname_regex_str, REG_NOSUB)) return XH_ERRNO_INVAL;
192
193 if(NULL == (ii = malloc(sizeof(xh_core_ignore_info_t)))) return XH_ERRNO_NOMEM;
194 if(NULL != symbol)
195 {
196 if(NULL == (ii->symbol = strdup(symbol)))
197 {
198 free(ii);
199 return XH_ERRNO_NOMEM;
200 }
201 }
202 else
203 {
204 ii->symbol = NULL; //ignore all symbols
205 }
206#if XH_CORE_DEBUG
207 if(NULL == (ii->pathname_regex_str = strdup(pathname_regex_str)))
208 {
209 free(ii->symbol);
210 free(ii);
211 return XH_ERRNO_NOMEM;
212 }
213#endif
214 ii->pathname_regex = regex;
215
216 pthread_mutex_lock(&xh_core_mutex);
217 TAILQ_INSERT_TAIL(&xh_core_ignore_info, ii, link);
218 pthread_mutex_unlock(&xh_core_mutex);
219
220 return 0;
221}
222
223static int xh_core_check_elf_header(uintptr_t base_addr, const char *pathname)
224{

Callers 1

xhook_ignoreFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected