Post Pacific  

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

Notices

 
 
Thread Tools Search this Thread Display Modes
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  
Old 06.06.2006, 17:48   #2
torune
Архивный участник
 
Join Date: Jul 2005
Posts: 371
Default

hmm, no replys, interesting
torune is offline  
Old 06.06.2006, 17:52   #3
poplo8
Архивный участник
 
Join Date: May 2006
Posts: 25
Default

表示同情!
poplo8 is offline  
Old 06.06.2006, 17:57   #4
top-gear
Архивный участник
 
Join Date: Aug 2005
Posts: 605
Default

i would personally prefer a reply at my pm
top-gear is offline  
Old 06.06.2006, 18:02   #5
toolpunk
Архивный участник
 
Join Date: May 2005
Posts: 2,033
Default

you really get me scared :|
this looks like something good, but unfortunately i hardly understand the code :cry:
seems i have to learn asm when i get some more time.
maybe during the summer holidays...
'cause now i don't make a lot of progress. i started reading the "Art of Assembly" about a month ago and currently i'm on page 47 which ain't a lot facing this book has more than 1k pages T_T
toolpunk is offline  
Old 06.06.2006, 18:23   #6
torune
Архивный участник
 
Join Date: Jul 2005
Posts: 371
Default

Quote:
Originally Posted by poplo8
表示同情!
我干吗这么傻逼帮老外啊,自作孽不� �活
嗷嗷后悔, 以后不贴了, 继续玩魔兽世界
torune is offline  
Old 06.06.2006, 18:26   #7
Grillo
Архивный участник
 
Join Date: Oct 2005
Posts: 73
Default

Sorry to interupt your little chat and hijack your thread but:
9.) Posting language
We only allow english post, so if you can't write it use a translator (http://babelfish.altavista.com/). You guys can post it in both languages, russian/english, spanish/english, whatever/english but always leave a english version with it.
Grillo is offline  
Old 06.06.2006, 18:37   #8
torune
Архивный участник
 
Join Date: Jul 2005
Posts: 371
Default

i do not give a damn
and
i do know the rule
and
i dont care
and
if mod want to, feel free to ban/warnning me
torune is offline  
Old 06.06.2006, 19:34   #9
mcrabben7
Архивный участник
 
Join Date: Apr 2006
Posts: 461
Default

Thanks for the share Torune. If I continue my own project I will probably use this.
mcrabben7 is offline  
Old 06.06.2006, 19:48   #10
zcold
Архивный участник
 
Join Date: Nov 2005
Posts: 146
Default

Quote:
Originally Posted by torune
i do not give a damn
and
i do know the rule
and
i dont care
and
if mod want to, feel free to ban/warnning me
and
я - Д'Артаньян, а вы - личеры. Хуй забаните!

Sounds good, let's all do like you
zcold is offline  
Old 06.06.2006, 22:52   #11
RipperX
Архивный участник
 
Join Date: Dec 2005
Posts: 242
Default

Interesting, can u do a dll source with this func. ? Just for view a dll base code of L2.

Thx 4 all.
RipperX is offline  
Old 07.06.2006, 00:18   #12
torune
Архивный участник
 
Join Date: Jul 2005
Posts: 371
Default

/offtopic:
if you spend hundreds times to load up l2server, viewing the memory stack and check the dll's asm code in ollydbg, thats what i do at the beginning.

/ontopic:
are you blind? its dll source code
torune is offline  
Old 07.06.2006, 01:08   #13
RipperX
Архивный участник
 
Join Date: Dec 2005
Posts: 242
Default

i'm not blind torune, i say a "complete" source. only compile. I don't know how programm a l2server dll file.
thx again, i don't want distorb u.
RipperX is offline  
Old 07.06.2006, 04:35   #14
tpuNIsher
Архивный участник
 
Join Date: Mar 2006
Posts: 685
Default

viva la revolution!
The question is :> Did you manage more than one? :P


And yah awesome ting :P
Makes me wonder how much is your experience in asm...
tpuNIsher is offline  
Old 07.06.2006, 05:49   #15
Mesgabalis
Архивный участник
 
Join Date: Jan 2006
Posts: 11
Default

Thanks man, you're a light in the tunnel

Off:
我们是感激的为什么您。我是外国人� �开始开发我自己的图书馆。您的代码� ��一件好事学会并且我了解大多数。很 快我将分享一些来源如果一切将工作� �好
Mesgabalis is offline  
Old 07.06.2006, 12:15   #16
testdude
Архивный участник
 
Join Date: Nov 2005
Posts: 504
Default

well, for those who are interested in making their own dll's, i got some stuff too ;o
Code:
int RequestMakeMacroPacket(DWORD hSocket, unsigned char* hBuffer)
{
	DWORD id;
	unsigned char icon;
	unsigned char count;
	wchar_t name[255];
	wchar_t desc[255];
	wchar_t acr[255];

	unsigned char buf[4095];
	unsigned char entry;
	unsigned char type;
	DWORD skill;
	unsigned char shortcut;
	wchar_t cmd[1023];
	bool bEditMode = false;

	MACRO *pMacroAux;

	int charId = GetCharIDFromSocket(hSocket);
	if (charId == NULL)
		return 1;

	Disassemble(hBuffer, FMT_REQUEST_MAKE_MACRO_MAIN, &id, 64, name, 64, desc, 64, acr, &icon, &count, 4095, buf);
	

	unsigned short i;
	for (i = 0; i < pInfoTable[charId]->macro_list.size(); i++)
	{
		if (pInfoTable[charId]->macro_list[i]->id == id)
		{
			bEditMode = true;

			break;
		}
	}

	pInfoTable[charId]->macro_rev++;

	if (bEditMode)
		pMacroAux = pInfoTable[charId]->macro_list[i];
	else
		pMacroAux = (MACRO *)malloc(sizeof(MACRO));
 
	pMacroAux->id = id;
	pMacroAux->count = count;
	pMacroAux->icon = icon;

	if (bEditMode)
	{
		pMacroAux->name = (wchar_t *)realloc(pMacroAux->name, (wcslen(name)+2) * sizeof(wchar_t));
		pMacroAux->desc = (wchar_t *)realloc(pMacroAux->desc, (wcslen(desc)+2) * sizeof(wchar_t));
		pMacroAux->acr = (wchar_t *)realloc(pMacroAux->acr, (wcslen(acr)+2) * sizeof(wchar_t));
	}	
	else
	{
		pMacroAux->name = (wchar_t *)malloc((wcslen(name)+2) * sizeof(wchar_t));
		pMacroAux->desc = (wchar_t *)malloc((wcslen(desc)+2) * sizeof(wchar_t));
		pMacroAux->acr = (wchar_t *)malloc((wcslen(acr)+2) * sizeof(wchar_t));
	}

	wcscpy(pMacroAux->name, name);
	wcscpy(pMacroAux->desc, desc);
	wcscpy(pMacroAux->acr, acr);

	if (bEditMode)
	{
		for (short j = 0; j < pMacroAux->count; j++)
			free(pMacroAux->cmds[j].cmd);

		free(pMacroAux->cmds);
	}

	pMacroAux->cmds = (MACRO_CMD *)malloc(sizeof(MACRO_CMD)*count);

	size_t x = 0;
	for (short i = 0; i < count; i++)
	{
		Disassemble(buf + x, FMT_REQUEST_MAKE_MACRO_ELEM, &entry, &type, &skill, &shortcut, 1023, cmd);

		pMacroAux->cmds[i].cmd = (wchar_t *)malloc((wcslen(cmd)+2) * sizeof(wchar_t));
		wcscpy(pMacroAux->cmds[i].cmd, cmd);
		
		pMacroAux->cmds[i].id = id;
		pMacroAux->cmds[i].shortcut = shortcut;
		pMacroAux->cmds[i].skill = skill;
		pMacroAux->cmds[i].type = type;
		
		x += ((wcslen(cmd) + 1)*sizeof(wchar_t) + 1 + 1 + 4 + 1);
	}

	if (!bEditMode)
		pInfoTable[charId]->macro_list.push_back(pMacroAux);

	SendMacroList(charId);

	return 0;
}
its part of an old project i was working on with some friends that kinda died as the lead coder went MIA >.> 100% C++, no ASM cos i hate it, pInfoTable struct contains main info needed about a char, stored by charid for easy lookup if anyone was wondering :P hope it helps someone ^.^
testdude is offline  
Old 07.06.2006, 12:25   #17
RipperX
Архивный участник
 
Join Date: Dec 2005
Posts: 242
Default

Quote:
Originally Posted by testdude
well, for those who are interested in making their own dll's, i got some stuff too ;o
Code:
int RequestMakeMacroPacket(DWORD hSocket, unsigned char* hBuffer)
{
	DWORD id;
	unsigned char icon;
	unsigned char count;
	wchar_t name[255];
	wchar_t desc[255];
	wchar_t acr[255];

	unsigned char buf[4095];
	unsigned char entry;
	unsigned char type;
	DWORD skill;
	unsigned char shortcut;
	wchar_t cmd[1023];
	bool bEditMode = false;

	MACRO *pMacroAux;

	int charId = GetCharIDFromSocket(hSocket);
	if (charId == NULL)
		return 1;

	Disassemble(hBuffer, FMT_REQUEST_MAKE_MACRO_MAIN, &id, 64, name, 64, desc, 64, acr, &icon, &count, 4095, buf);
	

	unsigned short i;
	for (i = 0; i < pInfoTable[charId]->macro_list.size(); i++)
	{
		if (pInfoTable[charId]->macro_list[i]->id == id)
		{
			bEditMode = true;

			break;
		}
	}

	pInfoTable[charId]->macro_rev++;

	if (bEditMode)
		pMacroAux = pInfoTable[charId]->macro_list[i];
	else
		pMacroAux = (MACRO *)malloc(sizeof(MACRO));
 
	pMacroAux->id = id;
	pMacroAux->count = count;
	pMacroAux->icon = icon;

	if (bEditMode)
	{
		pMacroAux->name = (wchar_t *)realloc(pMacroAux->name, (wcslen(name)+2) * sizeof(wchar_t));
		pMacroAux->desc = (wchar_t *)realloc(pMacroAux->desc, (wcslen(desc)+2) * sizeof(wchar_t));
		pMacroAux->acr = (wchar_t *)realloc(pMacroAux->acr, (wcslen(acr)+2) * sizeof(wchar_t));
	}	
	else
	{
		pMacroAux->name = (wchar_t *)malloc((wcslen(name)+2) * sizeof(wchar_t));
		pMacroAux->desc = (wchar_t *)malloc((wcslen(desc)+2) * sizeof(wchar_t));
		pMacroAux->acr = (wchar_t *)malloc((wcslen(acr)+2) * sizeof(wchar_t));
	}

	wcscpy(pMacroAux->name, name);
	wcscpy(pMacroAux->desc, desc);
	wcscpy(pMacroAux->acr, acr);

	if (bEditMode)
	{
		for (short j = 0; j < pMacroAux->count; j++)
			free(pMacroAux->cmds[j].cmd);

		free(pMacroAux->cmds);
	}

	pMacroAux->cmds = (MACRO_CMD *)malloc(sizeof(MACRO_CMD)*count);

	size_t x = 0;
	for (short i = 0; i < count; i++)
	{
		Disassemble(buf + x, FMT_REQUEST_MAKE_MACRO_ELEM, &entry, &type, &skill, &shortcut, 1023, cmd);

		pMacroAux->cmds[i].cmd = (wchar_t *)malloc((wcslen(cmd)+2) * sizeof(wchar_t));
		wcscpy(pMacroAux->cmds[i].cmd, cmd);
		
		pMacroAux->cmds[i].id = id;
		pMacroAux->cmds[i].shortcut = shortcut;
		pMacroAux->cmds[i].skill = skill;
		pMacroAux->cmds[i].type = type;
		
		x += ((wcslen(cmd) + 1)*sizeof(wchar_t) + 1 + 1 + 4 + 1);
	}

	if (!bEditMode)
		pInfoTable[charId]->macro_list.push_back(pMacroAux);

	SendMacroList(charId);

	return 0;
}
its part of an old project i was working on with some friends that kinda died as the lead coder went MIA >.> 100% C++, no ASM cos i hate it, pInfoTable struct contains main info needed about a char, stored by charid for easy lookup if anyone was wondering :P hope it helps someone ^.^
Amazing, MACRO struct is defined inside L2Server ?
thx in advance.
RipperX is offline  
Old 07.06.2006, 12:47   #18
testdude
Архивный участник
 
Join Date: Nov 2005
Posts: 504
Default

Code:
typedef struct __MACRO
{
	short id;
	short icon;
	wchar_t* name;
	wchar_t* desc;
	wchar_t* acr;
	short count;
	MACRO_CMD* cmds;
} MACRO;
testdude is offline  
Old 07.06.2006, 17:09   #19
torune
Архивный участник
 
Join Date: Jul 2005
Posts: 371
Default

i wonder what's in pInfoTable lol
torune is offline  
Old 07.06.2006, 17:21   #20
testdude
Архивный участник
 
Join Date: Nov 2005
Posts: 504
Default

Quote:
Originally Posted by torune
i wonder what's in pInfoTable lol
well...
Code:
typedef struct INFOEXT
{
	long	sid;
	long	XCoord;
	long	YCoord;
	long	ZCoord;
	long	HairObjectId;
	long	HairItemId;
	long	HairSid;
	long	ClanPrivileges;
	long	Armory1;
	long	Armory2;
	long	Armory3;
	short	RecommendationsLeft;
	short	RecommendationsHave;
	short	MaxInventory;
	short	SpecialEffects;
	long	MaxCP;
	long	CurrentCP;
	short	TeamCircle;
	short	Level;
	char	Class;
	DWORD	Socket;
	char	Hero;
	char	FishingMode;
	long	NameColor;
	short	stat_str;
	short	stat_dex;
	short	stat_con;
	short	stat_int;
	short	stat_wit;
	short	stat_men;

	char	UserMsgSent;
	char	MacroListLoaded;

	short*	pstat_str;
	short*	pstat_dex;
	short*	pstat_con;
	short*	pstat_int;
	short*	pstat_wit;
	short*	pstat_men;

	wchar_t* Name;

	unsigned long	 macro_rev;
	vector<MACRO *>  macro_list;

} UCINFOEXT;
thats what xD and i know ur gonna ask whats with the storing of stats, well, it was for a beta of henna, cos we never kinda figured out how to get the userinfo struct from l2server in C++... so work on henna kinda stopped....
testdude is offline  
Old 07.06.2006, 18:28   #21
torune
Архивный участник
 
Join Date: Jul 2005
Posts: 371
Default

.........you guys even put TeamCircle?.........
wow, thats something i didnt expect
torune is offline  
Old 07.06.2006, 18:34   #22
torune
Архивный участник
 
Join Date: Jul 2005
Posts: 371
Default

i guess most stuff are the same
Code:
	DWORD HairslotItemId;
	DWORD HairslotObjectId;
	DWORD dwArmory[3];
	DWORD RecomHave;
	DWORD RecomLeft;
	DWORD CurrentCp;
	DWORD MaxCp;
	DWORD oldX;
	DWORD oldY;
	DWORD oldZ;
	DWORD ClanPrivileges;
	DWORD nRecipeBook;
	DWORD AllowedRecipeBook;
	DWORD CraftCustomer;
	DWORD nCreateList;
	wchar_t * pRecipeShopName;
	bool * MacroList;
	int SoulShot;
	int SpiritShot;	
	bool isHero;		//if hero
the userinfo struct in l2sesrver is not easy to understand, i only get 70% out of it, may be some people have more. but they are good for me already.
torune is offline  
Old 07.06.2006, 19:31   #23
testdude
Архивный участник
 
Join Date: Nov 2005
Posts: 504
Default

yeah... i was gonna do a builder cmd to change team for events n stuff, was just a little something we had never seen on another server :P with the userinfo struct... we just never figured out how to get it.... the pointer to it that was sent to some functions was never the same for the same person, i never had a chance to do any looking around with it though so i dont know if theres any specific function to call that returns the pointer to it...

also, we hooked the call to the send function for char/userinfo packets, instead of hooking the function from the dword table, simply because it was easyer than having to retrieve the info from the struct sent to the char/userinfo functions, though now im starting to think that it may have been wise to do that instead, as i wouldnt need to find out how to get the userinfo struct cos it would be sent to the func for me xD
testdude is offline  
Old 07.06.2006, 20:37   #24
Aikeleer
Архивный участник
 
Join Date: Jun 2005
Posts: 374
Default

Hmm, thanks, I'm beginning to understand more what you guys are doing. Thanks both Torune and Testdude.
Aikeleer is offline  
Old 07.06.2006, 22:37   #25
Alien003
Архивный участник
 
Join Date: Jun 2005
Posts: 143
Default

Quote:
Originally Posted by testdude
yeah... i was gonna do a builder cmd to change team for events n stuff, was just a little something we had never seen on another server :P with the userinfo struct... we just never figured out how to get it.... the pointer to it that was sent to some functions was never the same for the same person, i never had a chance to do any looking around with it though so i dont know if theres any specific function to call that returns the pointer to it...

also, we hooked the call to the send function for char/userinfo packets, instead of hooking the function from the dword table, simply because it was easyer than having to retrieve the info from the struct sent to the char/userinfo functions, though now im starting to think that it may have been wise to do that instead, as i wouldnt need to find out how to get the userinfo struct cos it would be sent to the func for me xD
at the start of any User:: function the ECX is always the user struct
Alien003 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 17:12.