This is only specific to Windows.
Does JNI provide any API that returns all instance of JavaVM*
of the calling process?
Consider the following scenario, a C++ dll is injected into a java.exe
process. Now the question is, how can the C++ dll locate the current instance of JavaVM*
within the process it's running from?
As far as I know, all JNI invocation API require a JNIEnv
object which can only be acquired from JavaVM*
right? http://docs.oracle.com/javase/1.5.0/docs/guide/jni/spec/functions.html
The traditional way of getting JavaVM*
is via JNI_OnLoad
but since I'm not writing a native library to be consumed by Java, I don't think that would do the trick. http://docs.oracle.com/javase/1.5.0/docs/guide/jni/spec/invocation.html