Reading position xyz and character data, seeking to learn more menu

User Tag List

Results 1 to 14 of 14
  1. #1
    CaptainCode's Avatar Member
    Reputation
    8
    Join Date
    May 2021
    Posts
    22
    Thanks G/R
    6/2
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Reading position xyz and character data, seeking to learn more

    Hello guys, I'm new here. I've made fishing bots and pixel bots in the past, but recently I started looking at memory reading.

    I'm using C++ with ReadProcessMemory -- I started by trying to find my character's position and health.

    Here is what I've done so far; all feedback welcome:
    1. Look at current max health, call it H1, scan entire process memory (Using VirtualQueryEx and ReadProcessMemory ), look for any 32-bit regions that match this value.
    2. Change health (by swapping out gear) to H2, and then scan all locations that used to be H1, see where it has become H2. This gave me addresses for current health and max health.
    3. Look at character position using UnitPosition call ingame, try to find, near the location found in #2 , a consecutive pair of floats that are close enough to this value.

    I successfully managed to do this, and I can see live coordinates & health in my separate program.

    (What I found interesting is that the address doesn't seem to change when I log out and change character! This seems odd to me, I'd imagine when you log out the memory associated with the character is freed and then logging in would reallocate, probably in a totally random part of memory. It doesn't seem to be the case, however.)

    Here are my questions:
    1. The memory addresses I find seem to be absolute values, but looking around the forum, people seem to specify constant "offset" values for where certain variables are. Is there a trick I'm missing here?
    2. I have to restart the search process (search, change gear, search again..) every time the game restarts.. is there a better way to find these values?
    3. I'm basically operating blind, accessing raw memory and tweaking it, looking for patterns, etc. Looking around, it seems people have more in-depth information about the data structures, objects, etc. in the memory. Is there something missing from my toolkit?

    Any other feedback welcome.
    Last edited by CaptainCode; 05-27-2021 at 02:03 PM.

    Reading position xyz and character data, seeking to learn more
  2. #2
    oiramario's Avatar Established Member
    Reputation
    85
    Join Date
    Mar 2021
    Posts
    133
    Thanks G/R
    36/51
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can get all the Magic Secrets in this forum by searching.

  3. #3
    CaptainCode's Avatar Member
    Reputation
    8
    Join Date
    May 2021
    Posts
    22
    Thanks G/R
    6/2
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by oiramario View Post
    You can get all the Magic Secrets in this forum by searching.
    Search for what ? I didn't ask for magic secrets, just wanted to know if there was another way to do things other than what I did.

  4. #4
    oiramario's Avatar Established Member
    Reputation
    85
    Join Date
    Mar 2021
    Posts
    133
    Thanks G/R
    36/51
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  5. #5
    CaptainCode's Avatar Member
    Reputation
    8
    Join Date
    May 2021
    Posts
    22
    Thanks G/R
    6/2
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by oiramario View Post
    Thank you for the link, but it is clearly (and intentionally) off-topic.

  6. #6
    xalcon's Avatar Contributor ふたなり
    Authenticator enabled
    Reputation
    198
    Join Date
    Oct 2008
    Posts
    291
    Thanks G/R
    20/58
    Trade Feedback
    0 (0%)
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    What answer do you expect? All of these things have been answered in the past, you are asking basic questions about how object oriented language work on memory level.

    Originally Posted by CaptainCode View Post
    (What I found interesting is that the address doesn't seem to change when I log out and change character! This seems odd to me, I'd imagine when you log out the memory associated with the character is freed and then logging in would reallocate, probably in a totally random part of memory. It doesn't seem to be the case, however.)
    This expected behavior. Just because memory gets freed, doesn't mean it gets zeroed/reset. If you would've dabbled in basic c programming, you would know that you need to zero memory before using something since it can contain garbage from earlier allocations or even the default 0xCC interrupt. It's totally expected to still see the old HP values when changing characters, the allocator just didn't reuse that memory yet.

    Originally Posted by CaptainCode View Post
    1. The memory addresses I find seem to be absolute values, but looking around the forum, people seem to specify constant "offset" values for where certain variables are. Is there a trick I'm missing here?
    Basic memory stuff. WoW is designed with an object oriented language and they utilize member variables to store stuff. If you find an offset, you will need the object instance (base address) and then add the offset to that address to get to the value in question.
    Originally Posted by CaptainCode View Post
    2. I have to restart the search process (search, change gear, search again..) every time the game restarts.. is there a better way to find these values?
    Of course there is a better way, just find out how wow stores things. A lot of stuff is accessible through one or more static variables. Ingame objects for example are stored in the object manager in a linked list. Just find the address of the object manager (either by static analysis or via pattern scanning or whatever other technique there is) and iterate the list. There are dozens of threads that talk about iterating through the object manager, out of process as well as in process.
    Originally Posted by CaptainCode View Post
    3. I'm basically operating blind, accessing raw memory and tweaking it, looking for patterns, etc. Looking around, it seems people have more in-depth information about the data structures, objects, etc. in the memory. Is there something missing from my toolkit?
    Sounds like you are missing a disassembler. Most people here use IDA, I've tried Ghidra in the past but never managed to get it working with the shadowlands client (If anyone has more info on how to get ghidra working with wow, let me know). IDA 7 Free is enough to get going, no need to shell out thousands of dollars for the hex rays decompiler.

    Generally, I feel like you are missing the absolute basics. Start with a simpler project. Here are some things I've done (not in order)
    • Read a book (or ten) on reverse engineering. Heck, there are a million guides on youtube
    • Create your own C++ Application with Classes that prints out member variables in a loop, then hack it.
    • Read through older posts in this forum
    • Learn x86/x86_64 ASM
    • hack a simple game
    "Threads should always commit suicide - they should never be murdered" - DirectX SDK

  7. Thanks CaptainCode (1 members gave Thanks to xalcon for this useful post)
  8. #7
    CaptainCode's Avatar Member
    Reputation
    8
    Join Date
    May 2021
    Posts
    22
    Thanks G/R
    6/2
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you xalcon for your in-depth response.

    Originally Posted by xalcon View Post
    This expected behavior. Just because memory gets freed, doesn't mean it gets zeroed/reset. If you would've dabbled in basic c programming, you would know that you need to zero memory before using something since it can contain garbage from earlier allocations or even the default 0xCC interrupt. It's totally expected to still see the old HP values when changing characters, the allocator just didn't reuse that memory yet.
    No, I'm saying something different. I'm saying that even when you log into a new character, the player data is in the exact same memory location. This is not expected behavior at all, if the memory is freed and reallocated it would be a very happy coincidence if newly allocated memory is in the exact same place.

    Basic memory stuff. WoW is designed with an object oriented language and they utilize member variables to store stuff. If you find an offset, you will need the object instance (base address) and then add the offset to that address to get to the value in question.
    Of course there is a better way, just find out how wow stores things. A lot of stuff is accessible through one or more static variables. Ingame objects for example are stored in the object manager in a linked list. Just find the address of the object manager (either by static analysis or via pattern scanning or whatever other technique there is) and iterate the list. There are dozens of threads that talk about iterating through the object manager, out of process as well as in process.
    Thanks, yes, I've spent a few hours reading and I'm working on how to access the object manager from static memory.

    Sounds like you are missing a disassembler. Most people here use IDA, I've tried Ghidra in the past but never managed to get it working with the shadowlands client (If anyone has more info on how to get ghidra working with wow, let me know). IDA 7 Free is enough to get going, no need to shell out thousands of dollars for the hex rays decompiler.
    Am I understanding correctly, that the purpose of disassembling is to reverse engineer basic functions, so that by seeing how the code operates on memory, we deduce the memory locations and what is in the memory?

    Are you just attaching a disassembler to the wow.exe file?
    Last edited by CaptainCode; 05-28-2021 at 04:49 PM.

  9. #8
    karnkore's Avatar Member
    Reputation
    7
    Join Date
    Sep 2012
    Posts
    130
    Thanks G/R
    1/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You need to correctly dump wow to open it in ida, you cant just attach a dissasembler as they use anti-debug stuff. Your best bet is to use someone elses posted offsets and write patterns/ida scripts for them so you can find them yourself when a patch happens. WoW is not a noob friendly game to hack dude, they have all sorts of defense like crc checks and checks for open handles. I started as a newb on WoW 1.12.1 private server and wrote a waypoint bot, you can have it fully external using only reads and you get to learn juicy stuff like how the object manager works and how to rotate a character based on heading.

  10. Thanks CaptainCode (1 members gave Thanks to karnkore for this useful post)
  11. #9
    xalcon's Avatar Contributor ふたなり
    Authenticator enabled
    Reputation
    198
    Join Date
    Oct 2008
    Posts
    291
    Thanks G/R
    20/58
    Trade Feedback
    0 (0%)
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by CaptainCode View Post
    No, I'm saying something different. I'm saying that even when you log into a new character, the player data is in the exact same memory location. This is not expected behavior at all, if the memory is freed and reallocated it would be a very happy coincidence if newly allocated memory is in the exact same place.
    I don't have a full understanding of how wow handles allocation and deallocation of objects but this sounds like they use an allocator specific to objects in the object manager. An Object pool would probably show similar behavior. But that doesn't really matter, you shouldn't rely on objects staying in the same location in memory across relogs.

    Originally Posted by CaptainCode View Post
    Am I understanding correctly, that the purpose of disassembling is to reverse engineer basic functions, so that by seeing how the code operates on memory, we deduce the memory locations and what is in the memory?

    Are you just attaching a disassembler to the wow.exe file?
    It's not just basic functions, even complex stuff. A lot of us still use older versions of the games binaries that were linked with debug information enabled, which gives a lot of insight into the inner workings.
    But like karnkore said, you will need to dump the wow process since we can't just attach a debugger to wow without deafeating their debugging protection.
    "Threads should always commit suicide - they should never be murdered" - DirectX SDK

  12. Thanks CaptainCode (1 members gave Thanks to xalcon for this useful post)
  13. #10
    CaptainCode's Avatar Member
    Reputation
    8
    Join Date
    May 2021
    Posts
    22
    Thanks G/R
    6/2
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by karnkore View Post
    You need to correctly dump wow to open it in ida, you cant just attach a dissasembler as they use anti-debug stuff. Your best bet is to use someone elses posted offsets and write patterns/ida scripts for them so you can find them yourself when a patch happens. WoW is not a noob friendly game to hack dude, they have all sorts of defense like crc checks and checks for open handles. I started as a newb on WoW 1.12.1 private server and wrote a waypoint bot, you can have it fully external using only reads and you get to learn juicy stuff like how the object manager works and how to rotate a character based on heading.
    Thanks for your response. Is my understanding correct that wow packs the code inside wow.exe, and at runtime decodes the real game code into memory, which is what we have to read somehow?

    I don't plan on writing memory so the crc checks don't bother me, I am happy to just send mouse and keystrokes -- my fishing bot has been running 20 hours a day for the last month without issues.

    Regarding open handles, I'm guessing that you mean the process handle used by ReadProcessMemory? There is no way around this, is there?

  14. #11
    scimmy's Avatar Active Member
    Reputation
    52
    Join Date
    Jul 2020
    Posts
    54
    Thanks G/R
    1/33
    Trade Feedback
    0 (0%)
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by CaptainCode View Post
    Thanks for your response. Is my understanding correct that wow packs the code inside wow.exe, and at runtime decodes the real game code into memory, which is what we have to read somehow?

    I don't plan on writing memory so the crc checks don't bother me, I am happy to just send mouse and keystrokes -- my fishing bot has been running 20 hours a day for the last month without issues.

    Regarding open handles, I'm guessing that you mean the process handle used by ReadProcessMemory? There is no way around this, is there?
    Packing an executable is basically just running some type of algorithm through the code or data sections of the PE file. It also generally changes the entrypoint of the executable to some type of decompression/decryption routine so the "real" code and data can be mapped into memory properly.

    I'm not sure if they look for open handles. Does NtQuerySystemInformation have a class that provides this info from usermode? I was under the impression that you'd have to iterate the handle table from the kernel structures to find out which processes have open handles to other processes. Regardless, there are ways to use readprocessmemory without having to open a handle such as hijacking an already opened handle from system processes such as svchost or lsass. Or you can go down the kernel driver route and implement your own readprocessmemory without using the windows API.

  15. #12
    Hazzbazzy's Avatar wannabe hackerlol Authenticator enabled
    Reputation
    1335
    Join Date
    Aug 2011
    Posts
    1,206
    Thanks G/R
    243/484
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by scimmy View Post
    Packing an executable is basically just running some type of algorithm through the code or data sections of the PE file. It also generally changes the entrypoint of the executable to some type of decompression/decryption routine so the "real" code and data can be mapped into memory properly.

    I'm not sure if they look for open handles. Does NtQuerySystemInformation have a class that provides this info from usermode? I was under the impression that you'd have to iterate the handle table from the kernel structures to find out which processes have open handles to other processes. Regardless, there are ways to use readprocessmemory without having to open a handle such as hijacking an already opened handle from system processes such as svchost or lsass. Or you can go down the kernel driver route and implement your own readprocessmemory without using the windows API.
    To answer part of your question, yes there is a clas that allows for handle enumeration through user mode. If you're interested, do a search for SYSTEM_HANDLE_INFORMATION.
    Last edited by Hazzbazzy; 05-29-2021 at 08:31 AM.
    "HOLY TIME MACHINE BATMAN! it's 1973!"
    https://youtube.com/Hazzbazzy

  16. #13
    xalcon's Avatar Contributor ふたなり
    Authenticator enabled
    Reputation
    198
    Join Date
    Oct 2008
    Posts
    291
    Thanks G/R
    20/58
    Trade Feedback
    0 (0%)
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by CaptainCode View Post
    Regarding open handles, I'm guessing that you mean the process handle used by ReadProcessMemory? There is no way around this, is there?
    Ofc there are ways around those open handles. Having an open handle to a process in general isn't going to be a problem. A lot of legitimate applications have open handles to other processes, heck even injection of libraries is a legitimate use case. Discord for example injects a library into game processes in order to render its overlay. But if you want to be really stealthy about it, you will need to move to a kernel driver which is a completly different can of worms.

    everything can be circumvented as long as you are the owner of the hardware running the software. It's just a matter of how complex its going to be - and if it is worth it circumventing the measures put in place.
    "Threads should always commit suicide - they should never be murdered" - DirectX SDK

  17. #14
    moisteroyster's Avatar Member
    Reputation
    1
    Join Date
    Apr 2022
    Posts
    3
    Thanks G/R
    16/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I’m currently on a mission to find the same answers.

Similar Threads

  1. [Trinity] Wanting to learn more about my 3.3.5 Trinity Core Private Server
    By jakeyup in forum WoW EMU Guides & Tutorials
    Replies: 2
    Last Post: 06-02-2017, 06:52 PM
  2. Replies: 4
    Last Post: 03-18-2014, 09:12 AM
  3. Tool to copy item's and character's stats as text and traslate from RU
    By orby_tale in forum Diablo 3 Bots and Programs
    Replies: 3
    Last Post: 09-27-2012, 04:59 AM
  4. [Mangos] Transfer accounts and character from mangos 3.2.2 to 3.3.3a?
    By Hjustin2 in forum WoW EMU Questions & Requests
    Replies: 0
    Last Post: 05-21-2010, 12:06 PM
  5. Replies: 1
    Last Post: 07-23-2009, 01:17 PM
All times are GMT -5. The time now is 11:19 AM. 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