Results 1 to 2 of 2
  1. #1
    louco89
    louco89 is offline
    Guest louco89's Avatar
    Join Date
    2013 Feb
    Location
    Brazil
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    SendPacket translate to Delphi from AutoIT

    I make my own bot and I have translate some stuff from AutoIT that I found on another forum. In the end of this post I gave the credits for the original coder in AutoIT.

    Here is the essence of the code, the definitions and the functions that we need to inject some stuff into elementclient.exe
    Code:
    //global definitions
    type
      PPacket = ^TPacket;
      TPacket = packed record
        Len: cardinal;
        Buf: array [0 .. 63] of byte;
      end;
     
    var
     WH: DWORD;
     
    const
      PW_TITLE = 'Element Client';
      PW_BASE_ADDRESS = $00B4EF34;
      PW_SENDPACKET = $0068D640;
     
    procedure InjectFunc(ProcessID: cardinal; Func: pointer; aParams: pointer;
      aParamsSize: DWORD);
    var
      hThread: THandle;
      lpNumberOfBytes: DWORD;
      ThreadAddr, ParamAddr: pointer;
    begin
      if ProcessID <> 0 then
      begin
        ThreadAddr := VirtualAllocEx(ProcessID, nil, 256, MEM_COMMIT,
          PAGE_READWRITE);
        WriteProcessMemory(ProcessID, ThreadAddr, Func, 256, lpNumberOfBytes);
        ParamAddr := VirtualAllocEx(ProcessID, nil, aParamsSize, MEM_COMMIT,
          PAGE_READWRITE);
        WriteProcessMemory(ProcessID, ParamAddr, aParams, aParamsSize,
          lpNumberOfBytes);
        hThread := CreateRemoteThread(ProcessID, nil, 0, ThreadAddr, ParamAddr, 0,
          lpNumberOfBytes);
        WaitForSingleObject(hThread, INFINITE);
        CloseHandle(hThread);
        VirtualFreeEx(ProcessID, ParamAddr, 0, MEM_RELEASE);
        VirtualFreeEx(ProcessID, ThreadAddr, 0, MEM_RELEASE);
      end;
    end;
     
    //Procedure what is inject in the elementclient
    procedure SendCall(aPacket: PPacket); stdcall;
    var
      addr: pointer;
      size, Buf: DWORD;
    begin
      addr := pointer(PW_SENDPACKET);
      size := PDword(aPacket)^;
      Buf := DWORD(aPacket) + 4;
    asm
      pushad
      mov eax, dword ptr [PW_BASE_ADDRESS]
      mov ecx, dword ptr [eax + $20]
      push size
      push buf
      call addr
      popad
    end;
    end;
    And here are some os packets that you can send to the server to do some stuff like deselect target
    Code:
    procedure Deselect;
    var
      lPacket: TPacket;
      pckHead: word;
    begin
      // Packet: 0800
      // Length: 2
      lPacket.Len := 2;
      pckHead := $08;
      copymemory(@lPacket.Buf[0], @pckHead, sizeof(pckHead));
      lPacket.Buf[1] := $00;
      InjectFunc(WH, @SendCall, @lPacket, sizeof(lPacket));
    end;
    
    //Select the target from ID
    procedure Target(IDTarget: DWORD);
    var
      lPacket: TPacket;
      pckHead: word;
      TarHex: LongInt;
    begin
      { $packet = '0200'
        $packet &= _hex($targetId)
        $packetSize = 6 }
      lPacket.Len := 6;
      pckHead := $02;
      copymemory(@lPacket.Buf[0], @pckHead, sizeof(pckHead));
      lPacket.Buf[1] := $00;
      TarHex := IDTarget;
      copymemory(@lPacket.Buf[2], @TarHex, sizeof(cardinal));
      InjectFunc(WH, @SendCall, @lPacket, sizeof(lPacket));
    end;
    Credits
    Original coder from AutoIT: Interest07.
    Me for translated :P

    Sorry about my english =/
    Last edited by louco89; 2013-02-27 at 02:48 AM. Reason: Add some example of packets

  2. #2
    witte
    witte is offline
    New member
    Join Date
    2013 May
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    ^^legal

Similar Threads

  1. AutoIT bot for RO2
    By vampire296 in forum AutoIt
    Replies: 9
    Last Post: 2013-09-26, 05:10 AM
  2. [Tutorial] How to Translate Taiwan Version of Kingdom Heroes (三國群英傳2.5 Online)
    By Sltl in forum Game Researching Tutorials
    Replies: 0
    Last Post: 2013-01-23, 05:37 AM
  3. [Delphi] Delphi elementclient inject
    By marcelo380 in forum Perfect World
    Replies: 0
    Last Post: 2012-06-08, 09:13 PM
  4. [Help] Translate Aika
    By ecrespinnn in forum Aika Online
    Replies: 0
    Last Post: 2012-05-02, 02:38 PM
  5. [Delphi] Delphi Training Video
    By Dwar in forum Programming Tutorials
    Replies: 0
    Last Post: 2010-11-29, 04:10 PM
Visitors found this page by searching for:

perfect world 2 element client code injection

delphi SendPacket

translate

autoit packet bot tutorial

perfect world autoit bot

pw sendpacket

autoit packet bots

procedure injectfunc(processid: cardinal; delphi xe

autoit from delphi

delphi bot for pw

sendpacket delphi

bot in game perfect world injection tutorial

delphi autoit

autoit to delphi

make bot perfect world with delphi

cheat pw

how to sent packet delphi 7 cheat game

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •