Hook initialisation can't fail, because it's just a registration

* Hooking no longer does anything active immediately when initialised, it just
  registers a function to be hooked, which is then deferred and/or continually
  re-hooked depending on platform-specific functionality.
This commit is contained in:
baldurk
2018-07-06 22:44:20 +01:00
parent 6a30e63a46
commit edd6ab4faa
11 changed files with 73 additions and 192 deletions
+2 -2
View File
@@ -44,11 +44,11 @@ public:
~Hook() {}
FuncType operator()() { return (FuncType)orig_funcptr; }
void SetFuncPtr(void *ptr) { orig_funcptr = ptr; }
bool Initialize(const char *function, const char *module_name, void *destination_function_ptr)
void Initialize(const char *function, const char *module_name, void *destination_function_ptr)
{
orig_funcptr = Process::GetFunctionAddress(Process::LoadModule(module_name), function);
return Win32_IAT_Hook(&orig_funcptr, module_name, function, destination_function_ptr);
Win32_IAT_Hook(&orig_funcptr, module_name, function, destination_function_ptr);
}
private: