1

I'm practicing hooking with xposed.

I know I use findAndHookConstructor to hook up constructors in xposed.

However, the following code could not be hooked with xposed.

String v1_1 = new String(v7, 0, v4); -> java.lang.String(int[], int, int)

Here is my xposed code:

....
        findAndHookConstructor("java.lang.String", lpparam.classLoader,int[].class, int.class, int.class, new XC_MethodHook() {
            @Override
            protected void beforeHookedMethod(MethodHookParam param) throws Throwable
            {
                Log.d(TAG,"[*] beforeHooked:");
                Log.d(TAG,"[*] String: " + param.getResult());
            }
            @Override
            protected void afterHookedMethod(MethodHookParam param) throws Throwable
            {
                Log.d(TAG,"[*] afterHooked:");
                Log.d(TAG,"[*] String: " + param.getResult());
            }
        });
....

The smali code is as follows. (String v1_1 = new String(v7, 0, v4))

...
invoke-direct {v1, v6, v0, v4}, Ljava/lang/String;-><init>([III)V
...

I'm really curious.

Where in my code is something wrong?

Raining2
  • 11
  • 2
  • According to https://stackoverflow.com/a/33808730/150978 you could try `new int[0].class` instead of `int[].class` – Robert Apr 26 '22 at 15:53
  • @Robert Hi Robert! thank you for the reply! Unfortunately, changing **int[].class** to **new int[0].class** does not work. – Raining2 Apr 26 '22 at 16:15

0 Answers0