I am using this little example code from https://github.com/bblanchon/dllhelper
i want to know how would i catch the function call before it is called? So i could call my own function 1st to set up some stuff.
I need a operator inside DllHelper, im not sure how to do it.
thanks
class ProcPtr {
public:
explicit ProcPtr(FARPROC ptr) : _ptr(ptr) {}
template <typename T, typename = std::enable_if_t<std::is_function_v<T>>>
operator T *() const {
return reinterpret_cast<T *>(_ptr);
}
private:
FARPROC _ptr;
};
class DllHelper {
public:
explicit DllHelper(LPCTSTR filename) : _module(LoadLibrary(filename)) {}
~DllHelper() { FreeLibrary(_module); }
ProcPtr operator[](LPCSTR proc_name) const {
return ProcPtr(GetProcAddress(_module, proc_name));
}
static HMODULE _parent_module;
private:
HMODULE _module;
};
Aucun commentaire:
Enregistrer un commentaire