PDA

View Full Version : [Work In progress] Humble Beginnings of an L2Server C++ DLL


mcrabben7
16.06.2006, 10:44
I have attached a Visual Studio 2005 C++ project, as well as included my current state of source code and compiled DLLs.

Disclaimer: these files DO NOT WORK or do anything that xx.xx9% of you will ever care about. LEECHERS LEAVE. This is posted in hopes of moving the community forward on good terms, rather than backwards over greed.

You can attach them to an l2Server using the Stud_PE exe injector. So far this works with the tontor patch as well. I plan to keep compatibility with it to the very end.

Currently this DLL does 3 things:
1) Changes the Server Protocol to 656
2) Changes the default server message to say "L2C4Extend 0.1 [mcrabben7@gmail.com]"
3) Hooks the L2Server at address 0050F8F4 and tries to redirect it to my own function.

My issue is that after writing a new function hook in memory at the location 50F8F4 the L2Server will fail to jump to my HookReceivePacket function. it *never* gets there, or else my log file would show that it entered the function area.

I have two more theories on why this function hook is failing to jump to my code in my DLL:

1) The address being written to the L2Server is in the wrong form?
2) The address being written to the L2Server needs to be rebased according to the Procedure's Base Address + an offset related to my DLL?

Number 1 I have tried a few forms and to no avail will it run correctly.
Number 2 I have not tried since my experience with such things is limited and I wanted to avoid such a route if possible.

Here are a few code snippets of the code in question:
//Receive Packet Function Hook
if( !WriteProcessMemory(dwHandle, (LPVOID)(0x0050F8F4+1), &HookReceivePacket, sizeof(&HookReceivePacket), &temp) )
{
MessageBoxA(NULL, ErrMsgWriteProcessMemory, MsgBoxCaption, MB_OK || MB_ICONSTOP);
file << "WriteProcessMemory on L2Server.0050F8F5 failed. Error Code: " << GetLastError() << "\r\n";
}
else
{
#ifdef __DEBUG__
file << "Wrote L2Server.0050F8F5 with ReceivePacket Hook (" << temp
<< " bytes). New call address: " << hex << HookReceivePacket << ".\r\n";
#endif
}

void HookReceivePacket()
{
#ifdef __DEBUG__
file << "Entered HookReceivePacket: now calling L2Server.005509E2.\r\n";
#endif

...some other code that currently never gets ran...

#ifdef __DEBUG__
file << "Exited HookReceivePacket. \r\n";
#endif
}

After I run my DLL and it hooks the server, it will run fine and load everything. As soon as I try to log in, it will end up crashing with an access violation error. Sometimes in the same place, sometimes in other places. Depends on the state of my code at the time. The other issue is it will NEVER actually run the code inside the HookReceivePacket function. It never seems to get that far, which is why I assume I am somehow writing the hook wrong.

Error output using release/L2C4Extend.dll and my own exe based off the PP release:
Server Up Time Fri Jun 16 03:45:57 2006

Current Time : Fri Jun 16 03:50:26 2006

Elapsed Time : 0 days 0 hours 4 minutes 29 seconds
IOBufferPool - 5995

[(4048) 2006/06/16 03:50:26]: =======================
an Access Violation in module L2C4server656_FAV_PATCHES_v3_patch.dll_L2C4Extend. dll.exe at 001b:693d844e.
start at 2006/6/16 03:45:36
Read from location 693d844e caused an access violation.

Registers:
EAX=6134ce22 CS=001b EIP=693d844e EFLGS=00010282
EBX=6134ce10 SS=0023 ESP=4bd5fe28 EBP=4bd5fe94
ECX=87546eef DS=0023 ESI=00000002 FS=003b
EDX=00000029 ES=0023 EDI=5d75749c GS=0000
Bytes at CS:EIP:
?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??
Stack dump:
4bd5fe28: 0050f8f9 6134ce22 5d758814 00000029 0053ba66 5d75749c 77e6bb6d 4bd5fe30
4bd5fe48: 4bd5fe78 005afa90 00000000 4bd5fe84 4bd5feac 0000002e 44390038 31b9906c
4bd5fe68: 0053c19e 0053ba27 4bd5fe5c 0000002b 005a1550 0053ba27 6134ce10 4bd5fe38
4bd5fe88: 4bd5feb4 005ad778 ffffffff 4bd5fec0 00539866 0053ba66 5d75749c 77e6bb6d
4bd5fea8: 4bd5fedc 4bd5febc 4bd5fe9c 4bd5ff3c 005afaa0 ffffffff 4bd5ff48 0053be2a
4bd5fec8: 0000002b 00000001 0053cbe6 00000001 0000002b 5d75878c 00000000 00000000
4bd5fee8: 3fc7d040 00000000 00001000 00010000 bffeffff 00000001 00000001 0000024a
4bd5ff08: 00010000 08010006 e081f180 03f0dd02 00000172 f50d0c88 0000002b 0004f304
4bd5ff28: 00000000 f87e8000 5d75878c 5d75749c 4bd5fee0 4bd5ff68 005afca0 ffffffff
4bd5ff48: 4bd5ff78 0053cc96 00000000 00000000 00000000 3fc7d040 4bd5ff54 4bd5fa54


ver = Jun 8 2004____15:38:30 thread id=0

void IOThread_common(void *arglist) <--
void CIOSocket::ReadCallback(DWORD dwTransferred) <--
CUserSocket::OnRead

Thread[0] (ahehe): Lock Stack :



[(4048) 2006/06/16 03:50:26]: *ioc.cpp:665(Sat May 15 01:37:29 2004) exception

Thanks everyone for your time. I hope I can get *constructive* posts and some help in progressing further with this work.

Edit: Version 0.2 of the code is on page 2 of this thread. Download that for a better set of code!

Вложения из исходного сообщения (сами файлы в копии отсутствуют):
l2c4extend_209.rar — 548553 байт

mantrastic
16.06.2006, 11:23
lovely work mate, keep it up!

Bruenor
16.06.2006, 11:37
I believe I found the problem. The function call that gets modified in the example uses a relative offset, so replacing it with an absolute address causes it to call the wrong address. If you replace
if( !WriteProcessMemory(dwHandle, (LPVOID)(0x0050F8F4+1), &HookReceivePacket, sizeof(&HookReceivePacket), &temp) )
with
if( !WriteProcessMemory(dwHandle, (LPVOID)(0x0050F8F4+1), &HookReceivePacket - (0x0050F8F4+5), sizeof(&HookReceivePacket), &temp) )
it should work.

Postal
16.06.2006, 11:45
Very happy to see you going through with this mcrabben7. Only wish I could help you out, but just reading your first reply made me feel small and stupid haha.

Good luck to you.

mcrabben7
16.06.2006, 12:07
I believe I found the problem. The function call that gets modified in the example uses a relative offset, so replacing it with an absolute address causes it to call the wrong address. If you replace
if( !WriteProcessMemory(dwHandle, (LPVOID)(0x0050F8F4+1), &HookReceivePacket, sizeof(&HookReceivePacket), &temp) )
with
if( !WriteProcessMemory(dwHandle, (LPVOID)(0x0050F8F4+1), &HookReceivePacket - (0x0050F8F4+5), sizeof(&HookReceivePacket), &temp) )
it should work.
Thanks for the reply. I will give this a try. I was afraid it was an addressing issue, but I am still new to thinking in relative and absolute addressing ^^

mcrabben7
16.06.2006, 13:32
This snippet can replace the previous hook and one won't need to use WriteProcessMemory at all, tbh.

//Receive Packet Function Hook
DWORD * HookReceivePacketAddr = (DWORD *)0x0050F8F5;
*HookReceivePacketAddr = (DWORD)HookReceivePacket;
*HookReceivePacketAddr -= (0x0050F8F4+5);

Thanks to Alien003 for the initial inspiration to try straight pointer arithmetic, and thanks to Bruenor for the relative vs. absolute addressing hint.

My log file managed to log this:
Got Process Handle 00000088.
Wrote L2Server.0050105D with new Server Protocol Revision [656].
Wrote L2Server.004907AA with new Server Window Name.
Wrote L2Server.0050F8F5 with ReceivePacket Hook. New call address: ffe01877.
Entered HookReceivePacket: now calling L2Server.005509E2.

Looks like I can finally move along and try to work on the other parts.

HongK
16.06.2006, 13:39
woot +1 for American programmers :P good job man keep up the good work. There's nothing better than starting from the basics and understanding and building your knowledge on this subject

mcrabben7
16.06.2006, 14:47
Books? Programming changes to often for that, usually. For Assembly, I learned in college and we used a book called Assembly Language for Intel-Based Computers by Kip R. Irvine.

MSDN library is your best reference for the entire Windows API, and the inner workings of Windows.

You can find some (basic) DLL tutrials on the internet at sites like CodeProject.com and other places if you search.

testdude
16.06.2006, 15:07
nice... btw a little snippet for those who dont want/like to use asm to call functions in l2server
#define CSOCKET_SEND_VA 0x004DFC70
Send = (void (__cdecl *)(DWORD, const char *, ...)) CSOCKET_SEND_VA;will make Send() call the CSocket::Send function, was used in my project, just easyer, and prettier cos i dont like asm :p

mcrabben7
17.06.2006, 19:45
Some progress:

switch ( opCode )
{
//C4 Extended Packets
case 0xD0:
extOpCode = (BYTE)*(header+1);
#ifdef __DEBUG__
__asm { pushad }
file << ">>>>>> ReceivePacket: C4 Extended (0x" << hex << opCode << ")(0x" << hex << extOpCode << ") received.\r\n";
file.flush();
__asm { popad }
#endif
//TODO: insert extended op code switch for C4 packets
break;
//RequestParty
case 0x29:
#ifdef __DEBUG__
__asm { pushad }
file << ">>>>>> ReceivePacket: RequestParty (0x" << hex << opCode << ") received.\r\n";
file.flush();
__asm { popad }
#endif
break;
//RequestShowMiniMap
case 0xCD:
#ifdef __DEBUG__
__asm { pushad }
file << ">>>>>> ReceivePacket: Request Show Mini Map (0x" << hex << opCode << ") received.\r\n";
file.flush();
__asm { popad }
ReplyRequestShowMiniMap(packet);
#endif
}

And some logs:
L2C4Extend has started.
Got Process Handle 00000088.
Wrote L2Server.0050105D with new Server Protocol Revision [656].
Wrote L2Server.004907AA with new Server Window Name.
Wrote L2Server.0050F8F5 with ReceivePacket Hook. New call address: ffe018d7.
Entered HookReceivePacket: now calling L2Server.00500FF0.
>>> HookReceivePacket: now calling ReceivePacket.
>>> Entered ReceivePacket: now pulling data from the packet.
>>>>>> ReceivePacket: packet size: f8/0/64/9c opcode: 0x8
>>> HookReceivePacket: ReceivePacket has returned. Now finishing and calling L2Server.0050F8FC.
Entered HookReceivePacket: now calling L2Server.00500FF0.
>>> HookReceivePacket: now calling ReceivePacket.
>>> Entered ReceivePacket: now pulling data from the packet.
>>>>>> ReceivePacket: packet size: f8/0/64/9c opcode: 0xd
>>> HookReceivePacket: ReceivePacket has returned. Now finishing and calling L2Server.0050F8FC.
Entered HookReceivePacket: now calling L2Server.00500FF0.
>>> HookReceivePacket: now calling ReceivePacket.
>>> Entered ReceivePacket: now pulling data from the packet.
>>>>>> ReceivePacket: packet size: f8/6c/64/9c opcode: 0xd0
>>>>>> ReceivePacket: C4 Extended (0xd0)(0x0) received.
>>> HookReceivePacket: ReceivePacket has returned. Now finishing and calling L2Server.0050F8FC.
Entered HookReceivePacket: now calling L2Server.00500FF0.
>>> HookReceivePacket: now calling ReceivePacket.
>>> Entered ReceivePacket: now pulling data from the packet.
>>>>>> ReceivePacket: packet size: f8/6c/64/9c opcode: 0x63
>>> HookReceivePacket: ReceivePacket has returned. Now finishing and calling L2Server.0050F8FC.
Entered HookReceivePacket: now calling L2Server.00500FF0.
>>> HookReceivePacket: now calling ReceivePacket.
>>> Entered ReceivePacket: now pulling data from the packet.
>>>>>> ReceivePacket: packet size: f8/6c/64/9c opcode: 0x3
>>> HookReceivePacket: ReceivePacket has returned. Now finishing and calling L2Server.0050F8FC.
Entered HookReceivePacket: now calling L2Server.00500FF0.
>>> HookReceivePacket: now calling ReceivePacket.
>>> Entered ReceivePacket: now pulling data from the packet.
>>>>>> ReceivePacket: packet size: f8/6c/64/9c opcode: 0x66
>>> HookReceivePacket: ReceivePacket has returned. Now finishing and calling L2Server.0050F8FC.
Entered HookReceivePacket: now calling L2Server.00500FF0.
>>> HookReceivePacket: now calling ReceivePacket.
>>> Entered ReceivePacket: now pulling data from the packet.
>>>>>> ReceivePacket: packet size: f8/6c/64/9c opcode: 0x9d
>>> HookReceivePacket: ReceivePacket has returned. Now finishing and calling L2Server.0050F8FC.
Entered HookReceivePacket: now calling L2Server.00500FF0.
>>> HookReceivePacket: now calling ReceivePacket.
>>> Entered ReceivePacket: now pulling data from the packet.
>>>>>> ReceivePacket: packet size: f8/6c/64/9c opcode: 0x5b
>>> HookReceivePacket: ReceivePacket has returned. Now finishing and calling L2Server.0050F8FC.
Entered HookReceivePacket: now calling L2Server.00500FF0.
>>> HookReceivePacket: now calling ReceivePacket.
>>> Entered ReceivePacket: now pulling data from the packet.
>>>>>> ReceivePacket: packet size: f8/6c/64/9c opcode: 0x48
>>> HookReceivePacket: ReceivePacket has returned. Now finishing and calling L2Server.0050F8FC.
Entered HookReceivePacket: now calling L2Server.00500FF0.
>>> HookReceivePacket: now calling ReceivePacket.
>>> Entered ReceivePacket: now pulling data from the packet.
>>>>>> ReceivePacket: packet size: f8/6c/64/9c opcode: 0x30
>>> HookReceivePacket: ReceivePacket has returned. Now finishing and calling L2Server.0050F8FC.
Entered HookReceivePacket: now calling L2Server.00500FF0.
>>> HookReceivePacket: now calling ReceivePacket.
>>> Entered ReceivePacket: now pulling data from the packet.
>>>>>> ReceivePacket: packet size: f8/6c/64/9c opcode: 0xcd
>>>>>> ReceivePacket: Request Show Mini Map (0xcd) received.
>>> HookReceivePacket: ReceivePacket has returned. Now finishing and calling L2Server.0050F8FC.
Entered HookReceivePacket: now calling L2Server.00500FF0.
>>> HookReceivePacket: now calling ReceivePacket.
>>> Entered ReceivePacket: now pulling data from the packet.
>>>>>> ReceivePacket: packet size: f8/6c/64/9c opcode: 0x8
>>> HookReceivePacket: ReceivePacket has returned. Now finishing and calling L2Server.0050F8FC.
Entered HookReceivePacket: now calling L2Server.00500FF0.
>>> HookReceivePacket: now calling ReceivePacket.
>>> Entered ReceivePacket: now pulling data from the packet.
>>>>>> ReceivePacket: packet size: 58/0/c4/9c opcode: 0x8
>>> HookReceivePacket: ReceivePacket has returned. Now finishing and calling L2Server.0050F8FC.
Entered HookReceivePacket: now calling L2Server.00500FF0.
>>> HookReceivePacket: now calling ReceivePacket.
>>> Entered ReceivePacket: now pulling data from the packet.
>>>>>> ReceivePacket: packet size: 58/0/c4/9c opcode: 0xd
>>> HookReceivePacket: ReceivePacket has returned. Now finishing and calling L2Server.0050F8FC.
Entered HookReceivePacket: now calling L2Server.00500FF0.
>>> HookReceivePacket: now calling ReceivePacket.
>>> Entered ReceivePacket: now pulling data from the packet.
>>>>>> ReceivePacket: packet size: 58/cc/c4/9c opcode: 0xd0
>>>>>> ReceivePacket: C4 Extended (0xd0)(0x0) received.
>>> HookReceivePacket: ReceivePacket has returned. Now finishing and calling L2Server.0050F8FC.
Entered HookReceivePacket: now calling L2Server.00500FF0.
>>> HookReceivePacket: now calling ReceivePacket.
>>> Entered ReceivePacket: now pulling data from the packet.
>>>>>> ReceivePacket: packet size: 58/cc/c4/9c opcode: 0x63
>>> HookReceivePacket: ReceivePacket has returned. Now finishing and calling L2Server.0050F8FC.
Entered HookReceivePacket: now calling L2Server.00500FF0.
>>> HookReceivePacket: now calling ReceivePacket.
>>> Entered ReceivePacket: now pulling data from the packet.
>>>>>> ReceivePacket: packet size: 58/cc/c4/9c opcode: 0x3
>>> HookReceivePacket: ReceivePacket has returned. Now finishing and calling L2Server.0050F8FC.
Entered HookReceivePacket: now calling L2Server.00500FF0.
>>> HookReceivePacket: now calling ReceivePacket.
>>> Entered ReceivePacket: now pulling data from the packet.
>>>>>> ReceivePacket: packet size: 58/cc/c4/9c opcode: 0x66
>>> HookReceivePacket: ReceivePacket has returned. Now finishing and calling L2Server.0050F8FC.
Entered HookReceivePacket: now calling L2Server.00500FF0.
>>> HookReceivePacket: now calling ReceivePacket.
>>> Entered ReceivePacket: now pulling data from the packet.
>>>>>> ReceivePacket: packet size: 58/cc/c4/9c opcode: 0x9d
>>> HookReceivePacket: ReceivePacket has returned. Now finishing and calling L2Server.0050F8FC.
Entered HookReceivePacket: now calling L2Server.00500FF0.
>>> HookReceivePacket: now calling ReceivePacket.
>>> Entered ReceivePacket: now pulling data from the packet.
>>>>>> ReceivePacket: packet size: 58/cc/c4/9c opcode: 0xcd
>>>>>> ReceivePacket: Request Show Mini Map (0xcd) received.
>>> HookReceivePacket: ReceivePacket has returned. Now finishing and calling L2Server.0050F8FC.
Entered HookReceivePacket: now calling L2Server.00500FF0.
>>> HookReceivePacket: now calling ReceivePacket.
>>> Entered ReceivePacket: now pulling data from the packet.
>>>>>> ReceivePacket: packet size: 58/cc/c4/9c opcode: 0x8
>>> HookReceivePacket: ReceivePacket has returned. Now finishing and calling L2Server.0050F8FC.

And some SPECIFIC parts of the logs above:
Entered HookReceivePacket: now calling L2Server.00500FF0.
>>> HookReceivePacket: now calling ReceivePacket.
>>> Entered ReceivePacket: now pulling data from the packet.
>>>>>> ReceivePacket: packet size: 58/cc/c4/9c opcode: 0xd0
>>>>>> ReceivePacket: C4 Extended (0xd0)(0x0) received.
>>> HookReceivePacket: ReceivePacket has returned. Now finishing and calling L2Server.0050F8FC.

Entered HookReceivePacket: now calling L2Server.00500FF0.
>>> HookReceivePacket: now calling ReceivePacket.
>>> Entered ReceivePacket: now pulling data from the packet.
>>>>>> ReceivePacket: packet size: 58/cc/c4/9c opcode: 0xcd
>>>>>> ReceivePacket: Request Show Mini Map (0xcd) received.
>>> HookReceivePacket: ReceivePacket has returned. Now finishing and calling L2Server.0050F8FC.

Note: I am still not sure which of the 4 packet sizes I printed to the log is the correct one. But so far, I haven't needed to use it, so, good for me I guess.

I managed to write a ReplyRequestShowMiniMap() function. Sadly, when I open the minimap using Alt + m or the button I will see the map, and immediately get disconnected on a dual login error, and on my older code, kicked for a 'protocol' error.

// Reply to Client Packet: RequestShowMiniMap(0xCD)
// Reply Packet format: cd
//
// Enables the Alt+M / Map button functionality in-game
void ReplyRequestShowMiniMap(DWORD * packetStart)
{
const char * format = "cd";
__asm
{
push 0x0681 //dec: 1665
push 0x00B6 //dec: 182
push format //packet format 'cd'
push packetStart //pushes the address of the start of the packet
call fSendToSinglePlayer
//add esp, 0x0C
//jmp 0x0050FA7F
}
}

Work in progress...

demon
17.06.2006, 20:28
mm can u name your project something else except l2extend its taken :)

we might get confused

thanks for understanding

mcrabben7
17.06.2006, 20:43
mm can u name your project something else except l2extend its taken :)

we might get confused

thanks for understanding
Don't have another name of the top of my head. If I think of one I like, sure. I don't really like the name Extend anwyays.

Also, I don't see anyone else sharing actual code or trying to build the community, so why should I care if you named it the same thing?

Edit: I thought of a new name. Will use it later. Happy :P?

RipperX
18.06.2006, 08:40
Plz update your code, I'll try to do some packets and Reupload the code.
I like this project :)

Project Name: PPL2Extender (or something)
mcrabben7 if u want work in group add me to messenger/icq.

GLuck!

mcrabben7
18.06.2006, 11:24
Ok RipperX, I'll add you to MSN like you PMed me. We can talk about working together.

Also, I'll be posting some new code soon, I think. At the very least I will share some parts of it that will help people learn simple fixes.

draft
18.06.2006, 15:09
im just woundering... still don know how to do alt+m...

asm
push 681
push 9d
push 'cd'
push edi
mov eax, 4dfc70
call eax
add esp,10
xor eax,eax
mov edx, 50fb70
jmp edx

GL.

max_rain
18.06.2006, 15:15
__asm
{
push 0x0681 //dec: 1665
push 0x00B6 //dec: 182
push format //packet format 'cd'
push packetStart //pushes the address of the start of the packet
call fSendToSinglePlayer
add esp,18
}

maybe like this... but i maybe wrong

mcrabben7
18.06.2006, 15:36
I found out my problem in my code. Was a bastard stack issue, but I got it all squared away. Alt + M and Map button work 100% now :D

// Reply to Client Packet: RequestShowMiniMap(0xCD)
// Reply Packet Header: 0xB6
// Reply Packet Format: cd
//
// Enables the Alt+M / Map button functionality in-game
//
// Parameters:
// DWORD * packetStart - address of the socket ID (probably)
// int mapID - map to display to the client (default: 1665)
//
void ReplyRequestShowMiniMap(DWORD * packetStart, int mapID)
{
const char * format = "cd";
__asm
{
push mapID //the mapID to load for the player
push 0x00B6 //the packet header
//push 0x009D //packet header in L2J SVN 6.17
push format //packet format 'cd'
push packetStart //pushes the address of the start of the packet
call fCUserSocketSend
add esp, 0x10 //fix our stack pointer
}
}

After that function runs, it returns to the packet handler, immediately returns from there, and then returns to L2Server.0050F8FC.

Enishi
18.06.2006, 18:04
Awesome man...now I can use a working example to start learning this stuff. :P

Aikeleer
18.06.2006, 19:52
Yeah great work :D

mcrabben7
18.06.2006, 20:50
Here is an updated set of code.

Also, I have renamed the project to the Lineage II Extension Project 'Elhaym'. Elhaym is just a nickname for the dll/project.

This code I am releasing is under the assumption you won't abuse me being generous. If you compare the first release and this one, you'll see there were a lot of changes to the initial set of code, and a bit of fixing to the functions. All in all, it's a stable base to work off of for your own learning.

READ BELOW:
I ask one thing: if you manage to use this code base to create a fix, add a feature, or something that we could use, SHARE IT. If people will take this and won't give back, then I will stop sharing. I won't ask twice.
READ ABOVE

SHARE ANY PROGRESS YOU MAKE! I think the future of the L2Server community depends on if people will stop being selfish and work together.

Also, RipperX has joined onto this project with me. We've begun working on some new code for different packet cases. As we make fixes, we will post the progress. Source code is, for now, an optional post from me, but so far you have 95% of the code I have written.

Good luck to all people who try to understand this, learn from it, and hopefully people will GIVE BACK to this. Download the attached file for the source and a compiled dll as well.

Вложения из исходного сообщения (сами файлы в копии отсутствуют):
l2extensionprojectv0.2_532.rar — 359750 байт

hel
18.06.2006, 21:59
mcrabben7:
I know C++ a bit and maybe I'll help to your devteam in future, when I understand a code. :)
Thanks. ;)

Bacek
18.06.2006, 22:03
Wow, nice, I will help in this topic soon! Thanks for share!

max_rain
18.06.2006, 22:22
//enhant
const WORD StaffsEnchant = 0x03; //3
const WORD ArmorsEnchant = 0x03; //3
const WORD WeaponsEnchant = 0x03; //3


//enchant
DWORD * NewWeaponsEnchantAddr = (DWORD *)0x00489984;
*NewWeaponsEnchantAddr = (DWORD)WeaponsEnchant;

DWORD * NewArmorsEnchantAddr = (DWORD *)0x00489A06;
*NewArmorsEnchantAddr = (DWORD)ArmorsEnchant;

DWORD * NewStaffssEnchantAddr = (DWORD *)0x0048988C;
*NewStaffssEnchantAddr = (DWORD)StaffsEnchant;

tomorrow write something more serious....

mcrabben7
18.06.2006, 22:41
RipperX and I are looking for any information on how to access the User struct inside L2Server. We need to be able to see what class a player has, their stats, mp, hp, cp, and other stuff. Any help would be appreciated.

Max_Rain: yea, those are the enchant addresses. Later on when the project gets its own config file and we read values from it (I already got a class written for it) then we can let people set the enchant limits themselves. Thanks for the code.

Btw, I already know the addresses for settings like Clan Leave penalty, Alliance leave Penalty, Clan War Penalty, and other penalties. Those can be added in the future.

mcrabben7
18.06.2006, 22:44
Sorry for the double post.

RipperX has already got the basic foundation for RecipeBook started.

I am working on AutoSS right now.

None of these are done yet. RecipeBook will need SQL and access to the UserStruct to be finished. If someone wants to work on something, pick a feature other than the ones above.

testdude
18.06.2006, 22:59
the user struct in the l2server, as told to me by alien003, is stored in ECX for any User:: function, so then all you really need to do is hook the dword table address for userinfo, get all the info u need out of the user struct when the userinfo packet is sent, and store it in a struct... i found that the best way to store the info in the struct is by char id for easy lookup, though i didnt really look into it all that much, i also found it best to store the socket in the struct, aswell as charname and sid, so that for packets such as autoss you can look up in the table by socket, as thats the only thing u will have from the packet, though i dont know if there are any functions to get sid or charid or name from the socket in the l2server, so i dont really know, this was just easyest for what i did as i wasnt sure about any functions at the time...

Alien003
18.06.2006, 23:40
DS:[socket + 1394h] = User Struct

8)

testdude
19.06.2006, 00:04
wait a minute... so... the socket as in the one for the user? cos if so im gonna scream ^_^

mcrabben7
19.06.2006, 00:16
Is the location where I hook packets (50F8F4) inside this same User scope so that I can get the information? Will the pointer to the start of the packet + 1394h give me the user struct? Also, I don't even know where to begin knowing what is in the User struct. Is there any good way to know what part of it is what, how big each entry is, etc.?

testdude
19.06.2006, 00:22
if im not mistaken what u have labled as the "start of the packet" is the socket, i dont know where u hooked the packets so i dunno, but i dont think its the same place i did mine xD


also, good way to find out what is where in user struct, debug userinfo packet

mcrabben7
19.06.2006, 00:34
Alright, thanks for the reply. I have (some) reference on what is in the UserInfo packet, so I'll try that. Thanks.

Alien003
19.06.2006, 00:38
wait a minute... so... the socket as in the one for the user? cos if so im gonna scream ^_^

scream :P

dunno what arguments your hook function is using, I'm catching them using the function table, just like normal packets

my functions prototypes are

BOOL function(void* pSocket, const char* pData);

DS:[pSocket + 1394h] = pUser

DS:[DS:[pUser + 0f54h] + numberFromAI] = same parameter as in AI

DS:[pUser + 0f60h] = CInventory


and just correcting a thing testdude said

the user struct in the l2server, as told to me by alien003, is stored in ECX for any User:: function

thats only valid at the start of the function, after that it's ALWAYS copyed to other register , usually EDI, ESI or EBX

max_rain
19.06.2006, 05:57
Procedures with offsets

Вложения из исходного сообщения (сами файлы в копии отсутствуют):
1190_142.rar — 14909 байт

Saito
19.06.2006, 10:38
Great work mcabben7,

Good luck with project Elhaym

Looks very promissing

Grillo
19.06.2006, 12:28
I wish my C++ knowledge was better, I can only create small stupid programs.
But I was wondering if the function , when u double click on an item, it changes in another item is possible to add in this dll, or is that function AI, don't know much about it.

max_rain
19.06.2006, 12:34
grillo, pm me in icq or msn

GeNtOo
19.06.2006, 13:04
nice project, if I can i try help too :)

GeNtOo
19.06.2006, 13:21
hmm maybe this is good but i dont think so:(

//ally limit

const WORD AllyLimit = 0x83 F8 0C 72 38 90 90 90 90
const WORD AllyLimit_1 = 0x0C //0C Clans amount +1 exp.: 0C=12 +1 so in ally 13clans (1slot for owner)


//allyLimit

DWORD * NewAllyLimitAddr = (DWORD *)0x00512877;
*NewAllyLimitAddr = (DWORD)AllyLimit;


DWORD * NewAllyLimit_1Addr = (DWORD *)0x00512879;
*NewAllyLimit_1Addr = (DWORD)AllyLimit_1;

lil updated

Alien003
19.06.2006, 14:53
Procedures with offsets

hey how about giving credit or posting a link to the original topic??? :evil:
https://postpacific.mmorpg-game.online/forum/viewtopic.php?p=43314
(its updated btw)

GeNtOo
19.06.2006, 15:03
CLan ppl limits

//clan limits

const WORD CLan_0 = 0x0A
const WORD CLan_1 = 0x0F
const WORD CLan_2 = 0x14
const WORD CLan_3 = 0x19
const WORD CLan_4 = 0x1E
const WORD CLan_5 = 0x28

//clan limits

DWORD * NewCLan_0Addr = (DWORD *)0x0051038C;
*NewCLan_0Addr = (DWORD)CLan_0;

DWORD * NewCLan_1Addr = (DWORD *)0x005103D6;
*NewCLan_1Addr = (DWORD)CLan_1;

DWORD * NewCLan_2Addr = (DWORD *)0x005103E0;
*NewCLan_2Addr = (DWORD)CLan_2;

DWORD * NewCLan_3Addr = (DWORD *)0x005103EA;
*NewCLan_3Addr = (DWORD)CLan_3;

DWORD * NewCLan_4Addr = (DWORD *)0x005103F4;
*NewCLan_4Addr = (DWORD)CLan_4;

DWORD * NewCLan_5Addr = (DWORD *)0x005103FE;
*NewCLan_5Addr = (DWORD)CLan_5;

GeNtOo
19.06.2006, 15:04
tomorrow ill work on clan penaltys :)

Enishi
19.06.2006, 17:42
Turns out I cant compile the dll cuz i'm missing windows.h ._.
Free version of VS2K5 ftl :(

BeBu
19.06.2006, 17:55
get the plattform sdk here :
http://www.microsoft.com/msdownload/platformsdk/sdkupdate/

Enishi
19.06.2006, 18:43
CLan ppl limits

//clan limits

const WORD CLan_0 = 0x0A
const WORD CLan_1 = 0x0F
const WORD CLan_2 = 0x14
const WORD CLan_3 = 0x19
const WORD CLan_4 = 0x1E
const WORD CLan_5 = 0x28

//clan limits

DWORD * NewCLan_0Addr = (DWORD *)0x0051038C;
*NewCLan_0Addr = (DWORD)CLan_0;

DWORD * NewCLan_1Addr = (DWORD *)0x005103D6;
*NewCLan_1Addr = (DWORD)CLan_1;

DWORD * NewCLan_2Addr = (DWORD *)0x005103E0;
*NewCLan_2Addr = (DWORD)CLan_2;

DWORD * NewCLan_3Addr = (DWORD *)0x005103EA;
*NewCLan_3Addr = (DWORD)CLan_3;

DWORD * NewCLan_4Addr = (DWORD *)0x005103F4;
*NewCLan_4Addr = (DWORD)CLan_4;

DWORD * NewCLan_5Addr = (DWORD *)0x005103FE;
*NewCLan_5Addr = (DWORD)CLan_5;

Thanks Bebu :D
Ok so i'm totally noob at this but i'm trying to learn...how would I use the code above in the DLL?

Cthalupa
19.06.2006, 18:43
I fully support your right to make money off of your hard work, as it's certainly a worthy endeavor you're partaking in, and if it comes to fruit, will be a great boon on the community.

However...


Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so


By releasing it under the MIT license, you just allowed everyone to do basicly whatever they want with it, as long as they include the license file, etc.


Yet right under that, you say people aren't allowed to sell it, or use it at all in anything that involves them making money, including using it on servers where the operator makes a profit. You can't release something under a license, and then say "disregard part so and so". It leaves you no legal options if someone is violating the terms you mean to set, but are allowed in the actual license you released it under.

So, if you're against people using this for money, you might want to choose a different license to release it under :)

Saito
19.06.2006, 19:03
yeah I'm sure the people running a ilegal l2 off server will back off the MIT license ~_~

zako
19.06.2006, 19:10
I'll look into this, And see what i can contribute, I also pmed you macraben

mcrabben7
19.06.2006, 23:03
Meh, I'll rewrite my own License file then :P The code you have now is only a skeleton frame. That much of the code is just fine, M.I.T. license or not :P

BTW, Packet Dump of an AutoSS packet:

Packet Dump: d0 05 00 ba 05 00 00 01 00 00 00 :)

Enishi
19.06.2006, 23:06
Would someone mind posting the steps one would take to complete a basic fix...like getting the packet info and so on.
Trying to learn so what i'm gonna work on is changing the systemmessage when you heal/someone heals you.
"BlahblahHP has been restored by blahblah"

mcrabben7
19.06.2006, 23:21
The code I posted already gets the packet headers for you. If you want to get a specific part of the packet, set header (I renamed it to pBuffer now) to + x bytes, depending where the data you want is. Then read a DWORD (4 bytes) worth of data and store it for your use.

Here is a packet dump function which I will share:
// Allows for the complete dump of a packet to the log file
//
// Parameters:
// DWORD * packet - the address of the start of the packet (pBuffer)
// DWORD bytes - how many bytes to dump to the log file
//
void DumpPacket(DWORD * packet, DWORD bytes)
{
WORD temp = 0;
DWORD * packetAddr = 0;
packetAddr = packet;
file << ">>>>>>>>> Packet Dump: ";
for(unsigned int i=0; i < bytes; ++i)
{
temp = (BYTE)*(packetAddr);
if(temp<16) {
file << "0" << temp << " ";
} else {
file << temp << " ";
}
__asm { add packetAddr, 1 }
}
file << "\n";
file.flush();
}

Send it the address of the start of the packet. In my code I uploaded, send it header. I have since then renamed header to pBuffer, packet to pSocket, and changed packetStart in all functions to pSocket. Those names make more sense about what the pointer points to.

Also, here is how you access the SystemMessage functionality in L2Server. See L2J for an idea of all the possible combinations and values. It is a pretty robust packet format.

//SystemMessage
format = "cdddd";
__asm
{
push itemID //itemID
push 3 //??
push 1 //??
push msgID //system message ID
push 0x7A //packet header
push format //packet format 'cdddd'
push pSocket //pushes the address of the start of the packet
call fCUserSocketSend
add esp, 0x1C //fix our stack pointer (7 * 0x04 = 0x1C)
}

Take careful note of how the packet format is cddd + however many parameters you give it extra. That will have to be accounted for. Like I said, see L2J for the outline of how that is structured.

Enishi: I am not sure exactly which packet handles healing. It might be an internal call to send a SystemMessage packet that will need to be hooked and changed to show the HP healed. I'm not sure on this yet. if it is a specific packet for healing, then hook it, call your own function, and write the code to handle it.

Cthalupa
20.06.2006, 00:34
Meh, I'll rewrite my own License file then :P The code you have now is only a skeleton frame. That much of the code is just fine, M.I.T. license or not :P

BTW, Packet Dump of an AutoSS packet:

Packet Dump: d0 05 00 ba 05 00 00 01 00 00 00 :)

Yea, just trying to help make sure you don't get burned later on by some guy ripping off your/others work and claiming it as his own.


Wish I knew more programming than the junk I picked up in CS1, I'd love to help out.

testdude
20.06.2006, 01:38
Would someone mind posting the steps one would take to complete a basic fix...like getting the packet info and so on.
Trying to learn so what i'm gonna work on is changing the systemmessage when you heal/someone heals you.
"BlahblahHP has been restored by blahblah"004D600F is where you need to look, if u look down it sends a system message, now ive not actually done anything with skills at all, so im kinda in the dark right here, but if u set a BP at the start of the function and step thru it u should be able to find where, and in what, the ammount which is being healed is, then just hook the call to the send for the system message, and add in the hp, pretty simple in theory, difficult in practice xD

Postal
20.06.2006, 01:47
CLan ppl limits

//clan limits

const WORD CLan_0 = 0x0A
const WORD CLan_1 = 0x0F
const WORD CLan_2 = 0x14
const WORD CLan_3 = 0x19
const WORD CLan_4 = 0x1E
const WORD CLan_5 = 0x28

//clan limits

DWORD * NewCLan_0Addr = (DWORD *)0x0051038C;
*NewCLan_0Addr = (DWORD)CLan_0;

DWORD * NewCLan_1Addr = (DWORD *)0x005103D6;
*NewCLan_1Addr = (DWORD)CLan_1;

DWORD * NewCLan_2Addr = (DWORD *)0x005103E0;
*NewCLan_2Addr = (DWORD)CLan_2;

DWORD * NewCLan_3Addr = (DWORD *)0x005103EA;
*NewCLan_3Addr = (DWORD)CLan_3;

DWORD * NewCLan_4Addr = (DWORD *)0x005103F4;
*NewCLan_4Addr = (DWORD)CLan_4;

DWORD * NewCLan_5Addr = (DWORD *)0x005103FE;
*NewCLan_5Addr = (DWORD)CLan_5;

Thanks Bebu :D
Ok so i'm totally noob at this but i'm trying to learn...how would I use the code above in the DLL?


Umm I would just like to point out that in retail you can infact have 40 members in any level clan. It was a update in c2 however it seems to be a little known fact.

"2. The game was revised so that, while the maximum number of clan members had been 40 when the clan level reaches 5, the maximum number is 40 even before the clan reaches level 5. The number of clans that can be included in an alliance was increased to 12."

http://www.lineage2.com/news/chronicle2_15.html

I know it is kind of offtopic but when I see you write this code I feel it is neccessairy to point it out.

RipperX
20.06.2006, 02:40
I have a hard headache, plz someone that know good the packets can tell me
what is wrong here ? The server don't crash but don't showme the recipebook empty.


const char * format = "cddd";
__asm
{
push 0x0000 //Number of Items
push 0x06EA //MaxMP (TODO) should show 1770 =x06EA Mp
push is_dwarf //is dwarven ?
push 0x00D6 //the packet header
push format //packet format 'cddd'
push pSocket //push address of the start of the packet
call fCUserSocketSend
add esp, 0x18 //fix our stack pointer (6 * 0x04 = 0x18)
}


Plz take a look

mcrabben7
20.06.2006, 02:58
Dude, you should of showed me on MSN :) I'll talk to you about it later. After you wake up, heheh.

GeNtOo
20.06.2006, 10:23
Sorry ppl in 1st post i made mistake now all fixed

//clan limits

const WORD CLan_0 = 0x0A
const WORD CLan_1 = 0x0F
const WORD CLan_2 = 0x14
const WORD CLan_3 = 0x19
const WORD CLan_4 = 0x1E
const WORD CLan_5 = 0x28

//clan limits

DWORD * NewCLan_0Addr = (DWORD *)0x0051038E;
*NewCLan_0Addr = (DWORD)CLan_0;

DWORD * NewCLan_1Addr = (DWORD *)0x005103F6;
*NewCLan_1Addr = (DWORD)CLan_1;

DWORD * NewCLan_2Addr = (DWORD *)0x005103E2;
*NewCLan_2Addr = (DWORD)CLan_2;

DWORD * NewCLan_3Addr = (DWORD *)0x005103EC;
*NewCLan_3Addr = (DWORD)CLan_3;

DWORD * NewCLan_4Addr = (DWORD *)0x005103F6;
*NewCLan_4Addr = (DWORD)CLan_4;

DWORD * NewCLan_5Addr = (DWORD *)0x00510400;
*NewCLan_5Addr = (DWORD)CLan_5;

montejo1974
20.06.2006, 11:28
Hi and thx for sharing your source work.

I'm willing to do some research on clan rights, using your dll to catch this kind of packets, and use some own table to store rights.
So, when someone send to the server the packet implying any of this rights capture with dll the packet, do the dirty job, and send finally a totally autobuild (by the dll) the packet to the cached exe (or l2server...I need to study it).

This is the idea...now the question/problem.

You can call me stupid noob if the question is so categorized. :D

I have a personal server at home running a C2 (maybe I'll update it to C3), and that is all I have for doing research and test. Would be useful later to all of you?? Or Is totally needed I run up a C4 to my work be useful for the community?

Thx for the responses, and will be pleased on help/ideas about that.

dknod
20.06.2006, 13:17
I was looking for some information about fishing in L2J server website and i found a Fishing engine (which was posted by [glow=red:1c88000d9a]Nemesiss[/glow:1c88000d9a] ). This engine contained html's and more ;)

I hope this will be usefull...
(don't flame me for sharing it, this is just for studing purpose)
All credits goes to Nemesiss and L2J community

Вложения из исходного сообщения (сами файлы в копии отсутствуют):
fishing_212.rar — 136472 байт

draft
20.06.2006, 13:53
Meh, I'll rewrite my own License file then :P The code you have now is only a skeleton frame. That much of the code is just fine, M.I.T. license or not :P

BTW, Packet Dump of an AutoSS packet:

Packet Dump: d0 05 00 ba 05 00 00 01 00 00 00 :)

lol

AutoSS have 2 parts
1 message system+shortcut engine
2 inventory service patch.

both parts have diferent headers but almoust same struct.

mcrabben7
20.06.2006, 19:20
@montejo1974: I am doing all of this on a C4 client. the goal is to make a C4 DLL, since most people run C3/C4 servers.

The correct procedure for handling packets is this:

Client sends a packet with header 0xXX (my ReceivePacket function handles this). You make a function to send a packet back to the client using the fCUserSocketSend function, the proper pSocket, the proper format, the right packet header, and all the variables. See the L2J source for examples of how to handle packets, what headers correspond to what, etc.

Here is the L2J codes for handling client -> server packets:
switch(id)
{
case 0x00:
msg = new ProtocolVersion(data, client);
break;
case 0x01:
msg = new MoveBackwardToLocation(data, client);
break;
// case 0x02:
// // Say ... not used any more ??
// break;
case 0x03:
msg = new EnterWorld(data, client);
break;
case 0x04:
msg = new Action(data, client);
break;
case 0x08:
msg = new AuthLogin(data, client);
break;
case 0x09:
msg = new Logout(data, client);
break;
case 0x0a:
msg = new AttackRequest(data, client);
break;
case 0x0b:
msg = new CharacterCreate(data, client);
break;
case 0x0c:
msg = new CharacterDelete(data, client);
break;
case 0x0d:
msg = new CharacterSelected(data, client);
break;
case 0x0e:
msg = new NewCharacter(data, client);
break;
case 0x0f:
msg = new RequestItemList(data, client);
break;

// case 0x10:
// // RequestEquipItem ... not used any more, instead "useItem"
// break;
case 0x11:
msg = new RequestUnEquipItem(data, client);
break;
case 0x12:
msg = new RequestDropItem(data, client);
break;
case 0x14:
msg = new UseItem(data, client);
break;
case 0x15:
msg = new TradeRequest(data, client);
break;
case 0x16:
msg = new AddTradeItem(data, client);
break;
case 0x17:
msg = new TradeDone(data, client);
break;
case 0x1a:
msg = new DummyPacket(data, client, id);
break;
case 0x1b:
msg = new RequestSocialAction(data, client);
break;
case 0x1c:
msg = new ChangeMoveType2(data, client);
break;
case 0x1d:
msg = new ChangeWaitType2(data, client);
break;
case 0x1e:
msg = new RequestSellItem(data, client);
break;
case 0x1f:
msg = new RequestBuyItem(data, client);
break;

case 0x20:
msg = new RequestLinkHtml(data,client);
break;
case 0x21:
msg = new RequestBypassToServer(data, client);
break;
case 0x22:
msg = new RequestBBSwrite(data, client);
break;
case 0x23:
msg = new DummyPacket(data,client, id);
break;
case 0x24:
msg = new RequestJoinPledge(data, client);
break;
case 0x25:
msg = new RequestAnswerJoinPledge(data, client);
break;
case 0x26:
msg = new RequestWithdrawalPledge(data, client);
break;
case 0x27:
msg = new RequestOustPledgeMember(data, client);
break;
// case 0x28:
// // RequestDismissPledge
// break;
case 0x29:
msg = new RequestJoinParty(data, client);
break;
case 0x2a:
msg = new RequestAnswerJoinParty(data, client);
break;
case 0x2b:
msg = new RequestWithDrawalParty(data, client);
break;
case 0x2c:
msg = new RequestOustPartyMember(data, client);
break;
case 0x2d:
// RequestDismissParty
break;
case 0x2e:
msg = new DummyPacket(data, client, id);
break;
case 0x2f:
msg = new RequestMagicSkillUse(data, client);
break;
case 0x30:
msg = new Appearing(data, client); // (after death)
break;
case 0x31:
if (Config.ALLOW_WAREHOUSE)
msg = new SendWareHouseDepositList(data, client);
break;
case 0x32:
msg = new SendWareHouseWithDrawList(data, client);
break;
case 0x33:
msg = new RequestShortCutReg(data, client);
break;
case 0x34:
msg = new DummyPacket(data, client, id);
break;
case 0x35:
msg = new RequestShortCutDel(data, client);
break;
case 0x36:
msg = new CannotMoveAnymore(data, client);
break;
case 0x37:
msg = new RequestTargetCanceld(data, client);
break;
case 0x38:
msg = new Say2(data, client);
break;
case 0x3c:
msg = new RequestPledgeMemberList(data, client);
break;
case 0x3e:
msg = new DummyPacket(data, client, id);
break;
case 0x3f:
msg = new RequestSkillList(data, client);
break;

// case 0x41:
// // MoveWithDelta ... unused ?? or only on ship ??
// break;
case 0x42:
msg = new RequestGetOnVehicle(data, client);
break;
case 0x43:
msg = new RequestGetOffVehicle(data, client);
break;
case 0x44:
msg = new AnswerTradeRequest(data, client);
break;
case 0x45:
msg = new RequestActionUse(data, client);
break;
case 0x46:
msg = new RequestRestart(data, client);
break;
// case 0x47:
// // RequestSiegeInfo
// break;
case 0x48:
msg = new ValidatePosition(data, client);
break;
// case 0x49:
// // RequestSEKCustom
// break;
// THESE ARE NOW TEMPORARY DISABLED
case 0x4a:
// new StartRotating(data, _client);
break;
case 0x4b:
// new FinishRotating(data, _client);
break;
case 0x4d:
msg = new RequestStartPledgeWar(data, client);
break;
case 0x4e:
msg = new RequestReplyStartPledgeWar(data, client);
break;
case 0x4f:
msg = new RequestStopPledgeWar(data, client);
break;

case 0x50:
msg = new RequestReplyStopPledgeWar(data, client);
break;
case 0x51:
msg = new RequestSurrenderPledgeWar(data, client);
break;
case 0x52:
msg = new RequestReplySurrenderPledgeWar(data,client);
break;
case 0x53:
msg = new RequestSetPledgeCrest(data, client);
break;
case 0x55:
msg = new RequestGiveNickName(data, client);
break;
case 0x57:
msg = new RequestShowBoard(data, client);
break;
case 0x58:
msg = new RequestEnchantItem(data, client);
break;
case 0x59:
msg = new RequestDestroyItem(data, client);
break;
case 0x5b:
msg = new SendBypassBuildCmd(data, client);
break;
case 0x5c:
msg = new RequestMoveToLocationInVehicle(data, client);
break;
case 0x5d:
msg = new CannotMoveAnymoreInVehicle(data, client);
break;
case 0x5e:
msg = new RequestFriendInvite(data, client);
break;
case 0x5f:
msg = new RequestAnswerFriendInvite(data, client);
break;

case 0x60:
msg = new RequestFriendList(data, client);
break;
case 0x61:
msg = new RequestFriendDel(data, client);
break;
case 0x62:
msg = new CharacterRestore(data, client);
break;
case 0x63:
msg = new RequestQuestList(data, client);
break;
case 0x64:
msg = new RequestQuestAbort(data, client);
break;
case 0x66:
msg = new RequestPledgeInfo(data, client);
break;
// case 0x67:
// // RequestPledgeExtendedInfo
// break;
case 0x68:
msg = new RequestPledgeCrest(data, client);
break;
case 0x69:
msg = new RequestSurrenderPersonally(data,client);
break;
// case 0x6a:
// // Ride
// break;
case 0x6b: // send when talking to trainer npc, to show list of available skills
msg = new RequestAquireSkillInfo(data, client);// --> [s] 0xa4;
break;
case 0x6c: // send when a skill to be learned is selected
msg = new RequestAquireSkill(data, client);
break;
case 0x6d:
msg = new RequestRestartPoint(data, client);
break;
case 0x6e:
msg = new RequestGMCommand(data, client);
break;
case 0x6f:
msg = new RequestPartyMatchConfig(data, client);
break;

case 0x70:
msg = new RequestPartyMatchList(data, client);
break;
case 0x71:
msg = new RequestPartyMatchDetail(data, client);
break;
case 0x72:
msg = new RequestCrystallizeItem(data, client);
break;
case 0x73:
msg = new RequestPrivateStoreManageSell(data, client);
break;
case 0x74:
msg = new SetPrivateStoreListSell(data, client);
break;
// case 0x75:
// msg = new RequestPrivateStoreManageCancel(data, _client);
// break;
case 0x76:
msg = new RequestPrivateStoreQuitSell(data, client);
break;
case 0x77:
msg = new SetPrivateStoreMsgSell(data, client);
break;
// case 0x78:
// // RequestPrivateStoreList
// break;
case 0x79:
msg = new RequestPrivateStoreBuy(data, client);
break;
// case 0x7a:
// // ReviveReply
// break;
// case 0x7b:
// // RequestTutorialLinkHtml
// break;
// case 0x7c:
// // RequestTutorialPassCmdToServer
// break;
// case 0x7d:
// // RequestTutorialQuestionMark
// break;
// case 0x7e:
// // RequestTutorialClientEvent
// break;
case 0x7f:
msg = new RequestPetition(data, client); //cSd
break;

case 0x80:
msg = new RequestPetitionCancel(data, client); //cS
break;
case 0x81:
msg = new RequestGmList(data, client);
break;
case 0x82:
msg = new RequestJoinAlly(data, client);
break;
case 0x83:
msg = new RequestAnswerJoinAlly(data, client);
break;
case 0x84:
msg = new AllyLeave(data, client);
break;
case 0x85:
msg = new AllyDismiss(data, client);
break;
// case 0x86:
// // RequestDismissAlly
// break;
case 0x87:
msg = new RequestSetAllyCrest(data, client);
break;
case 0x88:
msg = new RequestAllyCrest(data, client);
break;
case 0x89:
msg = new RequestChangePetName(data, client);
break;
case 0x8a:
msg = new RequestPetUseItem(data, client);
break;
case 0x8b:
msg = new RequestGiveItemToPet(data, client);
break;
case 0x8c:
msg = new RequestGetItemFromPet(data, client);
break;
case 0x8e:
msg = new RequestAllyInfo(data, client);
break;
case 0x8f:
msg = new RequestPetGetItem(data, client);
break;

case 0x90:
msg = new RequestPrivateStoreManageBuy(data, client);
break;
case 0x91:
msg = new SetPrivateStoreListBuy (data, client);
break;
// case 0x92:
// // RequestPrivateStoreBuyManageCancel
// break;
case 0x93:
msg = new RequestPrivateStoreQuitBuy (data, client);
break;
case 0x94:
msg = new SetPrivateStoreMsgBuy(data, client);
break;
// case 0x95:
// // RequestPrivateStoreBuyList
// break;
case 0x96:
msg = new RequestPrivateStoreSell(data, client);
break;
// case 0x97:
// // SendTimeCheckPacket
// break;
// case 0x98:
// // RequestStartAllianceWar
// break;
// case 0x99:
// // ReplyStartAllianceWar
// break;
// case 0x9a:
// // RequestStopAllianceWar
// break;
// case 0x9b:
// // ReplyStopAllianceWar
// break;
// case 0x9c:
// // RequestSurrenderAllianceWar
// break;
case 0x9d:
// RequestSkillCoolTime
if (Config.DEBUG) _log.info("Request Skill Cool Time .. ignored");
msg = null;
break;
// case 0x9e:
// // RequestPackageSendableItemList
// break;
// case 0x9f:
// // RequestPackageSend
// break;

case 0xa0:
msg = new RequestBlock(data,client);
break;
// case 0xa1:
// // RequestCastleSiegeInfo
// break;
case 0xa2:
msg = new RequestSiegeAttackerList(data,client);
break;
case 0xa3:
msg = new RequestSiegeDefenderList(data,client);
break;
case 0xa4:
msg = new RequestJoinSiege(data,client);
break;
case 0xa5:
msg = new RequestConfirmSiegeWaitingList(data,client);
break;
// case 0xa6:
// // RequestSetCastleSiegeTime
// break;
case 0xa7:
msg = new MultiSellChoose(data,client);
break;
// case 0xa8:
// // NetPing
// break;
case 0xaa:
msg = new RequestUserCommand(data, client);
break;
case 0xab:
msg = new SnoopQuit(data, client);
break;
case 0xac: // we still need this packet to handle BACK button of craft dialog
msg = new RequestRecipeBookOpen(data, client);
break;
case 0xad:
msg = new RequestRecipeBookDestroy(data, client);
break;
case 0xae:
msg = new RequestRecipeItemMakeInfo(data, client);
break;
case 0xaf:
msg = new RequestRecipeItemMakeSelf(data, client);
break;

//case 0xb0:
// msg = new RequestRecipeShopManageList(data, client);
// break;
case 0xb1:
msg = new RequestRecipeShopMessageSet(data, client);
break;
case 0xb2:
msg = new RequestRecipeShopListSet(data, client);
break;
case 0xb3:
msg = new RequestRecipeShopManageQuit(data, client);
break;
case 0xb5:
msg = new RequestRecipeShopMakeInfo(data, client);
break;
case 0xb6:
msg = new RequestRecipeShopMakeItem(data, client);
break;
case 0xb7:
msg = new RequestRecipeShopManagePrev(data, client);
break;
case 0xb8:
msg = new ObserverReturn(data, client);
break;
case 0xb9:
msg = new RequestEvaluate(data, client);
break;
case 0xba:
msg = new RequestHennaList(data, client);
break;
case 0xbb:
msg = new RequestHennaItemInfo(data, client);
break;
case 0xbc:
msg = new RequestHennaEquip(data, client);
break;

case 0xc0:
// Clan Privileges
msg = new RequestPledgePower(data, client);
break;
case 0xc1:
msg = new RequestMakeMacro(data, client);
break;
case 0xc2:
msg = new RequestDeleteMacro(data, client);
break;
case 0xc6:
msg = new RequestWearItem(data, client);
break;
case 0xc7:
msg = new RequestRecordUpdate(data, client);
break;
case 0xCA:
msg = new GameGuardReply(data,client);
break;
case 0xcc:
msg = new RequestSendFriendMsg(data, client);
break;
case 0xcd:
msg = new RequestShowMiniMap(data, client);
break;
case 0xce: // MSN dialogs so that you dont see them in the console.
break;
case 0xcf: //record video
break;

case 0xd0: // Request auto ss and (b)sps.
int id2 = data.getShort() & 0xffff;
switch (id2)
{
case 1:
msg = new RequestOustFromPartyRoom(data, client);
break;
case 2:
msg = new RequestDismissPartyRoom(data, client);
break;
case 3:
msg = new RequestWithdrawPartyRoom(data, client);
break;
case 4:
msg = new RequestChangePartyLeader(data, client);
break;
case 5:
msg = new RequestAutoSoulShot(data, client);
break;
case 6:
msg = new RequestExEnchantSkillInfo(data, client);
break;
case 7:
msg = new RequestExEnchantSkill(data, client);
break;
case 8:
msg = new RequestManorList(data, client);
break;
case 9:
msg = new RequestProcureCropList(data, client);
break;
case 0x0a:
msg = new RequestSetSeed(data, client);
break;
case 0x0b:
msg = new RequestSetCrop(data, client);
break;
case 0x0c:
msg = new RequestWriteHeroWords(data, client);
break;
case 0x0d:
msg = new RequestExAskJoinMPCC(data, client);
break;
case 0x0e:
msg = new RequestExAcceptJoinMPCC(data, client);
break;
case 0x0f:
msg = new RequestExOustFromMPCC(data, client);
break;
case 0x10:
msg = new RequestExPledgeCrestLarge(data, client);
break;
case 0x11:
msg = new RequestExSetPledgeCrestLarge(data, client);
break;
case 0x12:
msg = new RequestOlympiadObserverEnd(data, client);
break;
case 0x13:
msg = new RequestOlympiadMatchList(data, client);
break;
default:
msg = null;
int size = data.remaining();
_log.warning("Unknown Packet: 0xd0:" + Integer.toHexString(id2));
byte[] array = new byte[size];
data.get(array);
_log.warning(Util.printData(array, size));
break;
}
break;
}

See the minimap code for an example of how to do this. It's a simpler example than most other packet functions will be, but if you understand it then you should be able to build off of it.

Btw: inside the ReplyRequestShowMiniMap() function I added a pSocket check just in case a socket goes bad on you:
if ( pSocket != NULL )
{
//code to send packet to client
}
I am doing the same check inside all of my functions now. Better to be safe ;)

@draft: I know that there is more than one part to AutoSS. I have the message system for enabling and disabling in place. I'm working on the actual automatic use of the soulshots now. Just because I post a packet dump doesn't mean I don't know about the other parts in the process.

I will say this to everyone: we all do what we can do. Don't treat anyone like an idiot because they post a something and you want to act better than them. It'd be better to actually post something useful.

mcrabben7
20.06.2006, 22:36
Everyone else I have had attach it has no problems. Maybe your exe isn't compatible. Use an original C1 exe, or the PP release exe. I know the PP release will work with this dll just fine.

mcrabben7
20.06.2006, 23:58
Open the exe in STUD_PE Exe Injector. Go to functions.
Click "Add new import"
Select "Open DLL"
Select the L2EP[Elhaym].dll
Click "Select import function"
Select "DllMain@12"
Click "Add to List"
Click OK.

That should be the entire process...

montejo1974
21.06.2006, 07:51
@montejo1974: I am doing all of this on a C4 client. the goal is to make a C4 DLL, since most people run C3/C4 servers.

Ok man, try to update my test server to work on C4 clients ;)

Thans you very much for the answer.

EverCooL
21.06.2006, 11:19
Once again I request a mod to erase all posts from people asking for support to setup the dll. This is not the place to post it.

w2obom and dknod..

Topic Cleaned, warings given!

Keep up the good work !

Dmytro
21.06.2006, 14:04
Where you were earlier guys?! :D :P

... Adding ave_big_head (Abnormal), maybe not working ...
Thx to Aspire for HEX.


#include "headers.h"

void AddAveEffects();

const WCHAR * ave_big_head = L"ave_big_head";
const DWORD ave_bleeding_addr = 0x0056E4BC; //Start point
const BYTE db_ave_bleeding_addr[] = {0x8B,0x46,0x20,0x8B,0x4E,0x0C};
const DWORD sub_58C90D = 0x58C90D; //.text:0056E4CB call sub_58C90D
const DWORD loc_56E4C5 = 0x56E4C5; //push offset Ave_dot_bleed ; "ave_dot_bleeding" //Out point

//justification by 1 byte
struct jmp_far
{
BYTE _push; //push
DWORD addr; //address
BYTE _ret; //ret
};

//Abnormal_effects_update----------------------------------------------------------------------------------------------
void AbnormalEffects(HANDLE hMainInst)
{
BYTE OldCodeBuff[8];
jmp_far jump;

if(ReadProcessMemory(hMainInst,(LPVOID)ave_bleedin g_addr,&OldCodeBuff,sizeof(jump),NULL))
{
if(memcmp(OldCodeBuff,db_ave_bleeding_addr,sizeof( db_ave_bleeding_addr))==0)
{
jump._push = 0x68;
jump.addr = (DWORD)&AddAveEffects;
jump._ret = 0xC3;

if(!WriteProcessMemory(hMainInst,(LPVOID)ave_bleed ing_addr,&jump,sizeof(jump),NULL))
{
MessageBox(0,"AVE_EFFECTS: Can't write process memory!","Error Notice!",MB_OK | MB_ICONSTOP);
}
}
else
{
MessageBox(0,"AVE_EFFECTS: Wrong file version!","Error Notice!",MB_OK | MB_ICONSTOP);
}
}
else
{
MessageBox(0,"AVE_EFFECTS: Can't read process memory!","Error Notice!",MB_OK | MB_ICONSTOP);
}
}
//---------------------------------------------------------------------------------------------------------------------
Naked void AddAveEffects()
{
__asm
{
//ave_big_head
mov eax,[esi+20h]
mov ecx,[esi+0Ch]
mov edx,[ecx+eax*8]
push dword ptr [ave_big_head]
push edx
mov edx, sub_58C90D
call edx
add esp,8
test eax,eax
jne LEnd
mov eax,[esi+90h]
mov dword ptr [eax+1BCh],2000h
mov ecx,[esp+013Ch]
mov fs:[0],ecx
pop edi
pop esi
pop ebx
mov esp,ebp
pop ebp
retn
LEnd:
//ave_dot_bleeding -> header
mov eax,[esi+20h]
mov ecx,[esi+0Ch]
mov edx,[ecx+eax*8]
push loc_56E4C5
retn
}
}
//---------------------------------------------------------------------------------------------------------------------


I think start point must be another. Later i post another version.

draft
21.06.2006, 14:42
Maybe :d this info is useful too?

btw seems sun he finish his L2server version)

So, if you want translation - do it self as author say.


Только по причине личного уважения к ХФ я перестроил эту рутину под любой экзешник, он понимает о чем я, думаю это станет прекрасным довеском к его паку.
Что не включено в фикс:
Окошко приглашения с ником и типом лута
сами окна пати с фиксом ЦП\ХП\МП.

Ах да, перед тем как это пойдет в свободный личинг:
ХАМИ, ИДИ КА ТЫ ЕЩЕ РАЗОК НАХУЙ!

поехали:
10f945: cmp al,29
10f947: jne .00050f950
10f949: call @party
10f94e: jmps .00050f966
10f950: cmp al,0xaa
10f952: jb .00050f966
10f954: (смотрим в фикс для /loc и /alt+m чтобы понять куда прыгать) jmp @loc and alt+m switch
10f959: 90 90 90 90 90 90 90 90 90 90 90 90 90

@party
push ebp
mov ebp,esp
add esp,-8
push ebx
push edi
push esi
pushad
mov ecx,ebx
add ecx,13
push ecx
call @CharNametoObjectID
mov [ebp-4],eax
cmp d,[ebp-4],0
je @exit
mov eax,[eax+18]
mov [ebp-8],eax
mov eax,[ebp-8] :lol:
mov [ebx+13],eax
mov d,[ebx+17],0
mov w,[ebx+1b],00599
mov w,[ebx+10],0000b
@exit
popad
pop esi
pop edi
pop ebx
leave
retn


@CharNametoObjectID
push ebp
mov ebp,esp
add esp,0ffffff60
push ebx
push edi
push esi
lea eax,[ebp-0xa0] или любую другую ячейку она все равно вернется в исходное состояние
push eax
push d,[ebp+8]
call .000517b90
add esp,8
sub esp, 124
mov esi,esp
xor ebx,ebx
mov d,[esi+120],8b
mov [esi+11c],ebx
mov [esi+4],bx
lea edx,[ebp-0xa0] та же байда
push edx
call .00058c8b6
add esp,4
push eax
lea eax,[ebp-0xa0] и еще разок
push eax
mov ecx,esi
call .000406970
lea ecx,[ebp-0c]
push ecx
mov ecx,016922525
call .00041e4d0
mov eax,[ebp-0c]
pop esi
pop edi
pop ebx
leave
retn 4

Вместо спасибо лучше асм учите.
Как пофиксить само окно инвайта сами допетривайте не так уж это и сложно.


so this code is work without crashes and etc.

alysia
23.06.2006, 16:37
*delete*

Livid
23.06.2006, 19:20
Just as a response to recent posts...
{00}Pointer($005010F0),//VersionPacket
{01}Pointer($0050A160),//CheckForBot,//MoveToLocation
{02}Pointer($00501350),//SayPacket
{03}UserEnterWorld,//Pointer($00507210),//EnterWorldPacket
{04}Pointer($0050A4D0),//ActionPacket
{05}Pointer($00501070),//DummyPacket
{06}Pointer($00501070),//DummyPacket
{07}Pointer($00501070),//DummyPacket
{08}Pointer($0050E440),//LoginPacket
{09}Pointer($005015E0),//LogoutPacket
{0A}Pointer($005014A0),//AttackPacket
{0B}Pointer($00506C30),//CharacterCreatePacket
{0C}Pointer($00506F40),//CharacterDeletePacket
{0D}Pointer($00506B70),//CharacterSelectPacket
{0E}Pointer($00507000),//NewCharacterPacket
{0F}Pointer($005016D0),//ItemListPacket
{10}Pointer($005072D0),//EquipItemPacket
{11}Pointer($005073E0),//UnequipItemPacket
{12}Pointer($005077B0),//DropItemPacket
{13}Pointer($00501770),//GetItemPacket
{14}Pointer($00507520),//UseItemPacket
{15}Pointer($0050B710),//TradeRequestPacket
{16}Pointer($005019B0),//TradeAddItemsPacket
{17}Pointer($00501A60),//TradeDonePacket
{18}Pointer($00501070),//DummyPacket
{19}Pointer($00501070),//DummyPacket
{1A}Pointer($00507B20),//TeleportPacket
{1B}Pointer($00507BA0),//SocialActionPacket
{1C}Pointer($00507CD0),//ChangeMoveTypePacket
{1D}Pointer($00507DB0),//ChangeStopTypePacket
{1E}Pointer($0050F0A0),//SellPacket
{1F}Pointer($0050E6E0),//BuyPacket
{20}Pointer($00515460),//bbs????
{21}Pointer($00515660),//HTMLcmd
{22}Pointer($00501B50),//WriteHTMLPacket
{23}Pointer($00507EB0),//CreatePledgePacket
{24}Pointer($005102B0),//JoinPledgePacket
{25}Pointer($005105F0),//AnswerJoinPledgePacket
{26}Pointer($00508F60),//WithdrawPledgePacket
{27}Pointer($00509070),//OustPledgeMemberPacket
{28}Pointer($0049AAE0),//DoNothingPacket
{29}Pointer($005107C0),//JoinPartyPacket
{2A}Pointer($00510AB0),//AnswerJoinPartyPacket
{2B}Pointer($005091B0),//WithdrawPartyPacket
{2C}Pointer($005092C0),//OustPartyMemberPacket
{2D}Pointer($00509400),//DismissPartyPacket
{2E}Pointer($00502950),//MagicSkillListPacket
{2F}Pointer($00502A90),//MagicSkillUsePacket
{30}Pointer($00501FA0),//AppearingPacket
{}Pointer($00502490),
{}Pointer($00502660),
{}Pointer($00502060),
{}Pointer($00502140),
{}Pointer($005021D0),
{}Pointer($00502280),
{}Pointer($005023F0),
{}Pointer($00510FF0),
{}Pointer($00501070),//DummyPacket
{}Pointer($0049AAE0),
{}Pointer($0049AAE0),
{}Pointer($005094C0),
{}Pointer($0049AAE0),
{}Pointer($0049AAE0),
{}Pointer($005029F0),
{}Pointer($0049AAE0),
{}Pointer($00502B60),
{}Pointer($00502C80),
{}Pointer($00502DD0),
{}Pointer($00501900),
{}Pointer($005030E0),
{}Pointer($00508030),
{}Pointer($00508160),
{}Pointer($005031C0),
{}Pointer($00508440),
{}Pointer($0050AD50),
{}Pointer($0050AE80),
{}Pointer($005032F0),
{}Pointer($00511940),
{}Pointer($00511C60),
{}Pointer($00511EC0),
{}Pointer($00512140),
{}Pointer($0050CDE0),
{}Pointer($0049AAE0),
{}Pointer($005096B0),
{}Pointer($00503470),
{}Pointer($0050CE70),
{}Pointer($00503470),
{}Pointer($00503480),
{}Pointer($005084D0),
{}Pointer($00503560),
{}Pointer($0050D110),
{}Pointer($00503900),
{}Pointer($005039C0),
{}Pointer($00503B30),
{}Pointer($00512580),
{}Pointer($00512730),
{}Pointer($0050BB50),
{}Pointer($0050A7B0),
{}Pointer($00503C20),
{}Pointer($00503D00),
{}Pointer($00503D80),
{}Pointer($0049AAE0),
{}Pointer($0050BBC0),
{}Pointer($0050D3B0),
{}Pointer($0050BCB0),
{}Pointer($0050D690),
{}Pointer($0050AF90),
{}Pointer($00503EE0),
{}Pointer($0050A840),
{}Pointer($00504130),
{}Pointer($0050D850),
{}Pointer($00504230),
{}Pointer($00508750),
{}Pointer($0050BDE0),
{}Pointer($00504340),
{}Pointer($005046D0),
{}Pointer($005047B0),
{}Pointer($005048A0),
{}Pointer($00504980),
{}Pointer($00504A30),
{}Pointer($00504B00),
{}Pointer($0050BF30),
{}Pointer($0049AAE0),
{}Pointer($00504BC0),
{}Pointer($005151A0),
{}Pointer($00504D90),
{}Pointer($00504E40),
{}Pointer($00508860),
{}Pointer($00504F00),
{}Pointer($0050C360),
{}Pointer($005127C0),
{}Pointer($00512B90),
{}Pointer($00509750),
{}Pointer($0050DBE0),
{}Pointer($00512E60),
{}Pointer($005098C0),
{}Pointer($0050C0B0),
{}Pointer($00504FA0),
{}Pointer($005050F0),
{}Pointer($00505200),
{}Pointer($005053E0),
{}Pointer($0049AAE0),
{}Pointer($00513010),
{}Pointer($00505510),
{}Pointer($00505680),
{}Pointer($00505780),
{}Pointer($00505870),
{}Pointer($00505920),
{}Pointer($005059D0),
{}Pointer($00505AA0),
{}Pointer($0050C1E0),
{}Pointer($00505B60),
{}Pointer($00513410),
{}Pointer($005136F0),
{}Pointer($005139D0),
{}Pointer($00513CA0),
{}Pointer($00513F30),
{}Pointer($00505C90),
{}Pointer($00505D10),
{}Pointer($00509A30),
{}Pointer($0050DE90),
{}Pointer($00505E70),
{}Pointer($00505F00),
{}Pointer($00505FD0),
{}Pointer($00509BB0),
{}Pointer($00509E20),
{}Pointer($00509F80),
{}Pointer($005060A0),
{}Pointer($00506220),
{}Pointer($00508960),
{AA} ReplyLocPacket, //UserCommand
{AB} DummyPacket, //??
{AC} DummyPacket, //OpenReceipeBook
{AD} DummyPacket, //RequestRecipeBookDestroy
{AE} DummyPacket, //RequestRecipeItemMakeInfo
{AF} DummyPacket, //RequestRecipeItemMakeSelf
{B0} DummyPacket, //RequestRecipeShopManageList
{B1} DummyPacket, //RequestRecipeShopMessageSet
{B2} DummyPacket, //RequestRecipeShopListSet
{B3} DummyPacket, //RequestRecipeShopManageQuit
{B4} DummyPacket, //??
{B5} DummyPacket, //??
{B6} DummyPacket, //??
{B7} DummyPacket, //??
{B8} DummyPacket, //ObserverReturn
{B9} DummyPacket, //RequestEvaluate
{BA} RequestHennaEquipList, //RequestHennaEquipList
{BB} RequestHennaItemInfo, //RequestHennaItemInfo
{BC} RequestHennaEquip, //RequestHennaEquip
{BD} RequestHennaUnequipList, //RequestHennaUnequipList
{BE} RequestHennaUnequipInfo, //RequestHennaUnequipInfo
{BF} RequestHennaUnequip, //RequestHennaUnequip
{C0} DummyPacket, //Clan Privileges
{C1} RequestMakeMacro, //RequestMakeMacro
{C2} RequestDeleteMacro, //RequestDeleteMacro
{C3} DummyPacket, //
{C4} DummyPacket, //
{C5} DummyPacket, //
{C6} DummyPacket, //
{C7} DummyPacket, //RequestRecordUpdate
{C8} DummyPacket, //
{C9} DummyPacket, //
{CA} DummyPacket, //
{CB} DummyPacket, //
{CC} DummyPacket, //
{CD} ShowMiniMap, //ShowMiniMap
{CE} DummyPacket, //MSN.. ?
{CF} DummyPacket //autoSS
procedure SetPacketHandler;
begin
Pointer(Pointer($00514254+6)^):=@PacketHandlerArr;
Byte(Pointer($0050F945+1)^):=Length(PacketHandlerA rr);
end;
Sorry, for my pascal... Was going to rewrite everything to c, but never finished -.-

TheOrder
23.06.2006, 21:36
Just as a response to recent posts...
{00}Pointer($005010F0),//VersionPacket
{01}Pointer($0050A160),//CheckForBot,//MoveToLocation
{02}Pointer($00501350),//SayPacket
{03}UserEnterWorld,//Pointer($00507210),//EnterWorldPacket
{04}Pointer($0050A4D0),//ActionPacket
{05}Pointer($00501070),//DummyPacket
{06}Pointer($00501070),//DummyPacket
{07}Pointer($00501070),//DummyPacket
{08}Pointer($0050E440),//LoginPacket
{09}Pointer($005015E0),//LogoutPacket
{0A}Pointer($005014A0),//AttackPacket
{0B}Pointer($00506C30),//CharacterCreatePacket
{0C}Pointer($00506F40),//CharacterDeletePacket
{0D}Pointer($00506B70),//CharacterSelectPacket
{0E}Pointer($00507000),//NewCharacterPacket
{0F}Pointer($005016D0),//ItemListPacket
{10}Pointer($005072D0),//EquipItemPacket
{11}Pointer($005073E0),//UnequipItemPacket
{12}Pointer($005077B0),//DropItemPacket
{13}Pointer($00501770),//GetItemPacket
{14}Pointer($00507520),//UseItemPacket
{15}Pointer($0050B710),//TradeRequestPacket
{16}Pointer($005019B0),//TradeAddItemsPacket
{17}Pointer($00501A60),//TradeDonePacket
{18}Pointer($00501070),//DummyPacket
{19}Pointer($00501070),//DummyPacket
{1A}Pointer($00507B20),//TeleportPacket
{1B}Pointer($00507BA0),//SocialActionPacket
{1C}Pointer($00507CD0),//ChangeMoveTypePacket
{1D}Pointer($00507DB0),//ChangeStopTypePacket
{1E}Pointer($0050F0A0),//SellPacket
{1F}Pointer($0050E6E0),//BuyPacket
{20}Pointer($00515460),//bbs????
{21}Pointer($00515660),//HTMLcmd
{22}Pointer($00501B50),//WriteHTMLPacket
{23}Pointer($00507EB0),//CreatePledgePacket
{24}Pointer($005102B0),//JoinPledgePacket
{25}Pointer($005105F0),//AnswerJoinPledgePacket
{26}Pointer($00508F60),//WithdrawPledgePacket
{27}Pointer($00509070),//OustPledgeMemberPacket
{28}Pointer($0049AAE0),//DoNothingPacket
{29}Pointer($005107C0),//JoinPartyPacket
{2A}Pointer($00510AB0),//AnswerJoinPartyPacket
{2B}Pointer($005091B0),//WithdrawPartyPacket
{2C}Pointer($005092C0),//OustPartyMemberPacket
{2D}Pointer($00509400),//DismissPartyPacket
{2E}Pointer($00502950),//MagicSkillListPacket
{2F}Pointer($00502A90),//MagicSkillUsePacket
{30}Pointer($00501FA0),//AppearingPacket
{}Pointer($00502490),
{}Pointer($00502660),
{}Pointer($00502060),
{}Pointer($00502140),
{}Pointer($005021D0),
{}Pointer($00502280),
{}Pointer($005023F0),
{}Pointer($00510FF0),
{}Pointer($00501070),//DummyPacket
{}Pointer($0049AAE0),
{}Pointer($0049AAE0),
{}Pointer($005094C0),
{}Pointer($0049AAE0),
{}Pointer($0049AAE0),
{}Pointer($005029F0),
{}Pointer($0049AAE0),
{}Pointer($00502B60),
{}Pointer($00502C80),
{}Pointer($00502DD0),
{}Pointer($00501900),
{}Pointer($005030E0),
{}Pointer($00508030),
{}Pointer($00508160),
{}Pointer($005031C0),
{}Pointer($00508440),
{}Pointer($0050AD50),
{}Pointer($0050AE80),
{}Pointer($005032F0),
{}Pointer($00511940),
{}Pointer($00511C60),
{}Pointer($00511EC0),
{}Pointer($00512140),
{}Pointer($0050CDE0),
{}Pointer($0049AAE0),
{}Pointer($005096B0),
{}Pointer($00503470),
{}Pointer($0050CE70),
{}Pointer($00503470),
{}Pointer($00503480),
{}Pointer($005084D0),
{}Pointer($00503560),
{}Pointer($0050D110),
{}Pointer($00503900),
{}Pointer($005039C0),
{}Pointer($00503B30),
{}Pointer($00512580),
{}Pointer($00512730),
{}Pointer($0050BB50),
{}Pointer($0050A7B0),
{}Pointer($00503C20),
{}Pointer($00503D00),
{}Pointer($00503D80),
{}Pointer($0049AAE0),
{}Pointer($0050BBC0),
{}Pointer($0050D3B0),
{}Pointer($0050BCB0),
{}Pointer($0050D690),
{}Pointer($0050AF90),
{}Pointer($00503EE0),
{}Pointer($0050A840),
{}Pointer($00504130),
{}Pointer($0050D850),
{}Pointer($00504230),
{}Pointer($00508750),
{}Pointer($0050BDE0),
{}Pointer($00504340),
{}Pointer($005046D0),
{}Pointer($005047B0),
{}Pointer($005048A0),
{}Pointer($00504980),
{}Pointer($00504A30),
{}Pointer($00504B00),
{}Pointer($0050BF30),
{}Pointer($0049AAE0),
{}Pointer($00504BC0),
{}Pointer($005151A0),
{}Pointer($00504D90),
{}Pointer($00504E40),
{}Pointer($00508860),
{}Pointer($00504F00),
{}Pointer($0050C360),
{}Pointer($005127C0),
{}Pointer($00512B90),
{}Pointer($00509750),
{}Pointer($0050DBE0),
{}Pointer($00512E60),
{}Pointer($005098C0),
{}Pointer($0050C0B0),
{}Pointer($00504FA0),
{}Pointer($005050F0),
{}Pointer($00505200),
{}Pointer($005053E0),
{}Pointer($0049AAE0),
{}Pointer($00513010),
{}Pointer($00505510),
{}Pointer($00505680),
{}Pointer($00505780),
{}Pointer($00505870),
{}Pointer($00505920),
{}Pointer($005059D0),
{}Pointer($00505AA0),
{}Pointer($0050C1E0),
{}Pointer($00505B60),
{}Pointer($00513410),
{}Pointer($005136F0),
{}Pointer($005139D0),
{}Pointer($00513CA0),
{}Pointer($00513F30),
{}Pointer($00505C90),
{}Pointer($00505D10),
{}Pointer($00509A30),
{}Pointer($0050DE90),
{}Pointer($00505E70),
{}Pointer($00505F00),
{}Pointer($00505FD0),
{}Pointer($00509BB0),
{}Pointer($00509E20),
{}Pointer($00509F80),
{}Pointer($005060A0),
{}Pointer($00506220),
{}Pointer($00508960),
{AA} ReplyLocPacket, //UserCommand
{AB} DummyPacket, //??
{AC} DummyPacket, //OpenReceipeBook
{AD} DummyPacket, //RequestRecipeBookDestroy
{AE} DummyPacket, //RequestRecipeItemMakeInfo
{AF} DummyPacket, //RequestRecipeItemMakeSelf
{B0} DummyPacket, //RequestRecipeShopManageList
{B1} DummyPacket, //RequestRecipeShopMessageSet
{B2} DummyPacket, //RequestRecipeShopListSet
{B3} DummyPacket, //RequestRecipeShopManageQuit
{B4} DummyPacket, //??
{B5} DummyPacket, //??
{B6} DummyPacket, //??
{B7} DummyPacket, //??
{B8} DummyPacket, //ObserverReturn
{B9} DummyPacket, //RequestEvaluate
{BA} RequestHennaEquipList, //RequestHennaEquipList
{BB} RequestHennaItemInfo, //RequestHennaItemInfo
{BC} RequestHennaEquip, //RequestHennaEquip
{BD} RequestHennaUnequipList, //RequestHennaUnequipList
{BE} RequestHennaUnequipInfo, //RequestHennaUnequipInfo
{BF} RequestHennaUnequip, //RequestHennaUnequip
{C0} DummyPacket, //Clan Privileges
{C1} RequestMakeMacro, //RequestMakeMacro
{C2} RequestDeleteMacro, //RequestDeleteMacro
{C3} DummyPacket, //
{C4} DummyPacket, //
{C5} DummyPacket, //
{C6} DummyPacket, //
{C7} DummyPacket, //RequestRecordUpdate
{C8} DummyPacket, //
{C9} DummyPacket, //
{CA} DummyPacket, //
{CB} DummyPacket, //
{CC} DummyPacket, //
{CD} ShowMiniMap, //ShowMiniMap
{CE} DummyPacket, //MSN.. ?
{CF} DummyPacket //autoSS
procedure SetPacketHandler;
begin
Pointer(Pointer($00514254+6)^):=@PacketHandlerArr;
Byte(Pointer($0050F945+1)^):=Length(PacketHandlerA rr);
end;
Sorry, for my pascal... Was going to rewrite everything to c, but never finished -.-


And you sayd you where not active huh :)

tpuNIsher
06.07.2006, 07:09
Livid:
wow dude...

send me ur paypal / WM... i wanna donate for that share...

HongK
10.07.2006, 02:26
Any update on your project mcrabben?

RipperX
10.07.2006, 03:04
Any update on your project mcrabben?

Yeah, we have updates but not "public" updates, sorry.

dknod
10.07.2006, 05:01
Any update on your project mcrabben?

Yeah, we have updates but not "public" updates, sorry.

Thats sad :( Hope that this project wont become payable :(

ramon1
10.07.2006, 07:48
yes i whant to help al littel but

mcrabben7
10.07.2006, 10:01
I'll share the Party functionality fix, since I got some parts of the fix from files out there.

It's all in assembly, since that was the easiest way to do it, considering how I have to keep everything in certain registers and all. I could do it all in C++, but, more effort than it is worth.

const DWORD * TEMPLATE_GET_USER = (DWORD *)0x00517B90;
const DWORD * TEMPLATE_GET_USER2 = (DWORD *)0x0058C8B6;
const DWORD * TEMPLATE_GET_USER3 = (DWORD *)0x00406970;
const DWORD * TEMPLATE_GET_USER4 = (DWORD *)0x0041E4D0;

// Fixes the RequestParty functionality in C4 by converting the
// charName string passed in the packet back into an ObjectID.
//
// Parameters:
// DWORD * pBuffer - address of the packet sent by the client
//
void RequestPartyFix(DWORD * pBuffer)
{
__asm
{
mov ebx, pBuffer
lea esi, [ebx+1]
push esi
call FindUserByCharName
or eax, eax
jz UserNotFound
mov ecx, [eax+18h]
//Start String Loop
push ecx
add ebx, 1 //set ebx to point to the first wchar in the string
xor eax, eax
xor ecx, ecx
StringLoop:
cmp ecx, 16 //if we have searched for 16 characters, give up.
je EndStringLoop //jump so we prevent a buffer overrun attack
mov ax, [ebx] //copy our wchar value
add ebx, 2 //move our pointer to the next wchar in the string
add ecx, 1
cmp ax, 0 //see if this is the null-terminated part of the string
jnz StringLoop //if not, loop and keep searching
EndStringLoop:
pop ecx
//End String Loop
mov eax, [ebx] //copy lootType
mov ebx, pBuffer
mov [ebx+1], ecx //mov objectID to pBuffer+1
mov [ebx+5], eax //mov lootType to pBuffer+5
mov word ptr [ebx+9], 0599h
//mov word ptr [ebx+9], 0 //zero out pBuffer+9
mov word ptr [ebx-2], 0Bh //set packet length to 11 bytes
jmp RequestPartyFixExit
UserNotFound:
xor eax, eax
mov [ebx+1], eax
mov [ebx+5], eax
RequestPartyFixExit:
}
}

// Converts a charName into a character User struct by finding
// a User struct for that charName. ObjectID is inside of it.
//
// Parameters:
// DWORD * charName - address of a wstring name (offset wchar * charName)
//
Naked DWORD * FindUserByCharName(DWORD * charName)
{
__asm
{
PUSH EBP
MOV EBP,ESP
ADD ESP,-4Ch
PUSH EBX
PUSH EDI
PUSH ESI
LEA EAX,DWORD PTR SS:[EBP-4Ch] //our 64 byte buffer
PUSH EAX
PUSH DWORD PTR SS:[EBP+8h] //charName
CALL TEMPLATE_GET_USER
ADD ESP,8h
SUB ESP,124h
MOV ESI,ESP
XOR EBX,EBX
MOV DWORD PTR DS:[ESI+120h],8Bh
MOV DWORD PTR DS:[ESI+11Ch],EBX
MOV WORD PTR DS:[ESI+4h],BX
LEA EDX,DWORD PTR SS:[EBP-4Ch] //our 64 byte buffer
PUSH EDX
CALL TEMPLATE_GET_USER2
ADD ESP,4
MOV ECX,ESI
MOV EDX,EAX
LEA EAX,DWORD PTR SS:[EBP-4Ch] //our 64 byte buffer
PUSH EDX
PUSH EAX
CALL TEMPLATE_GET_USER3
MOV ECX,16922550h
LEA EAX,DWORD PTR SS:[EBP-0Ch] //our 12 byte objectID holder
PUSH EAX
CALL TEMPLATE_GET_USER4
MOV EAX,DWORD PTR SS:[EBP-0Ch] //return our User struct (pUser)
POP ESI
POP EDI
POP EBX
LEAVE
RETN 4
}
}

// Fixes the AskjoinParty packet that is sent to the client.
// Will send the charName instead of the objectID, as well
// as the proper loot type.
Naked void AskJoinPartyPacketFix()
{
__asm
{
mov ecx, [ebp-14h]
mov edx, [esi+0F54h]
lea edx, [edx+0A0h]
push ecx //loot type
push edx //charName
push 4Bh //packet header
push FORMAT_JOINPARTY //format 'cSd'
push eax //pSocket
call CSOCKET_SEND
add esp, 20 //fix our stack pointer
push 510A4Dh
retn
}
}

This has 100% working party invites. It shows the player name inviting you, as well as the correct loot type.

If someone has my code, the RequestPartyFix is called from the correct case (0x29) and will automatically fix the packet. The other fix for the AskJoinPartyPacket should be easy to find if you know how to search for packet functions in the L2Server. If not, there are tools and files out there to help you.



A note to everyone: I still want to help everyone out there with more code, but at the same time, I will not force myself to code for so much time, only to give it all away. I know a lot of people here want to learn, and that is why this thread was started. So you can learn. There are lots of examples in my older versions, as well as code snippets throughout this thread.

The DLL is just barely mature enough to finally be used live, coupled with the correct EXE. It has been running well, which is nice. The couple of us that work on this project hope to keep working on this as we go, and see how it all comes along.

dknod
10.07.2006, 10:19
Thank you for some more dll tricks to learn...

HongK
10.07.2006, 13:58
Any update on your project mcrabben?

Yeah, we have updates but not "public" updates, sorry.

lol I'm not interested in your "private" updates. The last thing I want to do is run a c3-c4 server or any public server for that matter. I'm just interested in the project as a whole and learning how to make it suit my needs. It never ceases to amaze me how everytime I come back to look at PP there are still people who are trying to "guard" their little secrets in the hopes that other people won't figure them out so that THEY can have the latest and greatest l2 server which ultimately gets owned by cloning, duping, sql injection, or any other number of exploits which always rear their ugly heads once new dll's are added or other content-"extending" software.

So I'm glad you have your non-public upates. That's not why I'm here asking unfortunately.

RipperX
10.07.2006, 14:06
Any update on your project mcrabben?

Yeah, we have updates but not "public" updates, sorry.

lol I'm not interested in your "private" updates. The last thing I want to do is run a c3-c4 server or any public server for that matter. I'm just interested in the project as a whole and learning how to make it suit my needs. It never ceases to amaze me how everytime I come back to look at PP there are still people who are trying to "guard" their little secrets in the hopes that other people won't figure them out so that THEY can have the latest and greatest l2 server which ultimately gets owned by cloning, duping, sql injection, or any other number of exploits which always rear their ugly heads once new dll's are added or other content-"extending" software.

So I'm glad you have your non-public upates. That's not why I'm here asking unfortunately.

I'm speaking well, not fighting.. and the "private" update is 'cause we don't want that leechers use our dll. It's a hard work for later someone see this topic and download a C4 Server Full Dll. We're trying to teach some ppl how create a dll. nothing more.

goodbye dude.

serafim
10.07.2006, 15:31
Need Help :) maybe somebody can tell me where a mistake, in dll
push header packet = 0xdf in client got 0xc6, push 0xba got 0xa1.......

HongK
10.07.2006, 18:10
Any update on your project mcrabben?

Yeah, we have updates but not "public" updates, sorry.

lol I'm not interested in your "private" updates. The last thing I want to do is run a c3-c4 server or any public server for that matter. I'm just interested in the project as a whole and learning how to make it suit my needs. It never ceases to amaze me how everytime I come back to look at PP there are still people who are trying to "guard" their little secrets in the hopes that other people won't figure them out so that THEY can have the latest and greatest l2 server which ultimately gets owned by cloning, duping, sql injection, or any other number of exploits which always rear their ugly heads once new dll's are added or other content-"extending" software.

So I'm glad you have your non-public upates. That's not why I'm here asking unfortunately.

I'm speaking well, not fighting.. and the "private" update is 'cause we don't want that leechers use our dll. It's a hard work for later someone see this topic and download a C4 Server Full Dll. We're trying to teach some ppl how create a dll. nothing more.

goodbye dude.

Then be careful before you assume that everyone who views this thread is looking for handouts from you because I'm certainly not. I'm interested in the structure of the dll source code, not whatever code you have already created. I wouldn't want your code anyway, what's the fun in that? Not to mention I'm not interested in c3-c4 either.

When I ask about updates, I'm talking about updates to the supposed "project" you started (well YOU actually had nothing to do with it being started). Plenty of people contributed meaningful knowledge at the beginning of this thread before it apparently went "closed-source" and no one was adding new posts so I was trying to revive any discussions that there were. In fact, you could almost say you were "leeching" information from other people in the beginning when you had no idea what you were doing.

That being said, please don't make anymore argumentative posts. If you have something meaningful to contribute, then by all means please speak up.

mcrabben7
11.07.2006, 09:44
Yea, TestDude and Alien003 were nice to share the pointer information. That was surely a nice hint. But apart from that, all the code has been written from scratch.

Ripper was a bit harsh. He doesn't mean to steer people away. He just started assuming people wanted to leech it. Don't take it personally, I know he didn't mean it that way.

If there were MORE people who actually shared something worthwhile in this thread, then I would share more. All I have seen are a couple attempts at changing clan limits and safe enchant levels. Those are easily hexed in, and don't take more than 5 minutes to code for. That's not going to inspire me to release 18 files and 2500+ lines of source, and 3-4 weeks of work, not to mention hours and hours of debugging and everything. I learned a lot along the way. I shared a foundation so others could possibly learn as well.


About the project itself, apart from all this leecher/sharing talk, it's going pretty well. It grew quiet because I have been working hard on it.

Managed to get Party invites working, as well as the proper party bars and all. Got working AutoSS but it has some lag issues, so I am going to try implementing a threaded queue to pool reload requests and avoid L2Server errors. Maybe i won't have to go that far with it.

Started working on a data system for handling extended User information like CP, Clan Privileges, AutoSS status, Hero, etc.

Some other smaller fixes have been done, like to AVE effects, Heal messages, and some other things.

There is a functional base for RecipeBook as well RecipeShops, though they are not complete without the required ExUser and RecipeBook storage systems.

A lot of work has gone into reorganzing what was 2 files into 18 files, along with header guards and all that comes along with that.

Wrote a Config class, just have to implement a config file later once I get there.

It's NOT a small project. It's a big project, with a lot of work, and a lot of knowledge required. That's probably why it's hard for a lot of 'new' programmers to look at something like this and understand how to do it. But, I was new to this before. But after a couple weeks in the l2Server community, I managed to learn. learned all about hexing the L2Server, using debuggers like Olly, and using tools like IDA Pro. In the end, I have come out with a lot of useful knowledge. It's just taken a long time, patience, and diligence.

mcrabben7
11.07.2006, 09:46
Need Help :) maybe somebody can tell me where a mistake, in dll
push header packet = 0xdf in client got 0xc6, push 0xba got 0xa1.......

That's because there is a packet header table in the L2Server that was changed in the PP exe. It changes the C1 packet headers into C3 packet headers for you.

To get around it you can call CSocket::SendV, or you can change the packet table...or you can push the C1 packet header and it will send the correct C3 header.

Good luck, glad at least one person is trying to do something on their own.

mcrabben7
11.07.2006, 10:05
Ok, triple post, my apologies...

Here is a picture of me working in Visual Studio recently. Shows me working on the ExUser struct, and shows the project files layout.

http://img84.imageshack.us/img84/8420/l2epworking27iv.th.jpg (http://img84.imageshack.us/my.php?image=l2epworking27iv.jpg)

I made some changes to that today, but, it's still fairly recent screenshot. As you can probably tell, it's NOT easy to do all this.

Domzelan
11.07.2006, 10:41
mcrabben7 great work :)

sparcode
11.07.2006, 12:18
If this project will help for private l2 servers scene, respect to mcrabben.
Catch the cash, mcrabben :)

HongK
11.07.2006, 15:53
Yea, TestDude and Alien003 were nice to share the pointer information. That was surely a nice hint. But apart from that, all the code has been written from scratch.

Ripper was a bit harsh. He doesn't mean to steer people away. He just started assuming people wanted to leech it. Don't take it personally, I know he didn't mean it that way.

If there were MORE people who actually shared something worthwhile in this thread, then I would share more. All I have seen are a couple attempts at changing clan limits and safe enchant levels. Those are easily hexed in, and don't take more than 5 minutes to code for. That's not going to inspire me to release 18 files and 2500+ lines of source, and 3-4 weeks of work, not to mention hours and hours of debugging and everything. I learned a lot along the way. I shared a foundation so others could possibly learn as well.


About the project itself, apart from all this leecher/sharing talk, it's going pretty well. It grew quiet because I have been working hard on it.

Managed to get Party invites working, as well as the proper party bars and all. Got working AutoSS but it has some lag issues, so I am going to try implementing a threaded queue to pool reload requests and avoid L2Server errors. Maybe i won't have to go that far with it.

Started working on a data system for handling extended User information like CP, Clan Privileges, AutoSS status, Hero, etc.

Some other smaller fixes have been done, like to AVE effects, Heal messages, and some other things.

There is a functional base for RecipeBook as well RecipeShops, though they are not complete without the required ExUser and RecipeBook storage systems.

A lot of work has gone into reorganzing what was 2 files into 18 files, along with header guards and all that comes along with that.

Wrote a Config class, just have to implement a config file later once I get there.

It's NOT a small project. It's a big project, with a lot of work, and a lot of knowledge required. That's probably why it's hard for a lot of 'new' programmers to look at something like this and understand how to do it. But, I was new to this before. But after a couple weeks in the l2Server community, I managed to learn. learned all about hexing the L2Server, using debuggers like Olly, and using tools like IDA Pro. In the end, I have come out with a lot of useful knowledge. It's just taken a long time, patience, and diligence.

Thank you for an informative post. That's exactly the kind of response I was looking for.

I've just started messing with your dll skeleton and I'm thinking I want to attempt to try hijacking the calls to NPCINFO, USERINFO, and CHARINFO and redoing them completely with the dll rather than hexing them in to l2server.

Have you managed to do this already yourself. Is it a viable option or alternative to manually hexing them in to L2Server?

mcrabben7
11.07.2006, 16:29
Yep, those are possible. Currently working on converting some hex fixes I added before into DLL hooks, so I can start injecting CharInfo and UserInfo with my own information.

You can do it almost the same way you hex, just make the jump go to the DLL instead.

Here is an example of how I hooked the AskJoinParty packet function. The code for my rewritten code is back a few posts.

//AskJoinParty Packet Fix (Yea, related to party, but this is more of a server packet fix)
BYTE * HookAskJoinPartyPacketAddr = (BYTE *)0x00510A35;
*HookAskJoinPartyPacketAddr = (BYTE)0xE9;
DWORD * HookAskJoinPartyPacketAddr2 = (DWORD *)0x00510A36;
*HookAskJoinPartyPacketAddr2 = (DWORD)AskJoinPartyPacketFix;
#ifdef __DEBUG__
file << "Wrote L2Server." << std::hex << HookAskJoinPartyPacketAddr2 << " with AskJoinParty Packet Fix. New jump address: " << std::hex << *HookAskJoinPartyPacketAddr2 << ".\n";
file.flush();
#endif
*HookAskJoinPartyPacketAddr2 -= (0x00510A35+5); //rebase our jmp address
HookAskJoinPartyPacketAddr += 5;
*HookAskJoinPartyPacketAddr = (BYTE)0x90;

mcrabben7
15.07.2006, 00:40
http://img140.imageshack.us/img140/9641/makingprogress2lr.th.jpg (http://img140.imageshack.us/my.php?image=makingprogress2lr.jpg)

Hero Glow and Hero Icon are enabled in the ExUser struct I was talking about before. Once I make the proper UseItem packet hook, I can set hero when you equip the hero item for your hair slot.

Just showing off some progress. CP regenerates automatically. Still not done with CP damage yet, but, getting there. Damage registers, but, not finding the proper damage variable just yet ;)

Recommend is fully coded, just no SQL backend yet. Retail Recommend, too, none of that 3 color shit.

Some of the other small things are new login messages, and some bug fixes from C1.

Anyways, back to coding ^^

tpuNIsher
15.07.2006, 03:39
Great work =p
Keep it going ^^

hel
15.07.2006, 15:32
Look's nice... :)
Wish you good luck in coding. ;)
(very bad, we will never see this dll in use :()

RipperX
15.07.2006, 16:19
HowTo Hook (Comments / Code)

BYTE * HookFunction = (BYTE *) 0x00Address; //Address is the Address where is the function.
*HookFunction = (BYTE) 0xE9;
DWORD * HookFunctionAddr = (DWORD *)0x00(Address+1);
*HookFunctionAddr = (DWORD)Function;
*HookFunctionAddr -= (0x00Address+5); //rebase our jmp

Example:

BYTE * HookTimerExpired = (BYTE *)0x004FAD40;
*HookTimerExpired = (BYTE) 0xE9;
DWORD * HookTimerExpiredAddr = (DWORD *) 0x004FAD41;
*HookTimerExpiredAddr = (DWORD)HookTimer;
*HookTimerExpiredAddr -= (0x004FAD40+5);

Asm code was

4FAD40: 55 push ebp
4FAD41: 8BEC mov ebp,esp
4FAD43: 6AFF push 0FF
4FAD45: blabla(return)
------------------> 55 & 8B & EC & 6A & FF (5 bytes) For this is "+5" in rebase

then

Asm code will be

E9NewFunctionAddr (5 bytes)

so inside our new function we need rewrite the latest code 'cause our function replaced it.

then will look something like this

Naked void HookTimer() {

__asm
{
push ebp
mov ebp,esp
push 0FFFFFFFFh
}
//our code..

__asm
{
push 4FAD45h //retn addr
retn
}

}

I hope that this be helpfull.

Met45
15.07.2006, 16:46
nice hooking tutorial ripper, keep up the good work! :wink:

Aikeleer
15.07.2006, 17:33
Thanks :) I guess I'll focus on learning C++ aswell. Pretty awesome to see you guys did so much in only a few weeks of hard work. :)

RipperX
15.07.2006, 17:49
If someone needs help add me to messenger but I must say that
I don't give code
I don't sell it
I don't sell dll compiled
I don't sell anything.
I will only help to the person who wants learn :)

mcrabben7
15.07.2006, 18:31
Here is my recently written RequestEvaluate() function. This one is better than any other that have been shared before. I do give props to Torune for sharing a decent one to start with a while ago, but I couldn't use a lot of his so I wrote the entire thing in my style anyways ;) Plus I added lots of stuff he was missing, like the client messages for giving and receiving recommendations, etc.

GetParameter() grabs the value of something at an address.
GetAddress() just gets an address (a pointer).
Here are their prototypes:

// Returns a value from an address + a given offset
//
// Parameters:
// DWORD * pData - the address of the data to use
// DWORD byteOffset - how many bytes to offset the address
//
DWORD GetParameter(DWORD * pData, DWORD byteOffset);
// Returns a pointer to an address + a given offset
//
// Parameters:
// DWORD * pAddress - the address of the data to use
// DWORD byteOffset - how many bytes to offset the address
//
DWORD * GetAddress(DWORD * pAddress, DWORD byteOffset);

GetUser() and GetUserData() get a pointer directly to the start of the CUser struct, and also to the CSharedData struct. One is for users, and one is shared by ALL NPCs in the L2Server.

The parameters like AI_LEVEL and USER_SOCKET are const byte offsets (just numbers) that make it easier to grab variables without always looking at a variable offset chart, and makes the code easier to understand.

Sure, it's possible to make a CUser and CSharedData struct yourself and typecast the ones in the L2Server to yours, but yours will be so incomplete, I found making a struct with 50 unknown variables was pointless, ugly, and bad coding style. Also, why copy an ENTIRE L2Server struct when you only need 1 value? Waste..of...cpu..time :)

Here is the function I originally said I would share:

void RequestEvaluate(DWORD * pSocket, DWORD targetID)
{
if(pSocket != NULL)
{
DWORD * pUser = GetUser(pSocket);
if(pUser != NULL)
{
ExUser * tempExUser = GetExUser(pUser);
DWORD * pUserData = GetUserData(pUser);
DWORD objectID = GetParameter(pUser, OBJECT_ID);
DWORD * pTargetUser = CCreature::GetCreature(targetID);

if( GetParameter(pUserData, AI_LEVEL) < 10 )
{
CSocket::Send(pSocket, FORMAT_SYS_MSG, 0x64, 898, 0); //YOU_ARE_NOT_LEVEL_10
}
else if(tempExUser->EvalLeft == 0)
{
CSocket::Send(pSocket, FORMAT_SYS_MSG, 0x64, 833, 0); //YOU_HAVE_NO_RECOMMENDS_LEFT
}
else if(targetID == objectID)
{
CSocket::Send(pSocket, FORMAT_SYS_MSG, 0x64, 829, 0); //YOU_CANT_RECOMMEND_YOURSELF
}
else if(pTargetUser == NULL)
{
CSocket::Send(pSocket, FORMAT_SYS_MSG, 0x64, 144, 0); //TARGET_IS_INCORRECT
}
else
{
DWORD * pTargetSocket = (DWORD *)GetParameter(pTargetUser, USER_SOCKET);
ExUser * targetExUser = GetExUser(pTargetUser);

if(targetExUser->EvalScore == 255)
{
//YOU_CAN_NO_LONGER_RECEIVE_RECOMMENDATIONS
CSocket::Send(pSocket, FORMAT_SYS_MSG, 0x64, 1188, 0);
}
else
{
WCHAR * charName = (WCHAR *)GetAddress(pUserData, AI_NAME);
WCHAR * targetName = (WCHAR *)GetAddress( GetUserData(pTargetUser), AI_NAME);

tempExUser->EvalLeft--;
//YOU_HAVE_RECOMMENDED_S1_AND_HAVE_S2_RECOMMENDS_LEF T
CSocket::Send(pSocket, FORMAT_RECOMMEND2, 0x64, 830, 2, 0, targetName, 1, tempExUser->EvalLeft);
targetExUser->EvalScore++;
//YOU_HAVE_BEEN_RECOMMENDED_BY_S1
CSocket::Send(pTargetSocket, FORMAT_RECOMMEND, 0x64, 831, 1, 0, charName);

//Send new UserInfo to both players so their stats update
SendUserInfo(pUser, 0);
SendCharInfo(pTargetUser, 0);

//TODO: SQL saving
}
}
}
}
}

This sends all messages the client would expect, as well as properly updates your EvalScore and Eval left in the client. That's why UserInfo and CharInfo are sent right after this update, otherwise you would recommend and it would look like nothing happened.

If you use this, please give me credit :) Good luck coders of PP :P

HongK
15.07.2006, 19:54
That's a good post Ripper .. That's what I'm talkin about :P

Thanks to you too Mcrabben for providing more information ...

[DeV/NuLL]
16.07.2006, 00:50
Nice project, and nice Hook for RequestValue, I can show some interesting functions like GetUserData, I'm working on User Data at this moment.

My 2 cents.

I dont test it yet but I think is ok

C4 Warehouse Fix


void SetHookWarehouse();
void HookWarehouse();

void SetHookWarehouse()
{
DWORD *HookWarehouseAddr = (DWORD *)0x004567BB;
*HookWarehouseAddr = (DWORD)HookWarehouse;
#ifdef __DEBUG__
file << "Inyectando " << hex << HookWarehouseAddr << " con gancho a la funcion HookWarehouse. Nueva direccion: " << hex << *HookWarehouseAddr << ".\n";
file.flush();
#endif
*HookWarehouseAddr -= (0x004567BA+2);
}

void HookWarehouse()
{
const char *format = "chdhb";
const char *format2 = "cdd";
DWORD *sub_4567D0 = (DWORD *)0x004567D0;
DWORD *sub_4DFC70 = (DWORD *)0x004DFC70;
DWORD *sub_51EE1F = (DWORD *)0x0051EE1F;
DWORD *sub_474F05 = (DWORD *)0x00474F05;
__asm
{
push 1
push 54h
push format
mov edx, [ebp-58h]
push edx
call sub_4DFC70
mov ecx, [ebp-2Ch]
mov eax, [ecx]
add esp, 20h
mov edx, sub_4567D0
jmp edx
}
__asm
{
push 1
push 53h
push format2
call sub_4DFC70
mov ecx, [ebp-24h]
add esp, 20h
jmp sub_51EE1F
}
__asm
{
mov eax, sub_4DFC70
mov esi, [eax+19B8h]
mov edx, [ebp-14h]
mov ecx, [edx+14Ch]
push ecx
mov eax, [edx+18h]
push eax
push 60h
push format2
push esi
call sub_4DFC70
add esp, 14h
push sub_474F05
retn
}
}


Can I add you to my MSN Mc?

mcrabben7
16.07.2006, 03:44
I currently use Hex fixes for Warehouses, Skill Learning, Private Stores, Etc. if it works already, I don't want to spend time redoing it just yet ;)

Yea, you can add me to MSN.

HongK
18.07.2006, 01:47
Hey mcrabben is there anyway you could give me a glimpse into your code for handling npcinfo, charinfo, or userinfo? I just need a little bump to get some progress on it ... I'm trying to make it work for C2, so I realize yours will be slightly different, but any help would be awesome! Thanks..

deathz0r
18.07.2006, 13:27
hey... nice thread here, I just wanted to thank everyone involved in this proyect I've started to learn something about how to hook the l2server and I'm currently documenting myself on C++ RipperX I added you to my msn if you don't mind.

back when there was no fuss about c4 retail server files and everything I believed that hooking the exec was a very good way to keep l2off alive, and I still think so.

RipperX
18.07.2006, 14:00
hey... nice thread here, I just wanted to thank everyone involved in this proyect I've started to learn something about how to hook the l2server and I'm currently documenting myself on C++ RipperX I added you to my msn if you don't mind.

back when there was no fuss about c4 retail server files and everything I believed that hooking the exec was a very good way to keep l2off alive, and I still think so.

Did you added me ? coz I don't see the Agree window.

mcrabben7
18.07.2006, 20:01
Hey mcrabben is there anyway you could give me a glimpse into your code for handling npcinfo, charinfo, or userinfo? I just need a little bump to get some progress on it ... I'm trying to make it work for C2, so I realize yours will be slightly different, but any help would be awesome! Thanks..

Our DLL only hooks the C3/C4 parameters right now, plus abnormals. But somewhere around 4FECEC is UserInfo's packet send. NpcInfo is around that function, it's inside a different if statement for the UserInfo send packet.

CharInfo is...hmm...where was it. 4FF3A5 and 4FF93F should be both of them. Hope that helps.

MelkorTheStrong
18.07.2006, 20:24
hey mcrabben, i'm not sure on this, but don't ppl on retail have the castle door HP bar working so ppl can view it like mobs? beats me, i've never seen it working on any private server, i'm so used to it not being there :p

mcrabben7
18.07.2006, 21:42
hey mcrabben, i'm not sure on this, but don't ppl on retail have the castle door HP bar working so ppl can view it like mobs? beats me, i've never seen it working on any private server, i'm so used to it not being there :p
I noticed it doesn't work. It's probably been broken since C2 or something. There is a packet called DoorStatusUpdate and I think HP is sent in there. I will take a look at that, later, and see how the C1 packet compares to the L2J packet.

Thanks for reminding me.

TheOrder
18.07.2006, 22:11
GJ mcrabben7 , i love 1 thing at u you continue your work even if people don't have faith in C1 any more !!! Tnx for everything you great !!!

mcrabben7
19.07.2006, 01:06
GJ mcrabben7 , i love 1 thing at u you continue your work even if people don't have faith in C1 any more !!! Tnx for everything you great !!!

Thanks. I still don't believe we'll have the entire retail C4 server fall into PP any time soon.

I also am learning a lot about many programming things, and teaching myself a lot of new programming skills. So, it's not like I am wasting time. I do enjoy doing this, tbh.

Digital
20.07.2006, 00:50
i agree...
even if retail c4 server is available...
i'd still find the importance of dll is still needed...
retail c4 server is NOT perfect.... there's more then u could imagine that require fixing and improving...
[Knowledge = Power]

HF
20.07.2006, 01:35
GJ mcrabben7 , i love 1 thing at u you continue your work even if people don't have faith in C1 any more !!! Tnx for everything you great !!!

Thanks. I still don't believe we'll have the entire retail C4 server fall into PP any time soon.

I also am learning a lot about many programming things, and teaching myself a lot of new programming skills. So, it's not like I am wasting time. I do enjoy doing this, tbh.
i agree...
even if retail c4 server is available...
i'd still find the importance of dll is still needed...
retail c4 server is NOT perfect.... there's more then u could imagine that require fixing and improving...
[Knowledge = Power]

Yes. Sounds well and I shall agree with it. Much that is made here, has assisted me to make for other work. But...
To invent a bicycle is not the best way of development. And even small envy to such big server - too not the best feeling for calm in с1 a server. ;)

mcrabben7
20.07.2006, 21:37
GJ mcrabben7 , i love 1 thing at u you continue your work even if people don't have faith in C1 any more !!! Tnx for everything you great !!!

Thanks. I still don't believe we'll have the entire retail C4 server fall into PP any time soon.

I also am learning a lot about many programming things, and teaching myself a lot of new programming skills. So, it's not like I am wasting time. I do enjoy doing this, tbh.
i agree...
even if retail c4 server is available...
i'd still find the importance of dll is still needed...
retail c4 server is NOT perfect.... there's more then u could imagine that require fixing and improving...
[Knowledge = Power]

Yes. Sounds well and I shall agree with it. Much that is made here, has assisted me to make for other work. But...
To invent a bicycle is not the best way of development. And even small envy to such big server - too not the best feeling for calm in с1 a server. ;)

I considered making it a completely Open SOurce project, using the Open GPL license and everything. But I'm just not sure that the community here would be able to support such a project. I'm just afraid it'd turn into one giant leech affair where people take the code and use it, and never give anything back. I also see custom L2J servers out there, but I don't think they share their code back with the main l2J branch. Those kinds of things worried me.

But you're right. Reinventing the bicycle sucks. I am still playing catchup with Linex and l2Extend because I am missing a few features they have. I "almost" have Linex functionality replaced, but not quite there yet. Missing some things still.

So, like I said, you are right. If I had source to start out with that was something like zzcat's level, this would of gone faster. But such is life.

[DeV/NuLL]
20.07.2006, 21:48
Well, you always can start a project on sourceforge for example and get some coders for the project who are really interested on learn and write code for your project.

HongK
20.07.2006, 23:07
GJ mcrabben7 , i love 1 thing at u you continue your work even if people don't have faith in C1 any more !!! Tnx for everything you great !!!

Thanks. I still don't believe we'll have the entire retail C4 server fall into PP any time soon.

I also am learning a lot about many programming things, and teaching myself a lot of new programming skills. So, it's not like I am wasting time. I do enjoy doing this, tbh.
i agree...
even if retail c4 server is available...
i'd still find the importance of dll is still needed...
retail c4 server is NOT perfect.... there's more then u could imagine that require fixing and improving...
[Knowledge = Power]

Yes. Sounds well and I shall agree with it. Much that is made here, has assisted me to make for other work. But...
To invent a bicycle is not the best way of development. And even small envy to such big server - too not the best feeling for calm in с1 a server. ;)

I considered making it a completely Open SOurce project, using the Open GPL license and everything. But I'm just not sure that the community here would be able to support such a project. I'm just afraid it'd turn into one giant leech affair where people take the code and use it, and never give anything back. I also see custom L2J servers out there, but I don't think they share their code back with the main l2J branch. Those kinds of things worried me.

But you're right. Reinventing the bicycle sucks. I am still playing catchup with Linex and l2Extend because I am missing a few features they have. I "almost" have Linex functionality replaced, but not quite there yet. Missing some things still.

So, like I said, you are right. If I had source to start out with that was something like zzcat's level, this would of gone faster. But such is life.

Hehe yea I worked on L2J as a developer for a while and it sucked when zabbix ran off with roberto to start their own branch and close it off even though they should technically get their asses sued for it ...

Enforcement is an impossible thing and if people branch off they will do it .. This was one of the hardest things the devs talked about .. I always suggested closed source, but ultimately the way you beat other developers is by having better code and more functionality .. It's actually a good thing because it fosters competition and competition in turn produces better products because if you don't compete you lose out .. Besides, atm if someone really wanted to they could just take the basic skeleton you have provided and start their own project just like you said .. They would just do it from scratch...You can't worry about people taking your open source code because if someone wants to be like that, they will .. But look at how far l2j came from the beginning .. I can guarantee you there are more things coded in there that would have NEVER been done if not for outside community support ... I used to not believe in open source, but I have seen the positive things that can happen .. Just look at Linux lol

If you don't have the resources to do all the coding yourself, it might help to let other people take a stab at it and see what happens .. I can tell you that there are shitloads of people that didn't know crap about java before they found L2J and now they are learning and becoming much better at it ...

I for one am interested in C++ .. I always have been, but have never had the time to really sit down and study it properly .. But since I started working with Ollydbg and learning how instructions map to memory addresses, it opened up a whole new world with pointers to me .. I remember two years ago reading about pointers and saying WHOA wth I don't understand any of this .. But looking at coding examples in your DLL and reading a chapter or two on pointers has completely changed my perspective ... So even if you don't open the project up to the public, I still gotta thank you for opening my eyes to hooking and helping me understand pointers :P

cheers

RipperX
20.07.2006, 23:11
I don't think that Elhaym project will be open but as I said I can help you to learn. Just if is usefull for you.

gb

HongK
05.12.2006, 17:30
Quick question..

I was reading through this thread looking for an answer to my question about getting user values like STR, INT, WIT etc and in comparing the offsets in the l2extension project I'm trying to figure out where you got those values from. For example, in the User struct in l2extension you have AI_X_LOC = 0x08, AI_Y_LOC = 0x10, AI_Z_LOC = 0x18 and on and on. But when I debug userinfo in l2server, the offsets are different numbers. For example at the beginning of the userinfo packet the offsets are EBP-xxx value ... EBP-210 = CharName, EBP-44 = race, EBP-50 = class .. But in the user struct in l2extension the offset for AI_NAME = 0xA0, not 0x210

Sooooo my question is, is my understanding wrong of the offset values? I just figured the offset values in the User struct in l2extension were just the offsets of EBP from data out of userinfo...

mcrabben7
05.12.2006, 18:27
UserInfo stores values on the local stack. The original values were copied there from User->CSharedData. My code is right. Trust me.

I already have all the offsets for STR, INT, WIT, DEX, etc. in my code. One or two might be mixed up but they're all there.

It's always User + offset -> CSharedData + offset -> some variable.

I have all the C4 offsets stuck in my head so I can't tell you what the offsets are anymore. See my code :P

humordwarf
05.12.2006, 18:38
lol
c++ rulez
maybe someone will start up some public C4 DLL %)
this is small bugfix around striders/wywern without corralllls %)


bool CP_6A_Ride(CUserSocket *pUserSocket, char *pPacket)
{
return true; //kick
}

HongK
05.12.2006, 18:40
UserInfo stores values on the local stack. The original values were copied there from User->CSharedData. My code is right. Trust me.

I already have all the offsets for STR, INT, WIT, DEX, etc. in my code. One or two might be mixed up but they're all there.

It's always User + offset -> CSharedData + offset -> some variable.

I have all the C4 offsets stuck in my head so I can't tell you what the offsets are anymore. See my code :P

Yes I know they are right .. That's not my question .. I wanted to get more information than is available currently .. So I was wondering how you got those offsets

So like you have User + offset -> CSharedData .. ok good so CSharedData + (offset) -> the variable

Where are you finding (offset)

oh that and what are INFECTED_SKILLS?

humordwarf
05.12.2006, 18:51
Where are you finding (offset)


some of offsets u can get from AI.OBJ there after //names of variables.. so before - offsets %)

HongK
05.12.2006, 19:03
some of offsets u can get from AI.OBJ there after //names of variables.. so before - offsets %)

Ahhhhh sweet .. thanks HD :P

One last question to Mcrabben, what is your implementation method for the C5 skills you are adding? For example I want to write skill handlers for some new C2 skills so I'm trying to figure out the best way to do it. Any suggestions?

mcrabben7
05.12.2006, 19:34
I used a disassembler, of course. You will never get anything done without a good disassembler at your side. How did I find the offsets? L2server assembly. Once you know how to recognize a User *, CSharedData *, etc., things fall into place.

Not really any time for me to teach you right now, but learn to disassemble. HD is right about the AI offsets, because L2Server and L2NPC use Shared Memory IPC (Inter-Process Communication) all the offsets must be the same. I'm sure there are offsets in there I never cared to look up that may be of use to you.

P.S. Skill handlers are a pain in the ass. Alien003 was the master of skill handlers, compared to myself. I've had little experience with changing them, though I have my ideas.

HongK
05.12.2006, 20:17
One last question:

What are INFECTED_SKILLS? If those aren't skills that are currently applied to you, was there a way that you know of to check the skills that are currently applied on a character like guidance, focus, etc?

mcrabben7
05.12.2006, 22:17
One last question:

What are INFECTED_SKILLS? If those aren't skills that are currently applied to you, was there a way that you know of to check the skills that are currently applied on a character like guidance, focus, etc?

Type the gm command //infected_skills sometime ;)

INFECTED_SKILLS is where I think the infected skills buffer/array was. I never did use it. I know in C4 there is a function called bool CCreature::HasSkill(skill_id) but I haven't used it quite yet. It probably exists in C1 as well.

Add me to MSN HongK. It's in my profile. We can do more productive chatting there than forum camping :P

P.S. I might share some new code snippets of some improved code later. Just simple general purpose stuff I use in my own code.

HongK
06.12.2006, 00:03
agreed .. was gonna ask you for your msn