Jump to content

MSHookFunction doesn't work


jux3z

13 posts in this topic

Recommended Posts

Posted

Hello everyone!

I'm trying to hack a game with Logos (MonkeyDev project).
So I have dump.cs with function offsets.
But when I try to

MSHookFunction((void *)getRealOffset(0xoffset), (void *)_replaceFunc, (void **)&origFunc) 

nothing happens (NSLog in _replaceFunc doesn't print something)
Offset is real, because writeData(0xoffset, data) works correctly.

iOS: 11.3.1
MonkeyDev Xcode project
substrate.h

Any ideas? ?

Posted
10 hours ago, Ted2 said:

The function you're hooking, are you actually returning something?

No, it's just Update function 
 

private void Update(); // 0x101A25EA4


So, code:
 

void (*Player_Update)(void *player);

void _Player_Update(void *player) {

    NSLog(@"Player UPDATE!"); // Just for test

    Player_Update(player);

}

%hook UnityAppController

- (void)applicationDidBecomeActive:(id)arg1

{
	NSLog(@"did become active"); // It works
    MSHookFunction((void *)(getRealOffset(0x101A25EA4)), (void *)_Player_Update, (void **)&Player_Update);

    %orig;
}

%end


P.S.: I tried to hook not only the Update function, but also many others. No effect

Posted
1 hour ago, Ted2 said:

What if you put that mshook outside the applicationdidbecomeactive??

 

%ctor {

Mshook.......

}

Thanks for the idea! But it also doesn't work :(

Posted
46 minutes ago, jux3z said:

Thanks for the idea! But it also doesn't work :(

Hmm weird. What if you put some silly if statement around it?

 

Also how do you get NSLog to see? I've wanted to get that to work too, but couldn't get it.

Posted

I use https://github.com/AloneMonkey/MonkeyDev Xcode project, so I can see all debug messages in debug console. 
 

48 minutes ago, Ted2 said:

Hmm weird. What if you put some silly if statement around it?

I think the problem may be in linking CydiaSubstrate framework.

There is

#import <substrate.h>

but it seems that this function (MSHookFunction) does nothing. 
 

Posted
2 minutes ago, jux3z said:

I would like to try to use symbols (MSFindSymbol), but there are no symbols in IDA
image.png

Then you can't use it. But again, you make a JB tweak or a NJB?

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