#pragma once #include #include #include #include "acioemu/handle.h" namespace execexe { HMODULE init(); void init_deferred(std::function init_func); void init_port_hook(const std::wstring &portName, acioemu::ACIOHandle *acioHandle); HMODULE load_library(const char *module_name, bool fatal = true); FARPROC get_proc(HMODULE module, const char *proc_name, bool fatal = true); HMODULE get_module(const char *module_name, bool fatal = true); bool trampoline(const char *dll, const char *func, void *hook, void **orig); bool trampoline_try(const char *dll, const char *func, void *hook, void **orig); template inline T get_proc(HMODULE module, const char *proc_name, bool fatal = true) { return reinterpret_cast(get_proc(module, proc_name, fatal)); } template inline bool trampoline(const char *dll, const char *func, T hook, T *orig) { return trampoline( dll, func, reinterpret_cast(hook), reinterpret_cast(orig)); } template inline bool trampoline_try(const char *dll, const char *func, T hook, T *orig) { return trampoline_try( dll, func, reinterpret_cast(hook), reinterpret_cast(orig)); } }