Skip to content
Guest Big Announcement

MSHookFunction can't hook an 8-byte function

Featured Replies

I'm trying to hook a function called Actor::getPos in MinecraftBE.

However, that function is less than 8 bytes long, so I can't hook it with MSHookFunction.
What should I do?

Sample Code:

struct Vec3 {

	float x, y, z;
};

struct Actor {};

static Vec3& (*Actor_getPos)(Actor*);
static Vec3& _Actor_getPos(Actor* self) {

	return Actor_getPos(self);
}

%ctor {
  //If it doesn't, it will crash...
  MSHookFunction((void*)(0x10228c2b8 + _dyld_get_image_vmaddr_slide(0)), (void*)&_Actor_getPos, (void**)&Actor_getPos);
}

 

Archived

This topic is now archived and is closed to further replies.

Featured Content

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.