FORUMS
Remove All Ads from XDA

[Q] Can we hook class loaders?

478 posts
Thanks Meter: 613
 
By Xspeed, Senior Member on 25th September 2015, 11:06 PM
Post Reply Email Thread
Hello fellow devs!

I've got an idea for a module that involves reinstrumentation of classes at runtime and also preventing classes from being loaded too.
The problem is, I don't know where to start hooking. I don't really understand the way class loading works in Android.
I tried searching deep into the source code of the OS, found PathClassLoader, which resides in 'dalvik.system' package. I imagine it's not hookable...

So my question is:
Is what I'm trying to do even possible? Maybe I'm looking in the wrong place?

Also take note, modifying packages outside of memory is out of question here.
 
 
26th September 2015, 10:47 PM |#2  
Xspeed's Avatar
OP Senior Member
Thanks Meter: 613
 
Donate to Me
More
Guess I was wrong. I successfully hooked PathClassLoader's findClass method with no problems.

Now, how can I make my class respond to non-existent methods' calls? One solution would be to just hook all methods in the existing class, but I'd prefer something like this (link)...
10th October 2015, 05:17 PM |#3  
Senior Member
Thanks Meter: 2,379
 
Donate to Me
More
Yew, interesting idea. @rovo89?
Can we "create/redirect" methods/classes? Let's say app calls X method from Y class, but Y class is not available (e.g. GP Services), so can we redirect original Y class to our class and redirect original X method to our method from our class?
11th February 2019, 10:52 AM |#4  
Junior Member
Thanks Meter: 0
 
More
Xiaomi Poco F1 [ROM] [8.1.0] ResurrectionRemix v6.2.1


I installed xposed v90beta3, I can not start the module, it gives an error.
Help solve the problem

zygote64(3278): ClassLoaderContext size mismatch. expected=1, actual=2 (PCL[] | PCL[];PCL[/data/dalvik-cache/xposed_XResourcesSuperClass.dex*2802528989:/data/dalvik-cache/xposed_XTypedArraySuperClass.dex*708326108])
Post Reply Subscribe to Thread

Tags
class, instrumentation, loader, package, runtime

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes