Jump to content

MSHookFunction can't hook an 8-byte function


Dababababa7777

3 posts in this topic

Recommended Posts

Posted

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.

×
  • Create New...

Important Information

We would like to place cookies on your device to help make this website better. The website cannot give you the best user experience without cookies. You can accept or decline our cookies. You may also adjust your cookie settings. Privacy Policy - Guidelines