Exemplo n.º 1
0
        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");
        }
Exemplo n.º 2
0
        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");
        }