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?