mirror of
https://github.com/0O0o0oOoO00/Alas.git
synced 2026-05-21 07:39:31 +08:00
28 lines
784 B
C++
28 lines
784 B
C++
#include "dobby/dobby_internal.h"
|
|
|
|
#include "logging/logging.h"
|
|
|
|
#include "Interceptor.h"
|
|
#include "InterceptRouting/InterceptRouting.h"
|
|
|
|
#include "function-wrapper.h"
|
|
|
|
PUBLIC int DobbyWrap(void *function_address, PreCallTy pre_call, PostCallTy post_call) {
|
|
DEBUG_LOG("Initialize 'DobbyWrap' hook at %p", function_address);
|
|
|
|
Interceptor *interceptor = Interceptor::SharedInstance();
|
|
|
|
InterceptEntry *entry = new InterceptEntry();
|
|
entry->id = interceptor->entries->getCount();
|
|
entry->type = kFunctionWrapper;
|
|
entry->function_address = function_address;
|
|
|
|
FunctionWrapperRouting *routing = new FunctionWrapperRouting(entry);
|
|
routing->DispatchRouting();
|
|
interceptor->addHookEntry(entry);
|
|
routing->Commit();
|
|
|
|
DEBUG_LOG("Finalize %p", function_address);
|
|
return 0;
|
|
}
|