Easily Generate Layers Projects on Windows

This Windows tool by XDA Recognized Contributorbunchiescreates a Layers projectready to be … more

Xiaomi Releases the Kernel Code for Redmi Note LTE

Xiaomi is not well known for being GPL compliant. A nice step towards changing this … more

ITaaS – Identity Theft as a Service with FileThis

It’s not often I look at a product or service and say “I really really … more

Watch Dogs Theme for Rooted Z3

If you’ve got a rooted Z3 and are jealous of all the awesome CM12 themes popping out left and right, … more

Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

Help FindHookMethod

OP riskey95

20th August 2014, 10:54 AM   |  #1  
riskey95's Avatar
OP Member
Flag Trenggalek
Thanks Meter: 105
 
91 posts
Join Date:Joined: Mar 2013
More
to the point How to findAndHookMethod this method:
Code:
public static ujiCoba(String[] string) {
}
i've tried with code bellow, but didnt work
Code:
findAndHookMethod(findClass, classLoader, String.class, hook);
20th August 2014, 12:21 PM   |  #2  
GermainZ's Avatar
Forum Moderator / Recognized Developer / XDA Portal Team
Thanks Meter: 7,531
 
6,052 posts
Join Date:Joined: Aug 2012
More
You're not passing the method's name to findAndHookMethod. Also, the argument's class should be String[].class.
20th August 2014, 01:50 PM   |  #3  
riskey95's Avatar
OP Member
Flag Trenggalek
Thanks Meter: 105
 
91 posts
Join Date:Joined: Mar 2013
More
Quote:
Originally Posted by GermainZ

You're not passing the method's name to findAndHookMethod. Also, the argument's class should be String[].class.

i'm typo.
its work
20th August 2014, 03:07 PM   |  #4  
riskey95's Avatar
OP Member
Flag Trenggalek
Thanks Meter: 105
 
91 posts
Join Date:Joined: Mar 2013
More
hi @GermainZ. last qustion..
Code:
private static void getDetail(Context context, long l1, Info info, int i, long l2) {
Cursor cursor = SqliteWrapper.query(context, context.getContentResolver(), Uri.parser(Prefs.PARSER), new String[] {"status","sent","date"}, "group_id=", l1, null, null);
}
method like that make me confuse. i want change sent to received, how can i do this?
Last edited by riskey95; 20th August 2014 at 03:11 PM.
20th August 2014, 03:19 PM   |  #5  
GermainZ's Avatar
Forum Moderator / Recognized Developer / XDA Portal Team
Thanks Meter: 7,531
 
6,052 posts
Join Date:Joined: Aug 2012
More
Quote:
Originally Posted by riskey95

hi @GermainZ. last qustion..

Code:
private static void getDetail(Context context, long l1, Info info, int i, long l2) {
Cursor cursor = SqliteWrapper.query(context, context.getContentResolver(), Uri.parser(Prefs.PARSER), new String[] {"status","sent","date"}, "group_id=", l1, null, null);
}
method like that make me confuse. i want change sent to received, how can i do this?

You can replace the method and replicate these two lines, doing whatever modifications you want.

See:
XC_MethodReplacement to replace the method,
findClass to get the SqliteWrapper class,
callStaticMethod to call SqliteWrapper.query.
The rest should be covered in the development tutorial/wiki.
20th August 2014, 03:27 PM   |  #6  
riskey95's Avatar
OP Member
Flag Trenggalek
Thanks Meter: 105
 
91 posts
Join Date:Joined: Mar 2013
More
Quote:
Originally Posted by GermainZ

You can replace the method and replicate these two lines, doing whatever modifications you want.

See:
XC_MethodReplacement to replace the method,
findClass to get the SqliteWrapper class,
callStaticMethod to call SqliteWrapper.query.
The rest should be covered in the development tutorial/wiki.

that method very long and i dont have full of source code. so i can't replace method.
20th August 2014, 03:39 PM   |  #7  
GermainZ's Avatar
Forum Moderator / Recognized Developer / XDA Portal Team
Thanks Meter: 7,531
 
6,052 posts
Join Date:Joined: Aug 2012
More
Quote:
Originally Posted by riskey95

that method very long and i dont have full of source code. so i can't replace method.

Next best thing I can think of:
  1. in beforeHookedMethod for getDetail, hook SqliteWrapper.query.
  2. In that hook, check if the third argument is equal to the string array you want. If so, change it.
  3. In afterHookedMethod for getDetail, unhook SqliteWrapper.query.

Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes