コード例 #1
0
ファイル: LUAHelper.cs プロジェクト: andrewmunro/Void
        public static void DoString(string command)
        {
            if (MyHook == null) MyHook = new Hook((uint)ObjectManager.WowProcess.Id, (uint)ObjectManager.WowProcess.MainModule.BaseAddress);
            SuspendMainWowThread();

            uint codecave = MyHook.Memory.AllocateMemory();
            uint stringcave = MyHook.Memory.AllocateMemory(command.Length + 1);
            MyHook.Memory.WriteASCIIString(stringcave, command);

            MyHook.Memory.Asm.Clear();
            //AsmUpdateCurMgr();

            MyHook.Memory.Asm.AddLine("mov eax, 0");
            MyHook.Memory.Asm.AddLine("push eax");
            MyHook.Memory.Asm.AddLine("mov eax, {0}", stringcave);
            MyHook.Memory.Asm.AddLine("push eax");
            MyHook.Memory.Asm.AddLine("push eax");
            MyHook.Memory.Asm.AddLine("call {0}", (MyHook.Memory.MainModule.BaseAddress + 0x75350));
            MyHook.Memory.Asm.AddLine("add esp, 0xC");

            //AsmSendResumeMessage();
            MyHook.Memory.Asm.AddLine("retn");

            try
            {
                MyHook.Memory.Asm.InjectAndExecute(codecave);
                //Console.WriteLine("[DoString] Ran: " + command);
                Thread.Sleep(10);
            }
            catch (Exception e)
            {

                //Console.WriteLine("[DoString] Error!");
                throw e;
            }
            finally
            {
                ResumeMainWowThread();
                MyHook.Memory.FreeMemory(codecave);
                MyHook.Memory.FreeMemory(stringcave);
            }
        }
コード例 #2
0
ファイル: LUAHelper.cs プロジェクト: andrewmunro/Void
 public static void ResumeMainWowThread()
 {
     if (MyHook == null) MyHook = new Hook((uint)ObjectManager.WowProcess.Id, (uint)ObjectManager.WowProcess.MainModule.BaseAddress);
     ProcessThread wowMainThread = SThread.GetMainThread((int)MyHook._processId);
     IntPtr hThread = SThread.OpenThread(wowMainThread.Id);
     SThread.ResumeThread(hThread);
 }