Float memory reading problem menu

User Tag List

Results 1 to 9 of 9
  1. #1
    Lynie's Avatar Contributor
    Reputation
    87
    Join Date
    Mar 2008
    Posts
    74
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Float memory reading problem

    Greetings,

    I'm trying to create the very beginning of a bot. That is just reading the X, Y, Z coördinates of the player. This is what I have at the moment:
    Player.h
    Code:
    #define MEM_ADDR_PLAYERBASE_PTR 0x0127F13C
    #define MEM_ADDR_PLAYERBASE_PTR_OFFSET1 0x30
    #define MEM_ADDR_PLAYERBASE_PTR_OFFSET2 0x28
    
    #define MEM_ADDR_PLAYERBASE_HEALTH_OFFSET 0x0
    #define MEM_ADDR_PLAYERBASE_MANA_OFFSET 0x0
    #define MEM_ADDR_PLAYERBASE_X_OFFSET 0x7D0
    #define MEM_ADDR_PLAYERBASE_Y_OFFSET 0x7D4
    #define MEM_ADDR_PLAYERBASE_Z_OFFSET 0x7D8
    #define MEM_ADDR_PLAYERBASE_ROTATION_OFFSET 0x7E2
    
    #define MEM_ADDR_PLAYERNAME_OFFSET 0x011CB348
    
    
    //0127F13C
    // + 30
    // + 28
    //= PlayerBase
    
    //x = PlayerBase + 7D0
    //y = PlayerBase + 7D4
    //z = PlayerBase + 7D8
    //rot = PlayerBase + 7E2
    
    class Player
    {
    	HANDLE hProcess;
    	
    	int mana;
    	int health;
    
    	float posX;
    	float posY;
    	float posZ;
    	float rotation;
    
    public:
    	int getMana();
    	int getHealth();
    
    	float getX();
    	float getY();
    	float getZ();
    	float getRotation();
    
    	void Rotate(float degrees);
    	void Move(float x, float y);
    	void Update();
    
    	unsigned int baseAddress;
    
    	Player(HANDLE hProcess);
    	~Player();
    };
    Player.cpp
    Code:
    #include "stdafx.h"
    
    Player::Player(HANDLE hProcess)
    {
    	unsigned int base_ptr1, base_ptr2, base;
    	this->hProcess = hProcess;
    	ReadProcessMemory(hProcess, (LPCVOID)(MEM_ADDR_PLAYERBASE_PTR), (LPVOID)&base_ptr1, sizeof(unsigned int), 0);
    	ReadProcessMemory(hProcess, (LPCVOID)(base_ptr1 + MEM_ADDR_PLAYERBASE_PTR_OFFSET1), (LPVOID)&base_ptr2, sizeof(unsigned int), 0);
    	ReadProcessMemory(hProcess, (LPCVOID)(base_ptr2 + MEM_ADDR_PLAYERBASE_PTR_OFFSET2), (LPVOID)&(this->baseAddress), sizeof(unsigned int), 0);
    	
    }
    
    Player::~Player()
    {
    }
    
    int Player::getMana()
    {
    	return this->mana;
    }
    
    int Player::getHealth()
    {
    	return this->health;
    }
    
    float Player::getX()
    {
    	return this->posX;
    }
    
    float Player::getY()
    {
    	return this->posY;
    }
    
    float Player::getZ()
    {
    	return this->posZ;
    }
    
    float Player::getRotation()
    {
    	return this->rotation;
    }
    
    void Player::Rotate(float degrees)
    {
    }
    
    void Player::Move(float x, float y)
    {
    }
    
    void Player::Update()
    {
    	ReadProcessMemory(hProcess, (LPCVOID)(this->baseAddress + MEM_ADDR_PLAYERBASE_X_OFFSET), (LPVOID)&(this->posX), sizeof(float), 0);
    	ReadProcessMemory(hProcess, (LPCVOID)(this->baseAddress + MEM_ADDR_PLAYERBASE_Y_OFFSET), (LPVOID)&(this->posY), sizeof(float), 0);
    	ReadProcessMemory(hProcess, (LPCVOID)(this->baseAddress + MEM_ADDR_PLAYERBASE_Z_OFFSET), (LPVOID)&(this->posZ), sizeof(float), 0);
    }
    And the generated UI.
    In the UI I allocate some memory for the class player when the form loads, then I use the Update() function and set the text of textbox1 to the X position of the player using the getX() function
    Code:
    				 pPlayer = new Player(hProcess);
    				 pPlayer->Update();
    				 this->textBox1->Text = pPlayer->getX().ToString();
    				 this->textBox2->Text = pPlayer->getY().ToString();
    				 this->textBox3->Text = pPlayer->getZ().ToString();
    But when I try this it always says -4,316021E+08 in the textbox and I don't why.

    NOTE: I'm using 3.0.9

    Could anyone help me fix this?

    Thanks

    Float memory reading problem
  2. #2
    SKU's Avatar Contributor
    Reputation
    306
    Join Date
    May 2007
    Posts
    565
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I haven't looked at the code but many (all?) of your addresses are outdated assuming 3.1.2

  3. #3
    Lynie's Avatar Contributor
    Reputation
    87
    Join Date
    Mar 2008
    Posts
    74
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by SKU View Post
    I haven't looked at the code but many (all?) of your addresses are outdated assuming 3.1.2
    Thanks for the fast reply, I'm using 3.0.9 addresses at the moment but I also still have a 3.0.9 client for private servers.

  4. #4
    Cypher's Avatar Kynox's Sister's Pimp
    Reputation
    1358
    Join Date
    Apr 2006
    Posts
    5,368
    Thanks G/R
    0/6
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Managed C++ makes baby jesus cry.

  5. #5
    0_00_0's Avatar Member
    Reputation
    1
    Join Date
    Jun 2007
    Posts
    39
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    use GetLastError(). It will help us a lot more! If there is no errors then you need to check your addresses, obviously. Its been too long since I've looked at 3.0.9.

  6. #6
    amadmonk's Avatar Active Member
    Reputation
    124
    Join Date
    Apr 2008
    Posts
    772
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    But when I try this it always says -4,316021E+08 in the textbox and I don't why.
    Assuming this isn't an uninitialized value, I'd say you're reading the float just fine. You're just reading the wrong float.

  7. #7
    amadmonk's Avatar Active Member
    Reputation
    124
    Join Date
    Apr 2008
    Posts
    772
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Cypher View Post
    Managed C++ makes baby jesus cry.
    What, you don't care for code that has all of the limitations and flaws of C++ as well as all the limitations and strictures of the CLR, along with its own unique set of syntactical quirks and oddness? What's WRONG with you?

    In all seriousness, I've actually used MC++ for a couple of times where I didn't really want to write a native DLL just to do a function or two. But every time, I have to go re-look up the syntax, and every time I use it, I feel a little dirty. I just can't figure out whether I feel like I'm betraying C++, or betraying .Net...

    I think I'll stick with Python for a while. That way nobody's gotta respect anybody in the morning.

  8. #8
    Cypher's Avatar Kynox's Sister's Pimp
    Reputation
    1358
    Join Date
    Apr 2006
    Posts
    5,368
    Thanks G/R
    0/6
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by amadmonk View Post
    What, you don't care for code that has all of the limitations and flaws of C++ as well as all the limitations and strictures of the CLR, along with its own unique set of syntactical quirks and oddness? What's WRONG with you?

    In all seriousness, I've actually used MC++ for a couple of times where I didn't really want to write a native DLL just to do a function or two. But every time, I have to go re-look up the syntax, and every time I use it, I feel a little dirty. I just can't figure out whether I feel like I'm betraying C++, or betraying .Net...

    I think I'll stick with Python for a while. That way nobody's gotta respect anybody in the morning.

    Rofl. Epic win.

  9. #9
    Lynie's Avatar Contributor
    Reputation
    87
    Join Date
    Mar 2008
    Posts
    74
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    K, I found out what I did wrong, I didn't set my debug privileges yet. All thanks for the help!
    Last edited by Lynie; 05-23-2009 at 06:34 AM.

Similar Threads

  1. [Autoit] Problem with Memory reading for looting *resolved*
    By spudstar99 in forum WoW Memory Editing
    Replies: 4
    Last Post: 05-15-2009, 10:26 PM
  2. White Paper : Memory reading
    By tttommeke in forum WoW Memory Editing
    Replies: 41
    Last Post: 06-19-2008, 02:30 AM
  3. VB .Net Memory Reading Project
    By Glitchy in forum WoW Memory Editing
    Replies: 4
    Last Post: 01-22-2008, 12:37 PM
  4. [AutoIT3] WoW Cordinator (X,Y,MapID and rotation memory reading)
    By Vladinator in forum World of Warcraft Bots and Programs
    Replies: 22
    Last Post: 05-15-2007, 03:26 AM
All times are GMT -5. The time now is 07:55 PM. 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