View Single Post
Old 06.06.2006, 16:40   #1
torune
Архивный участник
 
Join Date: Jul 2005
Posts: 371
Default [share]void SendMacroList()

this only gives you single macro, but at least you have something eh

its a part of code from my old l2ext.dll(junk project which was started around half years ago and it ends because somebody hacked into my server, stole all my script/geodata and ofcoz server files, lol).

messy crappy code :P

how it works?

client sends add/edit macro list, it just dummy reply with same data.

not really easy to understand what i wrote, but can be a good start if you wanna get your own dll.
Code:
void SendMacroList(){	
	__asm pushad;
	string _sfFormat;
	BYTE *pData;
	wchar_t *pName;
	wchar_t *pDesc;
	wchar_t *pAcronym;
	LPBYTE dwIcon;
	LPBYTE dwLength;
	int count;
	int i;
	int stackCount = 52;
	DWORD pUser;
	__asm{
		LEA EDX,DWORD PTR DS:[EBX+ESI+0X11];
		mov pData,EDx;
		mov pUser,EDI;
	}
	pData +=4;
	pName = (wchar_t*)pData;
	pData += (wcslen(pName)*2 + 2);
	pDesc = (wchar_t*)pData;
	pData += (wcslen(pDesc)*2 + 2);
	pAcronym = (wchar_t*)pData;
	pData += (wcslen(pAcronym)*2 + 2);
	dwIcon = pData;
	pData ++;
	dwLength = pData;
	pData ++;
	count = *dwLength;
	_sfFormat += _sfMacroString_a;
	_sfFormat += _sfMacroString_b;
	for (i=0; i < count; i++) {
		_sfFormat += _sfMacroString_c;
	}
	for (i=1; i <= count; i++) {
		LPBYTE pEntry;
		LPBYTE pType;
		LPDWORD pD1;
		LPBYTE pD2;
		wchar_t *pCommand;
		stackCount +=20;
		pEntry = pData;
		pData++;
		pType = pData;
		pData++;
		pD1 = (LPDWORD)pData;
		pData+=4;
		pD2 = pData;
		pData++;
		pCommand = (wchar_t*)pData;
		pData += (wcslen(pCommand)*2 + 2);
		__asm{
			mov eax, pCommand
			push eax; //s

			mov eax, pD2
			push DWORD PTR[eax]; //c

			mov eax, pD1
			push DWORD PTR[eax]; //d

			mov eax, pType
			push DWORD PTR[eax]; //c

			push DWORD PTR[i]; //c
		}		
	}
	__asm{
		mov eax, dwLength
		push DWORD PTR[eax]; //c
		mov eax, dwIcon
		push DWORD PTR[eax]; //c
		mov eax, pAcronym
		push eax; //s
		mov eax, pDesc
		push eax; //s
		mov eax, pName
		PUSH eax; //s
		PUSH 0; //D
		push 1; //C
		push 1; //C
		push 0; //C
		push 1;	//D
		PUSH 0x110;
		mov eax, dword ptr[ebp-0x50]//_sfFormat;
		push eax;
		push pUser;
		CALL _fnSendToSinglePlayer;
		ADD ESP,stackCount;
		__asm popad;
	}
}
torune is offline