Help! How to hook static bool(string)

Code:
    // RVA: 0x135F8F4 Offset: 0x135F8F4 VA: 0x135F8F4
    public static bool JoinRoom(string RoomName) { }

As you can see, I'd like to hook this func, the bool represents whether you successfully entered a room,I have tried but it doesn't work.

This is my code:
Code:
bool JoinRoom;
bool (*old_JoinRoom)(monoString * Name);
bool OnJoinRoom(monoString * Name ) {
    if (JoinRoom) {
        old_JoinRoom(String_CreateString(get_StringInstance,RoomName));
        JoinRoom = false;
        return 1;
    }
    return old_JoinRoom(Name);
}

Code:
MSHookFunction((void *) getAbsoluteAddress("libil2cpp.so", 0x135F8F4), (void *) &OnJoinRoom, (void **) &old_JoinRoom);

Plz come to help me with this :( !
 
Back
Top Bottom