C++ UnitName menu

Shout-Out

User Tag List

Thread: C++ UnitName

Results 1 to 8 of 8
  1. #1
    Waatz's Avatar Member
    Reputation
    1
    Join Date
    May 2007
    Posts
    4
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    C++ UnitName

    Hey!

    I tried to read the target name but it doesn't work.. (I'm a beginner in C++)
    As you can see in the picture below i can read everything else

    C++ UnitName-sans-titre-1-jpg

    PHP Code:
        INT targetMaxHealth;
        
    INT targetCurrentHealth;
        
    INT targetMaxMana;
        
    INT targetCurrentMana;
        
    FLOAT targetPosX;
        
    FLOAT targetPosY;
        
    FLOAT targetPosZ;
        
    char targetName[50];

        while(
    true){
            
    // Refresh GUID
            
    ReadProcessMemory(hProc, (LPCVOID)CurrentTargetGUID, &LocalTargetGUIDsizeof(LocalTargetGUID), NULL);
            
    targetBaseAddress GetObjectBaseByGuid(hProcFirstObjectLocalTargetGUID);

            
    // PosX, Y, Z
            
    ReadProcessMemory(hProc, (LPCVOID)targetBaseAddress X, &targetPosXsizeof(targetPosX), NULL);
            
    ReadProcessMemory(hProc, (LPCVOID)targetBaseAddress Y, &targetPosYsizeof(targetPosY), NULL);
            
    ReadProcessMemory(hProc, (LPCVOID)targetBaseAddress Z, &targetPosZsizeof(targetPosZ), NULL);

            
    // UnitsName1 & 2
            
    ReadProcessMemory(hProc, (LPCVOID)(targetBaseAddress 0xB30) + 0x0, &targetNamesizeof(targetName), NULL);

            
    // HP & MANA
            
    ReadProcessMemory(hProc, (LPCVOID)targetBaseAddress 0x8, &targetUnitFieldsAddresssizeof(targetUnitFieldsAddress), NULL);
            
    ReadProcessMemory(hProc, (LPCVOID)targetUnitFieldsAddress 0x70, &targetMaxHealthsizeof(targetMaxHealth), NULL);
            
    ReadProcessMemory(hProc, (LPCVOID)targetUnitFieldsAddress 0x58, &targetCurrentHealthsizeof(targetCurrentHealth), NULL);
            
    ReadProcessMemory(hProc, (LPCVOID)targetUnitFieldsAddress 0x74, &targetMaxManasizeof(targetMaxMana), NULL);
            
    ReadProcessMemory(hProc, (LPCVOID)targetUnitFieldsAddress 0x5c, &targetCurrentManasizeof(targetCurrentMana), NULL);

            if (
    targetBaseAddress) {
                
    cout << "Target Name : " <<  targetName << endl;
                
    cout << "HP : " << targetCurrentHealth << " / " << targetMaxHealth << " | Mana : " << targetCurrentMana << " / " << targetMaxMana << endl;
                
    cout << "X : " << targetPosX << " - Y : " << targetPosY << " - Z : " << targetPosZ << endl;
                
    cout << "|-------------------------------------------------" << endl;
            }
            
    Sleep(1000);
        } 
    Did i do something wrong?

    C++ UnitName
  2. #2
    d3rrial's Avatar Contributor Authenticator enabled
    Reputation
    127
    Join Date
    Apr 2010
    Posts
    527
    Thanks G/R
    0/5
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    &targetName? targetName is an array, lose the &. Won't make a difference, but its still not nice (its somewhat correct, but its not good style).

    Hazarding a guess: Is it possible that the endianness of the name is wrong?

    Also are unit names in the memory as ASCII char-arrays? Might it also be possible that the client uses UTF-8 or UTF-16 or any other type of encoding?
    Last edited by d3rrial; 01-05-2014 at 09:16 AM.

  3. #3
    drassian's Avatar Member
    Reputation
    1
    Join Date
    May 2012
    Posts
    15
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You need to read it as an ASCII String I'm pretty sure

    Code:
    //Copyright 2012 DaCoder
    //This file is part of daCoders Tool for WoW 1.12.1.
    
            public string MobNameFromBaseAddr(uint BaseAddr)
            {
                uint ObjectBase = BaseAddr;
                return ReadASCIIString((WowReader.ReadUInt((WowReader.ReadUInt((ObjectBase + (uint)Pointers.UnitName.UnitName1)) + (uint)Pointers.UnitName.UnitName2))));
            }

  4. #4
    Waatz's Avatar Member
    Reputation
    1
    Join Date
    May 2007
    Posts
    4
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes this value need to be read in ASCII but i think something need to be done before that.. i tried to read the value from a converter and its was wrong (INT targetName give 239206816)
    About the endianne and the encoding i have no idea..

  5. #5
    TOM_RUS's Avatar Legendary
    Reputation
    914
    Join Date
    May 2008
    Posts
    699
    Thanks G/R
    0/52
    Trade Feedback
    0 (0%)
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Text strings in wow use UTF-8 encoding. But I guess real problem is your offsets are wrong.

  6. #6
    Waatz's Avatar Member
    Reputation
    1
    Join Date
    May 2007
    Posts
    4
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have the source code of OpenHack and i take my offset from there..
    When i compile, launch openhack i got the correct target name
    Last edited by Waatz; 01-05-2014 at 11:18 AM.

  7. #7
    JuJuBoSc's Avatar Banned for scamming CoreCoins Purchaser
    Reputation
    1019
    Join Date
    May 2007
    Posts
    922
    Thanks G/R
    1/3
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Offsets is wrong + reading is wrong, it's 2 level pointer

  8. #8
    Waatz's Avatar Member
    Reputation
    1
    Join Date
    May 2007
    Posts
    4
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Like JuJuBoSc said its was the reading..

    PHP Code:
    DWORD targetName;
    char targetNameToChar[50];

    // UnitsName1 & 2
    ReadProcessMemory(hProc, (LPCVOID)targetBaseAddress 0xB30, &targetNamesizeof(targetName), NULL);
    ReadProcessMemory(hProc, (LPCVOID)targetName 0x0, &targetNamesizeof(targetName), NULL);
    ReadProcessMemory(hProc, (LPCVOID)targetName, &targetNameToCharsizeof(targetNameToChar), NULL); 
    Now it work correctly.
    Thank you guys !

Similar Threads

  1. [HELP] Function for unitname ?
    By paly in forum WoW Memory Editing
    Replies: 5
    Last Post: 06-19-2010, 08:36 AM
  2. [c++ QUESTION]typedef and unitname
    By Holdlang in forum WoW Memory Editing
    Replies: 7
    Last Post: 10-12-2009, 05:51 PM
All times are GMT -5. The time now is 02:05 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