Example #1
0
static OriginalMethodsIt findOriginalMethod(const Method* method) {
    if (method == NULL)
        return dexspyOriginalMethods.end();

    for (OriginalMethodsIt it = dexspyOriginalMethods.begin() ; it != dexspyOriginalMethods.end(); it++ ) {
        Method hookedMethod = *it;
        if (dvmCompareMethodNamesAndProtos(&hookedMethod, method) == 0 && strcmp(it->clazz->descriptor, method->clazz->descriptor) == 0) {
            return it;
        }
    }

    return dexspyOriginalMethods.end();
}
Example #2
0
/*
 * Add a method to "methArray" if a matching method does not already
 * exist.  Two methods match if they have the same name and signature.
 *
 * Returns "true" if the item was added, "false" if a duplicate was
 * found and the method was not added.
 */
static bool addMethod(Method* meth, Method** methArray, int slot)
{
    int i;

    for (i = 0; i < slot; i++) {
        if (dvmCompareMethodNamesAndProtos(methArray[i], meth) == 0) {
            return false;
        }
    }

    methArray[slot] = meth;
    return true;
}