[-]
Shout:
Click Refresh to load shouts.

Post Reply 
 
Thread Rating:
  • 2 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
packet.dll for 8.31
10-02-2008, 10:14 AM (This post was last modified: 10-26-2008 12:08 PM by Azura. Edit Reason: )
Post: #1
packet.dll for 8.31
This version of packet.dll is sort of different from earlier versions.

First of, it only got one exported function which is SendPacket.

XTEA function have been removed from being an exported function, I have got the impresion it was almost not used at all, but if its a function many need I or someone else can add it again.

The SendPacket function now only got two parameters, ProcessID and Packet.
This is the main use of the dll and I think it wasnt widly used to something else.

Reason I did those changes is because I copied the function I use to send packets, with the parameters I have for it (works same as old SendPacket did, just some small changes). I hope this dont make to much problems, hopefully it even becomes easier for most of you.

SendPacket function have been fixed to include the new checksum.



Example codes.

Delphi:
Code:
procedure SendPacket(ProcessID: Cardinal; Packet: Pointer); stdcall; external 'packet.dll';



procedure TForm1.Button1Click(Sender: TObject);
var
  ProcessID: Cardinal;
  PacketBuffer: array [0..2] of byte;

begin
  GetWindowThreadProcessId(FindWindow('TibiaClient', nil), @ProcessID);

  PacketBuffer[0] := $01;
  PacketBuffer[1] := $00;
  PacketBuffer[2] := $65;

  SendPacket(ProcessID, @PacketBuffer);
end;

VB: (Thanks to Sketchy)
Code:
Private Declare Sub SendPacket Lib "packet.dll" (ByVal ProcessID As Long, ByRef Packet As Byte)



Private Sub Command1_Click()
  Dim ProcessID As Long
  Dim PacketBuffer(2) As Byte

  GetWindowThreadProcessId FindWindow("tibiaclient", vbNullString), ProcessID

  PacketBuffer(0) = &H10
  PacketBuffer(1) = &H0
  PacketBuffer(2) = &H65

  SendPacket ProcessID, PacketBuffer(0)

End Sub

C/C++: (Thanks to Stiju)
Code:
#include <windows.h>
typedef int (WINAPI *SENDPACKET)(DWORD, char*);
SENDPACKET SendPacket = NULL;
HINSTANCE hLib;
int main()
{
    char Packet[3] = {0x01, 0x00, 0x65};
    HWND client = FindWindow("TibiaClient", 0);
    DWORD pid;
    GetWindowThreadProcessId(client, &pid);
    hLib = LoadLibrary("packet.dll");
    SendPacket = (SENDPACKET)GetProcAddress(hLib, "SendPacket");
    SendPacket(pid, Packet);
    if(hLib)
        FreeLibrary(hLib);
    return 0;
}

In general the parameters are
first parameter: ProcessID (4 bytes big variable)
second parameter: Packet (pointer to a byte array)



As some might notice the Packet parameter in VB have changed, did this so the SafeArray parameter should not be needed to use.



packet.dll and sources is attached
Find all posts by this user
Quote this message in a reply
10-02-2008, 10:17 AM
Post: #2
packet.dll for 8.31
Thanks again, I'll test it as soon as I can.

Jo3
Find all posts by this user
Quote this message in a reply
10-02-2008, 10:21 AM
Post: #3
packet.dll for 8.31
thank you very much, i was waiting that SmileSmile

[Image: SetupError.gif]
Find all posts by this user
Quote this message in a reply
10-02-2008, 10:34 AM
Post: #4
packet.dll for 8.31
sweet, thanks!
Find all posts by this user
Quote this message in a reply
10-02-2008, 10:39 AM
Post: #5
packet.dll for 8.31
"compile error:
Array argument must be ByRef"

I'll try the old way and tell you if it still works..
Find all posts by this user
Quote this message in a reply
10-02-2008, 10:39 AM
Post: #6
packet.dll for 8.31
Cant edit last post, but hastily posted and forgot to give you a realy big thanks Smile
Find all posts by this user
Quote this message in a reply
10-02-2008, 10:46 AM
Post: #7
packet.dll for 8.31
Azura, I love how you have reputation beyond repute. Big Grin

Question, I don't know anything about asm coding, and I was wanting to be able to call the 8.21 packet.dll with SendPacket821, 8.22 with SendPacket822, and 8.31 with SendPacket 8.31. I edited the SendPacket line in the asm code to SendPacket821, but when I call it it says there's no reference to it in packet.dll. If you could help me I would appreciate it.

Jo3
Find all posts by this user
Quote this message in a reply
10-02-2008, 10:50 AM
Post: #8
packet.dll for 8.31
DarkstaR Wrote:"compile error:
Array argument must be ByRef"

I'll try the old way and tell you if it still works..
Damn VB Sad
Why must it be that -.-
I dont have VB installed on my comp, but play around some with it and see if you can get it to work, else I fix the code

Jo3Bingham Wrote:Question, I don't know anything about asm coding, and I was wanting to be able to call the 8.21 packet.dll with SendPacket821, 8.22 with SendPacket822, and 8.31 with SendPacket 8.31. I edited the SendPacket line in the asm code to SendPacket821, but when I call it it says there's no reference to it in packet.dll. If you could help me I would appreciate it.

Jo3
You need to change SendPacket both in the code and when you are compiling the code, so it exports the function as SendPacket821
Find all posts by this user
Quote this message in a reply
10-02-2008, 10:58 AM
Post: #9
packet.dll for 8.31
I hate you, lol Big Grin

Oh well...
That won't keep me from trying on my own Tongue
I'm planning on adding the CRC to the old packet.dll.

Fantastic job man :icon6:

Quote:GOD is a DJ
Find all posts by this user
Quote this message in a reply
10-02-2008, 11:07 AM
Post: #10
packet.dll for 8.31
Public Declare Sub SendPacket Lib "packet.dll" (ByVal ProcessID As Long, ByRef Packet() As Byte, Optional ByVal Encrypt As Byte = True, Optional ByVal SafeArray As Byte = True)

Is what i was using and it crasehd vb alltogether, heh at least I saved.

I'll play around with it and try to find a solution, I'll post here when I have, but if anybody finds one for this before I do i would appreciate the help Big Grin
Find all posts by this user
Quote this message in a reply
Post Reply 



Contact UsTProgrammingReturn to TopReturn to ContentLite (Archive) ModeRSS Syndication