Results 1 to 6 of 6
  1. #1
    carolzinha's Avatar
    Join Date
    Jun 2019
    Gender
    male
    Posts
    3
    Reputation
    10
    Thanks
    0

    Lightbulb How to return pointer value obtained in IDA

    Hello everyone, I'm having a problem developing my program.

    I have an IDA pointer, this pointer is a struct that returns me values ​​such as size, hp, energy, ...

    but trying to pull this value is not returning the correct value.

    IDA Pointer:

    Code:
    .data:00B1C4E5 ; CPlayer *player
    .data:00B1C4E5 player      dd ?
    .data:00B1C4E5
    Header Code:

    Code:
    class PlayerHK : public Player {
    public:
    	PlayerHK();
    
    	ULONG player_hp();
    	ULONG player_power();
    	ULONG player_hp2();
    	ULONG player_power2();
    
    private:
    
    	struct CPlayer
    	{
    		BYTE padding[0x20];
    		ULONG hp;
    		ULONG power;
    	};
    	
    	CPlayer *player;
    };
    Code:

    Code:
    PlayerHK::PlayerHK() {
    
    	player = reinterpret_cast<CPlayer*>(*reinterpret_cast<DWORD*>(0x00B1C4E5));
    
    }
    
    ULONG PlayerHK::player_hp() {
    	return player->hp; //does not return the value
    }
    
    ULONG PlayerHK::player_power() {
    	return player->power; //does not return the value
    }
    
    ULONG PlayerHK::player_hp2() {
    	return *(ULONG*)(*(DWORD*)(0x00B1C4E5) + 0x20); //returns the value
    }
    
    ULONG PlayerHK::player_power2() {
    	return *(ULONG*)(*(DWORD*)(0x00B1C4E5) + 0x24); //returns the value
    }
    when I am using player_hp or player_power the value is not returned, I believe it is something in my player pointer, because when I use player_hp2 or player_power2 the value is returning correctly. But I want to use structures instead of maintaining the second form, does anyone know what's wrong?
    Last edited by carolzinha; 06-18-2019 at 03:42 PM.

  2. #2
    MikeRohsoft's Avatar
    Join Date
    May 2013
    Gender
    male
    Location
    Los Santos
    Posts
    797
    Reputation
    593
    Thanks
    26,314
    i think seems will be wrong then:
    Code:
    player = reinterpret_cast<CPlayer*>(*reinterpret_cast<DWORD*>(0x00B1C4E5));
    did u tried with out cast?
    Code:
    player = reinterpret_cast<CPlayer*>(reinterpret_cast<DWORD*>(0x00B1C4E5));

  3. #3
    carolzinha's Avatar
    Join Date
    Jun 2019
    Gender
    male
    Posts
    3
    Reputation
    10
    Thanks
    0
    Quote Originally Posted by MikeRohsoft View Post
    i think seems will be wrong then:
    Code:
    player = reinterpret_cast<CPlayer*>(*reinterpret_cast<DWORD*>(0x00B1C4E5));
    did u tried with out cast?
    Code:
    player = reinterpret_cast<CPlayer*>(reinterpret_cast<DWORD*>(0x00B1C4E5));
    yes I tried to use it that way too, but it returns the wrong value.

  4. #4
    MikeRohsoft's Avatar
    Join Date
    May 2013
    Gender
    male
    Location
    Los Santos
    Posts
    797
    Reputation
    593
    Thanks
    26,314
    lol ofc, because it will replace the memory region xD
    you have to make your methods private and the struct public

  5. #5
    carolzinha's Avatar
    Join Date
    Jun 2019
    Gender
    male
    Posts
    3
    Reputation
    10
    Thanks
    0
    Quote Originally Posted by MikeRohsoft View Post
    lol ofc, because it will replace the memory region xD
    you have to make your methods private and the struct public
    Do you say to do this?

    Code:
    class PlayerHK : public Player {
    public:
    	PlayerHK();
    
    	struct CPlayer
    	{
    		BYTE padding[0x20];
    		ULONG hp;
    		ULONG power;
    	};
    	
    	CPlayer *player;
    };
    
    private:
    
    	ULONG player_hp();
    	ULONG player_power();
    	ULONG player_hp2();
    	ULONG player_power2();
    
    };
    Even changing does not return the value
    Last edited by carolzinha; 06-18-2019 at 03:45 PM.

  6. #6
    TrackHawk's Avatar
    Join Date
    Mar 2020
    Gender
    female
    Posts
    12
    Reputation
    10
    Thanks
    0
    Ohh, thanks guys) u r amazing

Similar Threads

  1. [Help Request] How to change the pointer value in onlinegames?
    By ITALIboy in forum Combat Arms Coding Help & Discussion
    Replies: 13
    Last Post: 08-09-2013, 04:57 PM
  2. [Help] How to get the value of the address, a pointer is pointing at? [Solved]
    By Arnibold in forum C++/C Programming
    Replies: 12
    Last Post: 09-05-2011, 02:23 AM
  3. How To Find Pointers For Addresses In Cheat Engine 5.5
    By Ragehax in forum Combat Arms Help
    Replies: 3
    Last Post: 09-19-2009, 09:11 AM
  4. how to get the value for >>>>?
    By premo85 in forum Programming Tutorial Requests
    Replies: 2
    Last Post: 05-29-2009, 11:44 AM
  5. how to add pointers
    By ragman1234 in forum WarRock - International Hacks
    Replies: 1
    Last Post: 04-15-2007, 09:51 AM