2 Questions Interact/Select Target C++ menu

Shout-Out

User Tag List

Results 1 to 5 of 5
  1. #1
    jockel's Avatar Member
    Reputation
    4
    Join Date
    Mar 2009
    Posts
    54
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    2 Questions Interact/Select Target C++

    Heya,

    I have two questions I'm not able to figure out since hours , can't count my Wow crashes...

    I'm injecting a C++ libary which communicates via named pipes with my main application.


    1) My main application sends the "BaseAddress" of an object to the library

    From the BaseAddress I'm figuring out the function pointer to the interact function, which looks like this:

    Code:
    typedef void (__thiscall *tInteract) (void);
    tInteract oInteract;
    
    void Interact(DWORD baseAddress)
    {
    	DWORD_PTR unitInteractVMT = *reinterpret_cast<DWORD_PTR*>(*reinterpret_cast<DWORD_PTR*>(baseAddress) + (38 *4));
    	oInteract= reinterpret_cast<tInteract>(unitInteractVMT );
    	oInteract();
    }
    But it seems to crash my Wow with a read error.

    2) Targeting:
    My main application sends a string containing the guid to my library, now how do I convert std::string to __int64 or _WowGuid?

    Tried to search the internet, but I can't find a solution for this problem.


    Would be really great to receive some hints.

    2 Questions Interact/Select Target C++
  2. #2
    Shynd's Avatar Contributor
    Reputation
    97
    Join Date
    May 2008
    Posts
    393
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Maybe you shouldn't be sending the GUID in string format. Just write the individual bytes (or two, hi- and lo-word, DWORDs) to the stream and read them off in the same way you are reading the baseaddress, then combine them into an int64. Not too difficult.

    And, by the way, __thiscall means it's called as a part of a class; more specifically, it's called as a part of the object class (or a derivative), which means you have to assign the baseaddress of the object with which you interact to the ecx register. I believe, actually, changing your typedef to typedef void (__thiscall * tInteract)(void * BaseAddress); and calling it with baseAddress as the first parameter will work, but I'm not sure. Cypher or someone else will correct me.

    I always used a dummy CObject class and cast the baseAddress to CObject, then called obj->Interact() (much, much better way of doing it).

  3. #3
    jockel's Avatar Member
    Reputation
    4
    Join Date
    Mar 2009
    Posts
    54
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for clearing this up Shynd, slowly I'm going to understand how the things are working.

    Now regarding to my SelectTarget problem, instead of passing a low and high word through the named pipe I decided to send the baseAddress and read the guid from the baseaddress of an object.

    But now my SelectTarget function is also going to crash wow, but I'm nearly sure my code is correct.

    FUNCTION_AT_ADDRESS( bool __fastcall _SelectTarget(_WoWGuid guid), _ptrSetTarget);

    void SelectTarget(DWORD baseAddress)
    {
    _WoWGuid * pguid = (_WoWGuid *)(baseAddress + 0x30);
    _WoWGuid guid = *pguid;

    _SelectTarget(guid);
    }
    This application has encountered a critical error:

    ERROR #132 (0x85100084) Fatal Exception
    Program: Wow.exe
    Exception: 0x80000003 (BREAKPOINT) at 001B:7C91120E

  4. #4
    ggg898's Avatar Member
    Reputation
    10
    Join Date
    Jan 2009
    Posts
    39
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well I dont know what your definition of FUNCTION_AT_ADDRESS does, but if it types SelectTarget as a fastcall routine, i guess the stack gets messed up. If i remember right fastcall passes two parameters in eax and ebx and the rest on the stack.

    this is how i type it, and it works fine

    typedef void (__cdecl * tSelectUnit)(__int64 guid);

  5. #5
    jockel's Avatar Member
    Reputation
    4
    Join Date
    Mar 2009
    Posts
    54
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I feel like an idiot, working now...
    Thanks for all helping me out.

Similar Threads

  1. Easiest way to use "Blizzard UI" functions to /interact with a selected target?
    By b0nghitter in forum WoW Bots Questions & Requests
    Replies: 1
    Last Post: 11-05-2012, 11:07 AM
  2. [Question] Problem with Fishbot - Interact with Target
    By VexeRR in forum WoW Memory Editing
    Replies: 15
    Last Post: 01-11-2011, 07:22 AM
  3. Replies: 2
    Last Post: 04-15-2010, 06:31 AM
  4. [Question] Interacting with WoW
    By CrazyCactuaR in forum Programming
    Replies: 3
    Last Post: 05-17-2009, 01:03 PM
  5. Lua Scripting, a question on mob targeting
    By adarant_dru in forum World of Warcraft Emulator Servers
    Replies: 1
    Last Post: 06-08-2008, 07:28 PM
All times are GMT -5. The time now is 10:28 AM. 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