Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[Tutorial] How to find TW client structs

Newbie Spellweaver
Joined
Apr 14, 2013
Messages
74
Reaction score
7
NOTE: this tutorial requires knowledge in assembly language, and I will not be teaching it here.

So ill be showing you my method of getting the TW client structs.
The tool we will be using is Cheat Engine.
NOTE: I am using Cheat Engine 6.7, as I faced some problems testing the newest version, but this one works quite well.

I was not able to get any strings/functions/structs from the client using other tools (like IDA or ollydbg), and I think the reason is that the client code is obfuscated/encrypted. So the alternative is to look at the code at runtime, and I think Cheat Engine does this very well.
Basically, when the client runs, it unpacks and loads everything into its memory, so then we will be able to actually find stuff.

So here are the steps:

  1. Run DBO.exe client (no servers required), wait until its in the login screen, then just minimize the window and keep it there.
  2. In cheat engine attach the DBO.exe process
  3. Go to [Memory View] -> [View] -> [Referenced strings]
  4. It will ask you to dissect the code, click yes and wait for it till its finished.
  5. Now we get the “Referenced strings” window. search for any of the game server (GU) packets. Example: GU_SKILL_LEARN_RES
  6. Now we can see all of the game server opcodes, and if we scroll up far enough we will be able to find other servers’ opcodes.
  7. On the right you will see the list of addresses that reference the opcode, most of the opcodes only have one reference, so we will only see one address.
  8. Double click on that address, and it will take you to it in the Memory Viewer.

So here is the Memory Viewer of the GU_SKILL_LEARN_RES reference address:



this is the function that handles the GU_SKILL_LEARN_RES packets in the client.

In the blue square, we see a hex value being pushed and the comment "5073", those refer to the opcode, so the GU_SKILL_LEARN_RES packet has the opcode 5073, which is 000013D1 in hexadecimal.

In the red square, we see first “mov esi,[esp+08]” ==> [esp+08] is the start address of the struct, and we are moving it into esi, so the struct fields should be "esi+##"
NOTE: The opcode is 2 bytes (WORD) and it will start at esi, so the first element after that would be the first element in the struct. For the GU_SKILL_LEARN_RES packet, it is the wResultCode variable.

So now we see “movzx eax,word ptr [esi+02]”.
In short, it is moving the value of wResultCode into eax.

Next is “cmp ax,01F4”, cheat engine added the comment “500”, which means that the value of “01F4” is 500 (which is actually the GAME_SUCCESS result code).

6 steps below it we can see that the wResultCode "[esi+02]" value is being pushed as a parameter to the next function, this is probably the function for handling events. therefore, if the packet struct had other fields, they would probably be also pushed here.

i hope this was clear and helpful. i know i used the simplest packet struct (only 1 field), but finding the structs of the other packets can be acheived in a quite similar way.

im not a professional, so please correct any mistake i made or add whatever information you want to.

UPDATE:

this is how you can get all opcode numbers and how to find each number's opcode name.

1. follow the steps above until step 8.
2. scroll up until the start of the function (the line just below the "int 3" instructions).
3. you will see the line that corresponds to the data section of the function (Code/Data)
4. double click the text (Code/Data)

now you can see all opcode numbers, to find an opcode's name, you need to go to the function where the name is shown in the comment.

we can see that the opcode is being pushed to a function as a parameter:
push 000013D1
above it, there is the address of the function that handles the opcode,
5. double click on this line and copy only the address.
6. press Ctrl+G on your keyboard
7. paste and click ok to go to the address
8. scroll down until you see the opcode's name in the comment

ill be showing how to find the fields of other structs later on (just some more examples)
 
Last edited:
Newbie Spellweaver
Joined
Aug 16, 2017
Messages
84
Reaction score
34
You are a genious,
I think it would be good to publish this same tutorial but with a package with more data so that it is better understood. Could you do that if it's not too much trouble?

Can I get structures from the edf files with this method?
 
Last edited:
Newbie Spellweaver
Joined
Apr 14, 2013
Messages
74
Reaction score
7
You are a genious,
I think it would be good to publish this same tutorial but with a package with more data so that it is better understood. Could you do that if it's not too much trouble?

Can I get structures from the edf files with this method?
thanks, and im happy you liked it.
sure ill add something related to a packet with more fields later on.

to see the content of the edfs you need to decrypt them (convert to rdf), then convert them to xml, then everything in them will be clear and editable. one of the threads has the AKCore TW server files which also has the xml files.
 
Newbie Spellweaver
Joined
Aug 16, 2017
Messages
84
Reaction score
34
The edf of the TW client has more data than the old kr client, in addition the TW client has new edf and therefore new structures
 
Newbie Spellweaver
Joined
Aug 16, 2017
Messages
84
Reaction score
34
I don't see the request packages, the ones that start with UG_ How can I find the opcodes of those packages?
Do you have a discord?
 
Last edited:
Newbie Spellweaver
Joined
Apr 14, 2013
Messages
74
Reaction score
7
I don't see the request packages, the ones that start with UG_ How can I find the opcodes of those packages?
Do you have a discord?

i wasnt able to find UG packets in cheat engine either, but you can get them by using a packet sniffer (like wireshark) and viewing the data of the packets sent by the client, those are the UG packets.

wireshark may not be able to capture localhost traffic, if so then look for a packet sniffer that does, i am using RawCap.
 
Newbie Spellweaver
Joined
Apr 14, 2013
Messages
74
Reaction score
7
the post is updated. sorry if things are a bit messy though.
 
Last edited:
Newbie Spellweaver
Joined
May 31, 2014
Messages
94
Reaction score
23
that is so hard way to find strutures
SanGawku have write me one tool on server side that give me OpCodes and right size of struture in bnnary we just need do the contruction of struture :D

weertoop - [Tutorial] How to find TW client structs - RaGEZONE Forums


weertoop - [Tutorial] How to find TW client structs - RaGEZONE Forums
 
Newbie Spellweaver
Joined
Apr 14, 2013
Messages
74
Reaction score
7
that is so hard way to find strutures
SanGawku have write me one tool on server side that give me OpCodes and right size of struture in bnnary we just need do the contruction of struture :D

weertoop - [Tutorial] How to find TW client structs - RaGEZONE Forums


weertoop - [Tutorial] How to find TW client structs - RaGEZONE Forums

wow this is so much better than my way xD, i feel bad for myself now for not asking for help... :/
 
Newbie Spellweaver
Joined
Aug 16, 2017
Messages
84
Reaction score
34
that is so hard way to find strutures
SanGawku have write me one tool on server side that give me OpCodes and right size of struture in bnnary we just need do the contruction of struture :D

weertoop - [Tutorial] How to find TW client structs - RaGEZONE Forums


weertoop - [Tutorial] How to find TW client structs - RaGEZONE Forums

I don't understand, what exactly does this script do?
The packages already bring the opcodes and the size of the structure.
 
Back
Top