Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Guild Wars 2
You last visited: Today at 07:19

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Started Reverse Engineer GW2 and need some advice

Discussion on Started Reverse Engineer GW2 and need some advice within the Guild Wars 2 forum part of the MMORPGs category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Oct 2013
Posts: 3
Received Thanks: 3
Lightbulb Started Reverse Engineer GW2 and need some advice

Hey guys,

I recently started to reverse engineer gw2 myself. But I am a bit stuck and I was hoping for some advice I first want to tell you what I found out and I was hoping you guys could correct me if I got something wrong. If you could give me some tips in what direction I shall looking more into, I would highly appreciate it. Also I am kind of new to all this (coming from a developer standpoint), so I also would love to know more tools, plugins, features, ... I should have a look at

So let me get started.

assert() function

Most of the strings in the binary are part of an “assert()” function with some debug information. This is a gret source to figure out certain passed parameters/variables as well as in what file this function was defined. My question is, most of those functions are probably class methods. Can I most of the time assume that the first parameter (probably on the stack) is the this pointer to the object this method belongs to? If so, how can I get from there to the corresponding vtable?




RTTI and vtables

I found an old gw2 beta torrent where the gw2.exe was still compiled with RTTI. On OpenRCE I found a “ClassInformer” (
) plugin to gather the RTTI and vtable information.



With this it is pretty cool to reverse engineer the class hirarchy structure, as well class functions. Though it’s the first time doing this, and I still haven’t understood completly how vtables are corresponding to classes and how you guys find these pointers to other objects (for example “chcontext+38h = charakter + 44h = agent + 1ch = world” - ). As far as I understand, what you can see on this screenshot is the virtual function table. Which means there are no information about the attributes, right? Can I search the memory for objects pointing to the vtable information, to find the objects in memory and then reverse engineer the attributes?

Class hirarchy, ChContext and pointers

I have read a lot of Threads here and I often find class hirarchies like the following - “ChContext->Character->Agent->World->EntityInWorld->Speed” (). How did you guys figure out those class names and hirarchies? And how did you find the offsets? Were you looking for the memory address with CheatEngine and then did a pointer scan? I was not able to get those pointer paths myself. Any tips for the pointer scan settings or common pitfalls?

It seems like ChContext is the “base” class and from there you can get to all important information. But I can’t find any refernce to ChContext. But there exists a View::CContext. Is this the same?
Also I see WorldViewInt::CContext, View::Context, WorldMapModel::CContext, WvwClient::CContext, … and many more. How do they differ? Or are they basically the same, and it just depends on if you are currently in PVE, WvW, …

Based on a comment in an autoupdater source () I found the following function and address in the current build. Is this the ChContext/CContext? If so, why can’t I follow the many pointer examples like: ChContext+38h -> Charakter + 44h
How did you guys find this function in the first place? With pointer scans in CheatEngine? Or did you find it statically?



Would appreciate any input
I would love even more to chat with somebody about it. Would be really cool if somebody could share some experience and information with me.
Thank you very much in advance,
kind regards,
RevEngRazer

Here is the link to another project I am working on, so you can estimate my skill level:
RevEngRazer is offline  
Thanks
1 User
Old 10/15/2013, 18:00   #2
 
Xereon's Avatar
 
elite*gold: 0
Join Date: Apr 2009
Posts: 793
Received Thanks: 366
Quote:
Can I most of the time assume that the first parameter (probably on the stack) is the this pointer to the object this method belongs to? If so, how can I get from there to the corresponding vtable?
No. An assert is an assert, they can check anything they want with them. If the assert condition dont tell you that it is a class method you cant assume that. Though most modern computer programs organize their application logic in classes, that doesnt mean that they dont use any regular functions anymore. Besides that, static methods are compile to the same as regular functions.

Next point: What are calling conventions? Apparently you already know the basics how functions are called usually, but there some other ways to call functions one of them being called a . When a method is called through a __thiscall the this pointer is passed in ECX. Thats the reason why you can assume most of the time ECX is accessed (like MOV EAX, [ECX + 8h]) and not set before, the this pointer is accessed. The example shown before is a classical getter (regarding your other question). So if you see code like this:

MOV ECX, EDX
CALL XYZ
ASSERT(EAX,"m_fooMember")

And XYZ consists of such a line: MOV EAX, [ECX + 8h], one can translate this directly into cpp pseudo code like this:

Foo* EAX = EDX->getFooMember();
assert(EAX, "m_fooMember");

Then you know that m_fooMember is actually located at the offset 8h.
To get back to calling conventions: You cannot always assume that ECX references a object, even if it was not set before in a function. The compiler might optimize and there is still which uses the ECX register too.

Now regarding vftables:
Yes you can. If you know the location of a vftable looking at the first "member" of an object is a great way to find out its type (because it will point to your named vftable). BUT make sure that understand vftables truly. E.g: If you have a class Child inheriting class Parent but not overwriting any methods of Parent, no new vftables are compiled. Therefor you could think accidentally that an object is an instance of Parent, while its actually an instance of Child. Another point to notice is that an object can have multiple vftables, e.g if there would be some additional virtual methods in the Child class.
Vftable calls are usually preceded by a number of moves (/ dereferences) to accquire the vftable ptr and finally the function pointer. Then usually a register is called. Unfortunately I dont have a snippet atm.


Regarding RTTI:
With RTTI you can only find polymorphic classes, always remember that! I once wrote a script to generate header files which could be parsed by doxygen to generate a documentation. Although this is almost a year ago :P and I guess that most of the classes / vftables will be outdated like hell. Nevertheless it could be worth to take a look at the class ierarchy to get an overview.

Ctx:
Im tired of writing, someone lese can surely answere this question.
Xereon is offline  
Thanks
1 User
Reply


Similar Threads Similar Threads
Release!!! Reverse Engineer dll and exe Files Using This...
03/18/2013 - Soldier Front Hacks, Bots, Cheats & Exploits - 18 Replies
I Have a powerful Tool Here for those who know how to use it. View, Edit, and Reverse Engineer EXE and DLL Files. This Tool is the most feature-packed program for inspecting the inner workings of your own software, and more importantly, third party Windows applications and libraries for which you do not have source code. This Tool lets you open, view and edit a variety of different 32-bit Windows executable file types (also called PE files) ranging from the common, such as EXE, DLL and...
aion reverse engineer hack
05/18/2012 - Aion - 7 Replies
Feature: Increase attack speed* Simplest hack there is, Video below. Increase Speed hack* Modify your character's speed Instant Respawn* Instant Respawn where you are when you die click the revive button or hold If can anyone find the hack pls post a link
D2 reverse engineer kenntnisse gesucht
11/23/2009 - Diablo 2 - 6 Replies
Hi, suche jemand der sich mit reverse engineering und diablo 2 auskennt (am besten ollydbg), habe 2-3 Fragen. Bitte per PM melden wenn jemand anwesend ist :).



All times are GMT +2. The time now is 07:19.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.