evelyneee / ellekit

yet another tweak injector / tweak hooking library for darwin systems

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MSHookMessageEx and Logos are not working

haniag opened this issue · comments

I am unable to have MSHookMessageEx and Logos hooking in a tweak. In this code, only "myTweak CTOR" is output in console.

Notes:

  • The tweak is built for X86_64 using TARGET = macosx::10.14 and ARCHS = x86_64.
  • Ellekit is built with most recent commit.
  • Using Ventura M2.
  • When I first ran the app, it crashed with error that it is missing "/Library/Frameworks/CydiaSubstrate.framework/CydiaSubstrate". So I created the folder and symlink "ellekit.dylib" to it as "CydiaSubstrate".
#include <Foundation/Foundation.h>
#include <substrate.h>


%group mytweak

%hook someClass

-(BOOL)someMethod{
    
    NSLog(@"myTweak 1:%d", %orig());
    return TRUE;
}

%end

//end group
%end


BOOL (*oldMethod)(id self, SEL _cmd);
BOOL newMethod(id self, SEL _cmd) {

    NSLog(@"myTweak 2:%d", oldMethod(self, _cmd));
    return TRUE;
}



%ctor {

    NSLog(@"myTweak CTOR");
    MSHookMessageEx(objc_getClass("someClass"), @selector(someMethod), (IMP)newMethod, (IMP *)&oldMethod);
    %init(mytweak);
}

Closing this since I discovered a typo in one of my classes. Hooking is working perfectly fine!