Ejemplo n.º 1
0
        public void LuaDoString(string command)
        {
            int  nSize      = command.Length + 0x100;
            uint codeCave   = process.AllocateMemory(nSize);
            uint moduleBase = (uint)process.MainModule.BaseAddress;

            process.WriteASCIIString(codeCave, command);

            process.Asm.Clear();

            String[] asm = new String[]
            {
                "mov eax, " + codeCave,
                "push 0",
                "push eax",

                "push eax",
                "mov eax, " + (moduleBase + Offsets.Endscene.Lua_DoStringAddress),

                "call eax",
                "add esp, 0xC",
                "retn",
            };

            aHook.InjectAndExecute(asm);
            process.FreeMemory(codeCave);
        }
Ejemplo n.º 2
0
        /*   public void DoString(string pszString)
         * {
         *     uint s_curMgr = wow.ReadUInt(wow.ReadUInt(CurrMgr_Ptr) + CurrMgr_Offs);
         *     uint pScript = wow.AllocateMemory(0x1024);
         *     wow.WriteASCIIString(pScript + 0x1024, pszString);
         *
         *     uint codeCave = wow.AllocateMemory(0x1024);
         *
         *     wow.Asm.Clear();
         *     wow.Asm.AddLine("FS mov EAX, [0x2C]");
         *     wow.Asm.AddLine("mov eax, [eax]");
         *     wow.Asm.AddLine("add eax, 8");
         *     wow.Asm.AddLine("mov edx, {0}", s_curMgr);
         *     wow.Asm.AddLine("mov [eax], edx");
         *
         *     wow.Asm.AddLine("mov ecx, {0}", pScript + pszString.Length - 1);
         *     wow.Asm.AddLine("mov eax, " + pScript);
         *
         *     wow.Asm.AddLine("push ecx");
         *     wow.Asm.AddLine("push eax");
         *     wow.Asm.AddLine("push eax");
         *
         *     wow.Asm.AddLine("mov eax, 0x004B32B0");
         *     wow.Asm.AddLine("call eax");
         *     wow.Asm.AddLine("add esp, 0xC");
         *     wow.Asm.AddLine("retn");
         *
         *     wow.Asm.InjectAndExecute(codeCave);
         *     wow.FreeMemory(codeCave);
         *
         *     return;
         * }*/
        public void Lua_DoString(string luaString)
        {
            uint cave = 0;

            try
            {
                wow.SuspendThread(wow.ThreadHandle);

                cave = wow.AllocateMemory(0x2048);
                wow.WriteASCIIString(cave + 0x1024, luaString);

                wow.Asm.Clear();

                wow.Asm.AddLine("mov EDX, [0x00BB43F0]");
                wow.Asm.AddLine("mov EDX, [EDX+0x00002EB0]");

                wow.Asm.AddLine("FS mov EAX, [0x2C]");
                wow.Asm.AddLine("mov EAX, [EAX]");
                wow.Asm.AddLine("add EAX, 10");
                wow.Asm.AddLine("mov [EAX], edx");

                wow.Asm.AddLine("push 0");
                wow.Asm.AddLine("mov eax, " + (cave + 0x1024));
                wow.Asm.AddLine("push eax");
                wow.Asm.AddLine("push eax");
                wow.Asm.AddLine("call 0x004B32B0");
                wow.Asm.AddLine("add esp, 0xC");
                wow.Asm.AddLine("retn");

                wow.Asm.InjectAndExecute(cave);
                wow.ResumeThread(wow.ThreadHandle);

                wow.FreeMemory(cave);
                wow.Asm.Clear();
            }
            catch
            {
                wow.ResumeThread(wow.ThreadHandle);
                wow.FreeMemory(cave);
                wow.Asm.Clear();
            }
        }