// Allow this library to be used as a plugin too so we can test the stack. static jint GetEnvHandler([[maybe_unused]] JavaVMExt* vm, void** new_env, jint version) {
printf("%s called in test 900\n", __func__); if (version != TEST_900_ENV_VERSION_NUMBER) { return JNI_EVERSION;
}
printf("GetEnvHandler called with version 0x%x\n", version);
*new_env = reinterpret_cast<void*>(ENV_VALUE); return JNI_OK;
}
extern"C"bool ArtPlugin_Initialize() {
printf("%s called in test 900\n", __func__);
Runtime::Current()->GetJavaVM()->AddEnvironmentHook(GetEnvHandler); returntrue;
}
extern"C"bool ArtPlugin_Deinitialize() {
printf("%s called in test 900\n", __func__); returntrue;
}
extern"C" JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM* vm, char* options,
[[maybe_unused]] void* reserved) {
printf("Agent_OnLoad called with options \"%s\"\n", options); if (strcmp("test_900_round_2", options) == 0) { return0;
}
uintptr_t env = 0;
jint res = vm->GetEnv(reinterpret_cast<void**>(&env), TEST_900_ENV_VERSION_NUMBER); if (res != JNI_OK) {
printf("GetEnv(TEST_900_ENV_VERSION_NUMBER) returned non-zero\n");
}
printf("GetEnv returned '%" PRIdPTR "' environment!\n", env); return0;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.