GetLocalizedText Problem menu

Shout-Out

User Tag List

Results 1 to 5 of 5
  1. #1
    Creepwalker's Avatar Active Member
    Reputation
    39
    Join Date
    Oct 2008
    Posts
    202
    Thanks G/R
    19/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    GetLocalizedText Problem

    I've been having a problem with getting return values of variables passed by DoString. My DoString works flawlessly, I'm able to call protected functions, ect, but every time I try using getLocalizedText it never returns anything.

    Doing everything through my console using also works, ex: playerName = UnitName("player"); ----- print(playerName)
    Example:

    Code:
            public string CharacterName()
            {
                DoString("playerName = UnitName(\"player\");");
    
                var playername = (GetLocalizedText("playerName"));
    
                return playername;
            }
    Code:
            public ulong PlayerGuid()
            {
            DoString("guid = UnitGUID(\"player\")");
            string guid = GetLocalizedText("guid");
    
            return (Convert.ToUInt64(guid, 16));
    }

    Both calls return nothing.

    Here is GetLocalizedText:
    Code:
            public string GetLocalizedText(string variable)
            {
    
                uint codeCave = _wowHook.Memory.AllocateMemory(Encoding.UTF8.GetBytes(variable).Length + 1);
                _wowHook.Memory.WriteBytes(codeCave, Encoding.UTF8.GetBytes(variable));
    
                String[] asm = new String[]
                {
                    "call " + (Offsets.lua.ClntObjMgrGetActivePlayerObj + _wowHook.Process.BaseOffset()) ,                            
                    "mov ecx, eax",
                    "push -1",
                    "mov edx, " + codeCave + "",
                    "push edx",
                    "call " + (Offsets.lua.FrameScript__GetLocalizedText + _wowHook.Process.BaseOffset()) ,
                    "retn",
                };
    
                
    
                string varResult = Encoding.ASCII.GetString(_wowHook.InjectAndExecute(asm));
                _wowHook.Memory.FreeMemory(codeCave);
    
                return varResult;
            }
    I know there are different methods, and this one is prone to UI taint, but I'd really like to be able to get this too work.


    Thanks
    Last edited by Creepwalker; 03-28-2013 at 03:18 AM.

    GetLocalizedText Problem
  2. #2
    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)
    string varResult = Encoding.ASCII.GetString(_wowHook.InjectAndExecute(asm));

    This is wrong, GetLocalizedText return a pointer to a string, so you need to read it from here.

  3. #3
    Jadd's Avatar 🐸 Premium Seller
    Reputation
    1515
    Join Date
    May 2008
    Posts
    2,433
    Thanks G/R
    81/336
    Trade Feedback
    1 (100%)
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    You should also use FrameScript_GetText, it's faster and works without relying on an active player pointer (ie. can be used out of game).

    Try this:

    Code:
                String[] asm = new String[]
                {
                    "push 0",
                    "push -1",
                    "mov edx, " + codeCave,
                    "push edx",
                    "call " + (Offsets.lua.FrameScript_GetText + _wowHook.Process.BaseOffset()) ,
                    "add esp, 0Ch",
                    "retn"
                };
    Also, what JuJuBoSc said - the string is located at the address in the return value. You need to read it from there.

    Btw, your code has a huge memory leak and is slow. I would also suggest that you install the execution assembly once and reuse it with each time it needs to run GetText.

  4. #4
    Creepwalker's Avatar Active Member
    Reputation
    39
    Join Date
    Oct 2008
    Posts
    202
    Thanks G/R
    19/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by JuJuBoSc View Post
    string varResult = Encoding.ASCII.GetString(_wowHook.InjectAndExecute(asm));

    This is wrong, GetLocalizedText return a pointer to a string, so you need to read it from here.
    Ahh, thank you for spotting that!







    Originally Posted by Jadd View Post
    You should also use FrameScript_GetText, it's faster and works without relying on an active player pointer (ie. can be used out of game).

    Try this:

    Code:
                String[] asm = new String[]
                {
                    "push 0",
                    "push -1",
                    "mov edx, " + codeCave,
                    "push edx",
                    "call " + (Offsets.lua.FrameScript_GetText + _wowHook.Process.BaseOffset()) ,
                    "add esp, 0Ch",
                    "retn"
                };
    Also, what JuJuBoSc said - the string is located at the address in the return value. You need to read it from there.

    Btw, your code has a huge memory leak and is slow. I would also suggest that you install the execution assembly once and reuse it with each time it needs to run GetText.
    Can you elaborate on the memory leak please?

  5. #5
    Jadd's Avatar 🐸 Premium Seller
    Reputation
    1515
    Join Date
    May 2008
    Posts
    2,433
    Thanks G/R
    81/336
    Trade Feedback
    1 (100%)
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Creepwalker View Post
    Can you elaborate on the memory leak please?
    You're not freeing the memory which was allocated for the execution assembly.. and this happens every time you call your GetLocalizedText function. Like I said, you should install the assembly once and reuse it, this would take care of this problem and would be much faster than injecting and freeing the code every time.

Similar Threads

  1. GetLocalizedText Problem
    By redcatH in forum WoW Memory Editing
    Replies: 8
    Last Post: 10-07-2013, 05:31 AM
  2. realm list problem
    By robtuner in forum World of Warcraft General
    Replies: 2
    Last Post: 07-21-2006, 09:08 AM
  3. I have problem with BHW 3.0
    By sunrize1 in forum World of Warcraft General
    Replies: 1
    Last Post: 07-17-2006, 08:49 AM
  4. wow emu problem
    By bezike in forum World of Warcraft General
    Replies: 0
    Last Post: 07-09-2006, 04:45 PM
  5. Site problems
    By Shanaar in forum Community Chat
    Replies: 10
    Last Post: 05-14-2006, 01:15 AM
All times are GMT -5. The time now is 06:38 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