vtable confusion menu

User Tag List

Results 1 to 4 of 4
  1. #1
    mnbvc's Avatar Banned
    Reputation
    120
    Join Date
    Jul 2009
    Posts
    273
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    vtable confusion

    here the vtables then you don't have to open ida :P
    unit: .rdata:009F0D5C - Anonymous - vGemuKU4 - Pastebin.com
    player: .rdata:009EE484 - Anonymous - 6aGnWZ0j - Pastebin.com
    object: .rdata:009EF2CC - Anonymous - AVWTstL0 - Pastebin.com


    i can always call function 12 to get the position. even if it's an object where CGObject_C__GetPosition is at position 11
    so function 11 and 12 do return the position of an object
    but function 12 looks more like a call to interact?
    Code:
    int __thiscall sub_5AF140(void *this, int a2)
    {
      (*(void (__stdcall **)(_DWORD))(*(_DWORD *)this + 44))(a2);
      return a2;
    }
    how can this work? :confused:


    my next understanding problem is interact, which is atm vtable index 44
    in player/unit it looks as i expected it:
    .rdata:009EE530 dd offset CGUnit_C__OnRightClick
    but i can also call this vtable function on objects. on objects index 44 is
    .rdata:009EF378 dd offset nullsub_4
    but it does still work :confused:


    now a function which makes sense to me for once
    function 54
    .rdata:009EE558 dd offset CGUnit_C__GetObjectName
    i get the unit name from it, but this time i don't get the name of objects if i simpy call it on an object like the other 2 functions :P
    is there no vtable function to get a object's name?

    vtable confusion
  2. #2
    caytchen's Avatar Contributor
    Reputation
    138
    Join Date
    Apr 2007
    Posts
    162
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The problem here is obviously that you have no idea why compilers use VTables and how you're supposed to use them. The idea they were built around is _not_ having to keep track what type an object in memory is, and in consequence, not having to match object instances to their class' implementation of a given virtual function.

    To clarify: all you're interested in is the index into the VTable, for example 12 for the one that returns the position. Then you get the function to call from the VTable of each individual object in memory.
    Last edited by caytchen; 06-05-2010 at 12:11 PM.

  3. #3
    MaiN's Avatar Elite User
    Reputation
    335
    Join Date
    Sep 2006
    Posts
    1,047
    Thanks G/R
    0/10
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can you post the ASM of the functions?
    [16:15:41] Cypher: caus the CPU is a dick
    [16:16:07] kynox: CPU is mad
    [16:16:15] Cypher: CPU is all like
    [16:16:16] Cypher: whatever, i do what i want

  4. #4
    mnbvc's Avatar Banned
    Reputation
    120
    Join Date
    Jul 2009
    Posts
    273
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok, i figured out what i did wrong... what i am calling "object" is actually cggameobject and not cgobject :P
    so the right vtable is .rdata:009F0504 - Anonymous - ypiTFJgE - Pastebin.com
    and
    11 .rdata:009F052C dd offset sub_5BB5C0
    12 .rdata:009F0530 dd offset sub_5BB620
    are indeed two function to get the position, whatever the reason is that it has two getposition functions...
    and function 44 is OnRightClick

    and function 54 looks fine, now i have to figure out why it doesn't work for me...
    Code:
    char *__thiscall sub_5BB810(int this)
    {
      int v1; // eax@1
      char *result; // eax@2
    
      v1 = *(_DWORD *)(this + 420);
      if ( v1 )
        result = *(char **)(v1 + 144);
      else
        result = &byte_9CE47F;
      return result;
    }
    ok, i also solved this problem, if anybody else has the same problem:
    although there is a check if v1 is valid it can happen that the returned pointer is invalid, that means you should validate it before dereferencing
    Last edited by mnbvc; 06-05-2010 at 02:52 PM.

Similar Threads

  1. Blizz - Ultima MASS CONFUSION!
    By chrisrichardson in forum World of Warcraft General
    Replies: 4
    Last Post: 01-17-2007, 02:05 PM
  2. Well This Is Confusing
    By WOWISFUN in forum World of Warcraft General
    Replies: 5
    Last Post: 12-05-2006, 05:37 PM
  3. confused!
    By Notahax in forum World of Warcraft General
    Replies: 3
    Last Post: 11-10-2006, 05:09 PM
  4. Evidence blizzard is run by confusing morons.
    By WoWLegend in forum World of Warcraft General
    Replies: 10
    Last Post: 09-24-2006, 01:09 AM
  5. Rawr..confused............
    By Hunter211 in forum World of Warcraft General
    Replies: 1
    Last Post: 07-13-2006, 02:05 PM
All times are GMT -5. The time now is 11:59 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search