noob question - call method function menu

User Tag List

Results 1 to 6 of 6
  1. #1
    ostapus's Avatar Active Member
    Reputation
    58
    Join Date
    Nov 2008
    Posts
    176
    Thanks G/R
    2/8
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    noob question - call method function

    Hi,

    is there convenient way to call method function. ie:
    now i've to use asm to get (for example) object coordinates

    WowPos *coord;
    DWORD objectPtr ;
    DWORD GetPositionAddr=0x12345 ;

    __asm
    {
    push coords
    mov ecx, objectPtr
    call GetPositionAddr
    }

    so, i would like to get rid of __asm and call something like
    objectPtr->GetPositionAddr(&coord) ;

    can't figure out how to emulate class method call from plain C

    thanks

    noob question - call method function
  2. #2
    nitrogrlie's Avatar Member
    Reputation
    11
    Join Date
    Oct 2009
    Posts
    81
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nowhere near a computer to test this but something like this should work:
    Code:
    typedef void ( __thiscall * tFunc )( CGObject_C * ptr_this, WowPos * pos);
    tFunc GetPosition = (tFunc)0x12345;
    Then if the above is typedef inside your CGObject_C class you could:
    Code:
    WowPos coord;
    GetPosition(this, &coord);
    There are better ways to deal with Virtual Functions though.
    Last edited by nitrogrlie; 11-09-2009 at 05:04 PM.

  3. #3
    blackfang500's Avatar Member
    Reputation
    35
    Join Date
    Apr 2007
    Posts
    491
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by nitrogrlie View Post
    Nowhere near a computer to test this but something like this should work:
    Code:
    typedef void ( __thiscall * tFunc )( CGObject_C * ptr_this, WowPos * pos);
    tFunc GetPosition = (tFunc)0x12345;
    Then if the above is typedef inside your CGObject_C class you could:
    Code:
    WowPos coord;
    GetPosition(this, &coord);
    There are better ways to deal with Virtual Functions though.
    Then how are you responding?

  4. #4
    Multitask's Avatar Contributor

    Reputation
    158
    Join Date
    Jan 2008
    Posts
    1,112
    Thanks G/R
    0/0
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by blackfang500 View Post
    Then how are you responding?
    smartphone, nettop, friends pc, ect...

  5. #5
    ostapus's Avatar Active Member
    Reputation
    58
    Join Date
    Nov 2008
    Posts
    176
    Thanks G/R
    2/8
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by nitrogrlie View Post
    Nowhere near a computer to test this but something like this should work:
    Code:
    typedef void ( __thiscall * tFunc )( CGObject_C * ptr_this, WowPos * pos);
    tFunc GetPosition = (tFunc)0x12345;
    Then if the above is typedef inside your CGObject_C class you could:
    Code:
    WowPos coord;
    GetPosition(this, &coord);
    There are better ways to deal with Virtual Functions though.
    bingo! __thiscall (how i could miss this modifier)...
    thanks a lot!

    +Rep

  6. #6
    Cypher's Avatar Kynox's Sister's Pimp
    Reputation
    1356
    Join Date
    Apr 2006
    Posts
    5,368
    Thanks G/R
    0/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Typedefs (for free functions), and class definitions (for member functions and virtual member functions) ftw.

Similar Threads

  1. Replies: 8
    Last Post: 07-22-2013, 01:24 AM
  2. [Question] Calling a method(some strange stuff?)
    By streppel in forum WoW Memory Editing
    Replies: 3
    Last Post: 05-29-2011, 06:34 PM
  3. Spose its a noob question But..
    By Osmose in forum World of Warcraft General
    Replies: 4
    Last Post: 11-03-2006, 01:22 PM
  4. DBC-noob questions
    By Minimized in forum WoW ME Questions and Requests
    Replies: 5
    Last Post: 10-13-2006, 07:39 PM
  5. noob question
    By mauzer in forum Community Chat
    Replies: 1
    Last Post: 10-10-2006, 11:25 AM
All times are GMT -5. The time now is 03:35 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search