Lab 19: Accessing __thiscall Objects
In this lab we want to overwrite a property of the __thiscall object. We will tackle this in a few simple steps.
-
Attach a hook to the non-exported
GetWalkingSpeedfunction pointerPrint the
WalkingSpeedfloat to the output area. What is the walking speed?
float __thiscall Player::GetWalkingSpeed(class Player* this)
{
return ((int32_t)((long double)this->m_walkingSpeed));
}-
Now, capture the address of the
thisobject by accessing the value ofECXinside your hook -
You now have the pointer to the object and the offset of the property inside the object (Binary Ninja)
Using the offset you can now read the
floatyourself inside the hookYou can also overwrite the
floatin memory. What happens when you do that?