Exemple #1
0
        public void HookEndScene()
        {
            ThreadManager.suspendMainThread(this.getProcessId());
            uint pDevice   = Memory.ReadUInt(0x00BB672C);
            uint pEnd      = Memory.ReadUInt(pDevice + 0x397C);
            uint pScene    = Memory.ReadUInt(pEnd);
            uint pEndScene = Memory.ReadUInt(pScene + 0xA8);

            SendConsole("EndScene Offset : " + pEndScene.ToString("X"), ConsoleLvl.Debug);
            if (Memory.ReadByte(pEndScene) != 0xe9) // check if not already hooked
            {
                codeCave = Memory.AllocateMemory(0x2048);
                Memory.Asm.Clear();
                //Demerdation de laddresse de endscene mon amour :)))



                byte[] Backup = Memory.ReadBytes(pEndScene, 25);

                int size = Memory.Asm.GetMemorySize();
                Memory.Asm.AddLine("pushad");
                Memory.Asm.AddLine("pushfd");

                Memory.Asm.AddLine("mov esi, " + (codeCave + 256).ToString("X") + "h");
                Memory.Asm.AddLine("cmp dword [esi], 0");
                Memory.Asm.AddLine("je " + (codeCave + 0x1D).ToString("X") + "h");
                //DO STRING
                Memory.Asm.AddLine("push {0}", 0);
                Memory.Asm.AddLine("mov eax, {0}", codeCave + 0x1024);
                Memory.Asm.AddLine("push eax");
                Memory.Asm.AddLine("push eax");
                Memory.Asm.AddLine("call {0}", (uint)0x004B32B0);
                Memory.Asm.AddLine("add esp, 0xC");

                //EXIT
                Memory.Asm.AddLine("mov dword[" + (codeCave + 256).ToString("X") + "h], 0");
                Memory.Asm.AddLine("popfd");
                Memory.Asm.AddLine("popad");

                Memory.Asm.Inject(codeCave);
                Memory.WriteBytes(codeCave + 0x29, Backup);

                Memory.Asm.Clear();
                Memory.Asm.AddLine("jmp " + (pEndScene + 25).ToString("X") + "h");

                //REMPLACEMENT POUR NOBUG


                Memory.Asm.Inject(codeCave + 0x29 + 25);


                // Okay on a le pointeur , que les choses serieuses commencent : YOUMEW EN MODE EXTRA BOUISSINCE
                Memory.Asm.Clear();
                Memory.Asm.AddLine("jmp " + codeCave.ToString("X") + "h");
                Memory.Asm.Inject(pEndScene);
            }
            else
            {
                codeCave = Memory.ReadUInt(pEndScene + 1) + 4 + pEndScene - 0xffffffff;
            }
            ThreadManager.resumeMainThread(this.getProcessId());
            // ENDSCENE IS NOW HOOKED
            // HOOK BY LMEW
            // LA BOUISINCE A LETAT PURE
        }