Post Pacific  

Go Back   Post Pacific > Восстановленный архив > Темы без сохранившегося раздела
FAQ Community Calendar Today's Posts Search

Notices

 
 
Thread Tools Search this Thread Display Modes
Old 16.06.2006, 10:44   #1
mcrabben7
Архивный участник
 
Join Date: Apr 2006
Posts: 461
Default [Work In progress] Humble Beginnings of an L2Server C++ DLL

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 [[email protected]]"
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:
Code:
//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
}
Code:
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:
Code:
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 байт
mcrabben7 is offline  
Old 16.06.2006, 11:23   #2
mantrastic
Архивный участник
 
Join Date: Apr 2006
Posts: 338
Default

lovely work mate, keep it up!
mantrastic is offline  
Old 16.06.2006, 11:37   #3
Bruenor
Архивный участник
 
Join Date: Jun 2006
Posts: 14
Default

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
Code:
if( !WriteProcessMemory(dwHandle, (LPVOID)(0x0050F8F4+1), &HookReceivePacket, sizeof(&HookReceivePacket), &temp) )
with
Code:
if( !WriteProcessMemory(dwHandle, (LPVOID)(0x0050F8F4+1), &HookReceivePacket - (0x0050F8F4+5), sizeof(&HookReceivePacket), &temp) )
it should work.
Bruenor is offline  
Old 16.06.2006, 11:45   #4
Postal
Архивный участник
 
Join Date: May 2006
Posts: 23
Default

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.
Postal is offline  
Old 16.06.2006, 12:07   #5
mcrabben7
Архивный участник
 
Join Date: Apr 2006
Posts: 461
Default

Quote:
Originally Posted by Bruenor
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
Code:
if( !WriteProcessMemory(dwHandle, (LPVOID)(0x0050F8F4+1), &HookReceivePacket, sizeof(&HookReceivePacket), &temp) )
with
Code:
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 is offline  
Old 16.06.2006, 13:32   #6
mcrabben7
Архивный участник
 
Join Date: Apr 2006
Posts: 461
Default

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

Code:
//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:
Code:
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.
mcrabben7 is offline  
Old 16.06.2006, 13:39   #7
HongK
Архивный участник
 
Join Date: Jun 2005
Posts: 258
Default

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
HongK is offline  
Old 16.06.2006, 14:47   #8
mcrabben7
Архивный участник
 
Join Date: Apr 2006
Posts: 461
Default

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.
mcrabben7 is offline  
Old 16.06.2006, 15:07   #9
testdude
Архивный участник
 
Join Date: Nov 2005
Posts: 504
Default

nice... btw a little snippet for those who dont want/like to use asm to call functions in l2server
Code:
#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
testdude is offline  
Old 17.06.2006, 19:45   #10
mcrabben7
Архивный участник
 
Join Date: Apr 2006
Posts: 461
Default

Some progress:

Code:
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:
Code:
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:
Code:
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.

Code:
// 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...
mcrabben7 is offline  
Old 17.06.2006, 20:28   #11
demon
Архивный участник
 
Join Date: May 2005
Posts: 367
Default

mm can u name your project something else except l2extend its taken

we might get confused

thanks for understanding
demon is offline  
Old 17.06.2006, 20:43   #12
mcrabben7
Архивный участник
 
Join Date: Apr 2006
Posts: 461
Default

Quote:
Originally Posted by demon
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?
mcrabben7 is offline  
Old 18.06.2006, 08:40   #13
RipperX
Архивный участник
 
Join Date: Dec 2005
Posts: 242
Default

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!
RipperX is offline  
Old 18.06.2006, 11:24   #14
mcrabben7
Архивный участник
 
Join Date: Apr 2006
Posts: 461
Default

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.
mcrabben7 is offline  
Old 18.06.2006, 15:09   #15
draft
Архивный участник
 
Join Date: May 2006
Posts: 36
Default

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.
draft is offline  
Old 18.06.2006, 15:15   #16
max_rain
Архивный участник
 
Join Date: Apr 2006
Posts: 42
Default

__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
max_rain is offline  
Old 18.06.2006, 15:36   #17
mcrabben7
Архивный участник
 
Join Date: Apr 2006
Posts: 461
Default

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

Code:
// 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.
mcrabben7 is offline  
Old 18.06.2006, 18:04   #18
Enishi
Архивный участник
 
Join Date: Apr 2005
Posts: 354
Default

Awesome man...now I can use a working example to start learning this stuff. :P
Enishi is offline  
Old 18.06.2006, 19:52   #19
Aikeleer
Архивный участник
 
Join Date: Jun 2005
Posts: 374
Default

Yeah great work
Aikeleer is offline  
Old 18.06.2006, 20:50   #20
mcrabben7
Архивный участник
 
Join Date: Apr 2006
Posts: 461
Default

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 байт
mcrabben7 is offline  
Old 18.06.2006, 21:59   #21
hel
Архивный участник
 
Join Date: Apr 2006
Posts: 729
Default

mcrabben7:
I know C++ a bit and maybe I'll help to your devteam in future, when I understand a code.
Thanks.
hel is offline  
Old 18.06.2006, 22:03   #22
Bacek
Архивный участник
 
Join Date: Apr 2006
Posts: 110
Default

Wow, nice, I will help in this topic soon! Thanks for share!
Bacek is offline  
Old 18.06.2006, 22:22   #23
max_rain
Архивный участник
 
Join Date: Apr 2006
Posts: 42
Default

Code:
        //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....
max_rain is offline  
Old 18.06.2006, 22:41   #24
mcrabben7
Архивный участник
 
Join Date: Apr 2006
Posts: 461
Default

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 is offline  
Old 18.06.2006, 22:44   #25
mcrabben7
Архивный участник
 
Join Date: Apr 2006
Posts: 461
Default

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.
mcrabben7 is offline  
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 19:58.