Ejemplo n.º 1
0
    bool dexposedOnVmCreated(JNIEnv* env, const char*) {

        dexposed_class = env->FindClass(DEXPOSED_CLASS);
        dexposed_class = reinterpret_cast<jclass>(env->NewGlobalRef(dexposed_class));

        if (dexposed_class == NULL) {
            LOG(ERROR) << "dexposed: Error while loading Dexposed class " << DEXPOSED_CLASS;
            env->ExceptionClear();
            return false;
        }

        additionalhookinfo_class = env->FindClass(DEXPOSED_ADDITIONAL_CLASS);
        additionalhookinfo_class = reinterpret_cast<jclass>(env->NewGlobalRef(additionalhookinfo_class));
        if (additionalhookinfo_class == NULL) {
            LOG(ERROR) << "dexposed: Error while loading Dexposed class " << DEXPOSED_ADDITIONAL_CLASS;
            env->ExceptionClear();
            return false;
        }

        LOG(INFO) << "dexposed: now initializing, Found Dexposed class " << DEXPOSED_CLASS;
        if (register_com_taobao_android_dexposed_DexposedBridge(env) != JNI_OK) {
            LOG(ERROR) << "dexposed: Could not register natives for " << DEXPOSED_CLASS;
            env->ExceptionClear();
            return false;
        }

        return true;
    }
Ejemplo n.º 2
0
	bool dexposedOnVmCreated(JNIEnv* env, const char*) {

		dexposed_class = env->FindClass(DEXPOSED_CLASS);
		dexposed_class = reinterpret_cast<jclass>(env->NewGlobalRef(dexposed_class));

		if (dexposed_class == NULL) {
			LOG(ERROR) << "dexposed: Error while loading Dexposed class " << DEXPOSED_CLASS;
			env->ExceptionClear();
			return false;
		}

		LOG(INFO) << "dexposed: now initializing, Found Dexposed class " << DEXPOSED_CLASS;
		if (register_com_taobao_android_dexposed_DexposedBridge(env) != JNI_OK) {
			LOG(ERROR) << "dexposed: Could not register natives for " << DEXPOSED_CLASS;
			env->ExceptionClear();
			return false;
		}

		jmethodID dexposedbridgeMainMethod = env->GetStaticMethodID(dexposed_class,
				"main", "()V");
		if (dexposedbridgeMainMethod == NULL) {
			LOG(ERROR) << "dexposed: Could not find method " << DEXPOSED_CLASS << ".main()";
			env->ExceptionClear();
			return false;
		}
		env->CallStaticVoidMethod(dexposed_class, dexposedbridgeMainMethod);

		return true;
	}