internal static void InstallGetModuleHandleHook() { var funcAddr = HookUtils.GetFunctionAddress("Kernel32.dll", "GetModuleHandleA"); hookedInstance = HGetModuleHandle; originalInstance = Marshal.GetDelegateForFunctionPointer <GetModuleHandleDelegate>(funcAddr); dEngine = new DetourEngine(funcAddr, Marshal.GetFunctionPointerForDelegate(hookedInstance)); dEngine.Install(); Logger.Log("Installed GetModuleHandle hook"); }
internal static void InstallLoadLibraryHook() { var funcAddr = HookUtils.GetFunctionAddress("Kernel32.dll", "LoadLibraryA"); hookedInstance = HLoadLibrary; originalInstance = Marshal.GetDelegateForFunctionPointer <LoadLibraryDelegate>(funcAddr); dEngine = new DetourEngine(funcAddr, Marshal.GetFunctionPointerForDelegate(hookedInstance)); dEngine.Install(); Logger.Log("Installed LoadLibrary hook"); }
public static void Install() => DEngine.Install();