Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // dllmain.cpp : Definisce il punto di ingresso per l'applicazione DLL.
- #include "pch.h"
- #include "iostream"
- #include "fstream"
- #include "stdio.h"
- #include <jni.h>
- using namespace std;
- BOOL APIENTRY DllMain( HMODULE hModule,DWORD ul_reason_for_call,LPVOID lpReserved)
- {
- switch(1)
- {
- case DLL_PROCESS_ATTACH:
- HMODULE m_hDllInstance = LoadLibrary("jvm.dll");
- if (m_hDllInstance == 0)
- {
- cout << "jvm.dll error";
- }
- JavaVM* jvm;
- JNIEnv* env;
- typedef jint(JNICALL * GetCreatedJavaVMs)(JavaVM * *, jsize, jsize*);
- GetCreatedJavaVMs jni_GetCreatedJavaVMs = (GetCreatedJavaVMs)GetProcAddress(m_hDllInstance, "JNI_GetCreatedJavaVMs");
- jint size = 1;
- jint vmCount;
- jint ret = jni_GetCreatedJavaVMs(&jvm, size, &vmCount);
- jint rc = jvm->AttachCurrentThread((void**)& env, NULL);
- jclass cls = env->FindClass("net/minecraft/client/entity/EntityPlayerSP");
- jfieldID field = env->GetFieldID(cls, "posX", "I");
- jint integer = 2;
- cout << field;
- env->SetIntField(cls, field, integer);
- jvm->DetachCurrentThread();
- }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement