-
Active Member
Finding GetName Address + VMT index
Hello!
I have started trying to figure out how to access unit/object names myself, and I figured that since I'm working from an injected context, finding the instance methods such as CGUnit_C::GetUnitName() would be simplest (rather than trying to reverse the various name caches).
I started by grabbing the wonderful Mac IDB for version 15662 with the debug symbols, and trying to go from e.g Script_UnitName, matching calls and static offsets to what I had labeled myself in my IDb for the current version of the game [7.2.5.24461 x64]. After a bit of searching around and comparing disassembly listings, I ~think~ I have found CGUnit_C::GetUnitName() at 4AA930. As a side note, I could only find references to two functions for getting the name of the object, CGGameObject_C::GetName and the unit name, Is this all there are?
Here's what the pseudocode for Script_UnitName looks like with one or two renamings from my findings:
Note that I found two possible references for Script_UnitName, based on cross-references to the "Usage: UnitName(..." string. One of those references calls the other, so I figured the latter is the real underlying function. And it does indeed reference what I believe to be GetUnitName().
However, I tried looking at the VMT for my local player, and didn't see any references to the function at 4AA930. Is there a different function for players? Did I perhaps check the VMT incorrectly? Or am I just way off the mark here?
Any pointers on where I may have gone wrong/made bad assumptions would be appreciated, as well as tips on where else I could look to try and trace from. Trying to work it out myself rather than just beg for an offset, so I can find it again later when the game is patched etc.
Cheers.
Last edited by Shenlok; 07-12-2017 at 06:54 PM.
-
Post Thanks / Like - 1 Thanks
tutrakan (1 members gave Thanks to Shenlok for this useful post)
-
Contributor
Hi!
Your assumptions is right.
For LocalPlayer name is used function ClientServices::GetCharacterName() 0xB2F5C0, it's in the end of Script_UnitName.
ClientServices::GetCharacterName() just return static address of s_characterName;
Here is my decompiled Script_UnitName https://hastebin.com/ogeducamus.rb
-
Post Thanks / Like - 1 Thanks
Shenlok (1 members gave Thanks to air999 for this useful post)
-
Active Member
Thanks a bunch air999, that was very helpful. Glad I seem to have stumbled on some truths myself
So if the function called in the UnitName script is indeed CGUnit_C::GetUnitName() (or rather it appears to be a simple jmp wrapper around the actual function call, the wrapper being at 4AAD60 and the real function at 4AA930), then why would I not be able to find a reference to this function from my local player's VMT? I understand that the Script_UnitName uses a wrapper around the static pointer to the player name, but I assume this is just a convenience or performance thing, and not because the local player object's class doesn't include a virtual function for getting the name. Or am I mistaken, and I shouldn't expect to find it in the VMT for the local player at all? If so, should I expect to find it for ANY player type?
My goal here is to figure out a general solution for getting the names of the various WoW object types (Items, Units, Players, GameObjects...). I have seen references to a general CGObject_C::GetName() virtual function from very old threads, but from looking at the Mac build with the debug symbols intact I didn't find such a function at the top level of the class hierarchy.
Last edited by Shenlok; 07-13-2017 at 04:59 AM.
-
Contributor
Originally Posted by
Shenlok
...I started by grabbing the wonderful Mac IDB for version 15662 with the debug symbols...
Thank you sir! I didn't know that such a beauty had even leaked!
So sad that the enums and structs are missing.
Last edited by tutrakan; 07-13-2017 at 08:30 PM.