Exemple #1
0
        private MemoryPointer CreateAntiCheatCodeCave(byte[] function)
        {
            LoggingService.Info($"Searching anti-cheat code cave for hook {TargetDelegate}");

            InternalModulePointer module = TargetFuncPtr.GetMyModule();

            if (module == null)
            {
                throw new NullReferenceException("Cannot find a module which belongs to the specified pointer.");
            }

            MemoryPointer codeCavePtr = module.FindCodeCaveInModule((uint)function.Length);

            LoggingService.Info($"Found codecave at 0x{codeCavePtr.ToString()}");

            return(codeCavePtr);
        }
Exemple #2
0
        private void InitializeAntiCheatHook()
        {
            byte[]       bytes  = HookPtr.GetReturnToPtr();
            MemoryModule module = TargetFuncPtr.GetMyModule();

            if (module == null)
            {
                throw new NullReferenceException("Cannot find a module which belongs to the specified pointer.");
            }

            MemoryAddress codeCave = module.FindCodeCaveInModule((uint)bytes.Length);

            CodeCavePatch = new MemoryPatch(codeCave, bytes);

            byte[] retToCodeCave = CodeCavePatch.PatchAddress.GetReturnToPtr();

            HookPatch = new MemoryPatch(TargetFuncPtr, retToCodeCave);
        }