Esempio n. 1
0
        public static void sendPacket(IntPtr handle, int processId, byte [] packet)
        {
            //временная переменная
            int tmpInt;
            int PacketAllocMemory;

            int alloc_address = VirtualAllocEx(handle, 0, 2500, AllocationType.Commit, MemoryProtection.ReadWrite);

            PacketAllocMemory = alloc_address + 2000;
            //Записываем в открытую память пакет в выделенное место
            WriteProcessMemory(handle, PacketAllocMemory, packet, packet.Length, out tmpInt);


            Asm asm = new Asm();

            asm.Pushad();
            asm.Mov_EAX(GameService.PackCall);
            asm.Mov_ECX_DWORD_Ptr(GameService.BaseAddress);
            asm.Mov_ECX_DWORD_Ptr_ECX_Add(0x20);
            asm.Mov_EDI(PacketAllocMemory);
            asm.Push6A(packet.Length);
            asm.Push_EDI();
            asm.Call_EAX();
            asm.Popad();
            asm.Ret();
            asm.RunAsm((int)processId, 0);

            /* Asm asm = new Asm();
             *
             * asm.Pushad();
             * asm.Mov_EAX_DWORD_Ptr(GameService.BaseAddress);
             * asm.Mov_EAX_DWORD_Ptr_EAX_Add(0x20);
             * asm.Push6A(getByteLen(packetStr));
             * //asm.Push68(StrToByte(packetStr));
             *
             * asm.Mov_EDX(GameService.PackCall);
             * asm.Call_EDX();
             * asm.Popad();
             * asm.Ret();
             * asm.RunAsm(Form1.handleProcessId, 0);*/
        }