UlyssesWu / XamarinPosed

Xposed module using Xamarin & C# 🐱‍💻
https://github.com/UlyssesWu/XamarinPosed.Core
MIT License
30 stars 4 forks source link

LSPosed? #3

Closed trungnt2910 closed 3 years ago

trungnt2910 commented 3 years ago

This application does not work on LSPosed or any other Riru-based XPosed.

Tried built everything in release mode, and deployed to my Android 11 device and turned on all modules.

UlyssesWu commented 3 years ago

I don't have a device with LSPosed for test. But maybe there is something wrong because of Android 11 rather than riru? I will see if I have to make some changes for android 11.

trungnt2910 commented 3 years ago

I think the problem is how LSposed loads the libraries. LSposed looks for the mono runtime libraries from /system/lib when loading the module, ignoring the runtime libraries from the apk.

On the first attempt, when I just follow the tutorial provided, the module gave an error about failing to load libmonosgen. attempt1.log

So the apparent solution is to copy all the libraries to /system/lib: However, mono says something about "Internal API library is required" which is not helpful.

attempt2.log

UlyssesWu commented 3 years ago

Yes I'm aware of that, the solution is simply to use the absolute lib path. If you're interested, you can also have a try to fix the java code UlyssesLoader.java while I'm also working on it.

trungnt2910 commented 3 years ago

I don't think so.

There is something deeper inside mono that this application is failing to handle.

After modifying the loader file, replacing all System.loadLibrary(libName) to System.load(absoluteLibPath), the application loads its libraries correctly, but the module fails just like attempt 2 ("Internal API library is required") and hangs.

Maybe we are missing something here?

trungnt2910 commented 3 years ago

Ok finally got those things running.

The fix is appending the architecture (in my case arm) to nativeLibraryPath.

UlyssesWu commented 3 years ago

So it's still something related to android version I guess. In an environment like VXP there is no arm folder in lib, just .so files. And I have pushed a fix which just find the architecture folder adaptively.

trungnt2910 commented 3 years ago

Great, latest commit fixed stuff.