internal static void InstallHook() { HookedInstance = HookedCreateThread; OriginalInstance = Marshal.GetDelegateForFunctionPointer <CreateThreadDelegate>(MemUtils.GetFunctionAddress("Kernel32.dll", "CreateThread")); pDetour = new Detour(MemUtils.GetFunctionAddress("Kernel32.dll", "CreateThread"), Marshal.GetFunctionPointerForDelegate(HookedInstance)); pDetour.Install(); Console.WriteLine("Installed CreateThread Hook"); }
internal static void InstallHook() { HookedInstance = HookedVirtualAlloc; OriginalInstance = Marshal.GetDelegateForFunctionPointer <VirtualAllocDelegate>(MemUtils.GetFunctionAddress("Kernel32.dll", "VirtualAlloc")); pDetour = new Detour(MemUtils.GetFunctionAddress("Kernel32.dll", "VirtualAlloc"), Marshal.GetFunctionPointerForDelegate(HookedInstance)); pDetour.Install(); Console.WriteLine("Installed VirtualAlloc Hook"); }