mirror of
https://github.com/xiaozhou233/JuiceAgent.git
synced 2026-12-05 21:15:56 +08:00
[Update] Remove unuse code
This commit is contained in:
1 parent
3dc83d83db
commit
40707231c0
6 files changed
+2
-18
No files matched your search
@@ -0,0 +1,49 @@
|
||||
#include "jvmutils.h"
|
||||
|
||||
// Get JavaVM
|
||||
jint GetCreatedJVM(JavaVM **out_jvm) {
|
||||
if (!out_jvm) return JNI_ERR;
|
||||
*out_jvm = NULL;
|
||||
|
||||
jint res = JNI_GetCreatedJavaVMs(out_jvm, 1, NULL);
|
||||
if (res != JNI_OK || *out_jvm == NULL) {
|
||||
MessageBoxA(NULL, "JNI_GetCreatedJavaVMs failed", "Error", MB_OK);
|
||||
return res;
|
||||
}
|
||||
return JNI_OK;
|
||||
}
|
||||
|
||||
// Get JNIEnv
|
||||
jint GetJNIEnv(JavaVM *jvm, JNIEnv **out_env) {
|
||||
if (!jvm || !out_env) return JNI_ERR;
|
||||
*out_env = NULL;
|
||||
|
||||
void *env = NULL;
|
||||
jint res = (*jvm)->GetEnv(jvm, &env, JNI_VERSION_1_8);
|
||||
if (res == JNI_OK && env != NULL) {
|
||||
*out_env = (JNIEnv *)env;
|
||||
return JNI_OK;
|
||||
}
|
||||
|
||||
// Attach current thread
|
||||
res = (*jvm)->AttachCurrentThread(jvm, &env, NULL);
|
||||
if (res != JNI_OK || env == NULL) {
|
||||
return res;
|
||||
}
|
||||
*out_env = (JNIEnv *)env;
|
||||
return JNI_OK;
|
||||
}
|
||||
|
||||
// Get JVMTI
|
||||
jint GetJVMTI(JavaVM *jvm, jvmtiEnv **out_jvmti) {
|
||||
if (!jvm || !out_jvmti) return JNI_ERR;
|
||||
*out_jvmti = NULL;
|
||||
|
||||
jint res = (*jvm)->GetEnv(jvm, (void**)out_jvmti, JVMTI_VERSION_1_2);
|
||||
if (res == JNI_OK && *out_jvmti != NULL) {
|
||||
return JNI_OK;
|
||||
}
|
||||
|
||||
*out_jvmti = NULL;
|
||||
return res;
|
||||
}
|
||||
Reference in new issue
Block a user