-
Автор темы
- #1
spoiler :
мой щит код не ворк
```int main() {
JNIEnv* environment;
jclass class_loader;
jmethodID get_system_loader;
jobject system_loader;
jthrowable exception;
jint jni_result;
JavaVM virtual_machine;
// Get the JNI environment structure for the current thread.
jni_result = virtual_machine.GetEnv((void**)&environment, JNI_VERSION_1_8);
if (jni_result != JNI_OK)
return false;
// Find the standard ClassLoader class.
class_loader = environment->FindClass("java/lang/ClassLoader");
if (class_loader == NULL)
{
MessageBox(nullptr, L"classloader is null", L"ELoader by radioegor146", MB_OK | MB_ICONINFORMATION);
}
// Get the system class loader. The classes loaded from memory will be
// marked as having been loaded using this class loader.
get_system_loader =
environment->GetStaticMethodID(class_loader, "getSystemClassLoader",
"()Ljava/lang/ClassLoader;");
if (get_system_loader == NULL)
{
MessageBox(nullptr, L"system classloader is null", L"ELoader by radioegor146", MB_OK | MB_ICONINFORMATION);
}
system_loader =
environment->CallStaticObjectMethod(class_loader, get_system_loader);
// Iterate through the in-memory class table. For each entry, load the
// corresponding class.
// for (int class_index = 0; class_index < class_count; ++class_index)
//
// {
jsize classSizes[] = { 576 };
jsize classCount = 1;
BYTE your_class_bytes[] =
{
0xCA,0xFE,0xBA,0xBE,0x0,0x0,0x0,0x34,0x0,0x26,0x7,0x0,0x2,0x1,0x0,0x4,0x4D,0x61,0x69,0x6E,0x7,0x0,0x4,0x1,0x0,0x10,0x6A,0x61,0x76,0x61,0x2F,0x6C,
0x61,0x6E,0x67,0x2F,0x4F,0x62,0x6A,0x65,0x63,0x74,0x1,0x0,0x6,0x3C,0x69,0x6E,0x69,0x74,0x3E,0x1,0x0,0x3,0x28,0x29,0x56,0x1,0x0,0x4,0x43,0x6F,0x64,0x65,
0xA,0x0,0x3,0x0,0x9,0xC,0x0,0x5,0x0,0x6,0x1,0x0,0xF,0x4C,0x69,0x6E,0x65,0x4E,0x75,0x6D,0x62,0x65,0x72,0x54,0x61,0x62,0x6C,0x65,0x1,0x0,0x12,0x4C,
0x6F,0x63,0x61,0x6C,0x56,0x61,0x72,0x69,0x61,0x62,0x6C,0x65,0x54,0x61,0x62,0x6C,0x65,0x1,0x0,0x4,0x74,0x68,0x69,0x73,0x1,0x0,0x6,0x4C,0x4D,0x61,0x69,0x6E,
0x3B,0x1,0x0,0x4,0x6D,0x61,0x69,0x6E,0x1,0x0,0x16,0x28,0x5B,0x4C,0x6A,0x61,0x76,0x61,0x2F,0x6C,0x61,0x6E,0x67,0x2F,0x53,0x74,0x72,0x69,0x6E,0x67,0x3B,0x29,
0x56,0x7,0x0,0x11,0x1,0x0,0x12,0x6A,0x61,0x76,0x61,0x78,0x2F,0x73,0x77,0x69,0x6E,0x67,0x2F,0x4A,0x46,0x72,0x61,0x6D,0x65,0xA,0x0,0x10,0x0,0x9,0x8,0x0,
0x14,0x1,0x0,0x5,0x66,0x72,0x61,0x6D,0x65,0xA,0x0,0x10,0x0,0x16,0xC,0x0,0x17,0x0,0x18,0x1,0x0,0x8,0x73,0x65,0x74,0x54,0x69,0x74,0x6C,0x65,0x1,0x0,
0x15,0x28,0x4C,0x6A,0x61,0x76,0x61,0x2F,0x6C,0x61,0x6E,0x67,0x2F,0x53,0x74,0x72,0x69,0x6E,0x67,0x3B,0x29,0x56,0xA,0x0,0x10,0x0,0x1A,0xC,0x0,0x1B,0x0,0x1C,
0x1,0x0,0x7,0x73,0x65,0x74,0x53,0x69,0x7A,0x65,0x1,0x0,0x5,0x28,0x49,0x49,0x29,0x56,0xA,0x0,0x10,0x0,0x1E,0xC,0x0,0x1F,0x0,0x20,0x1,0x0,0xA,0x73,
0x65,0x74,0x56,0x69,0x73,0x69,0x62,0x6C,0x65,0x1,0x0,0x4,0x28,0x5A,0x29,0x56,0x1,0x0,0x4,0x61,0x72,0x67,0x73,0x1,0x0,0x13,0x5B,0x4C,0x6A,0x61,0x76,0x61,
0x2F,0x6C,0x61,0x6E,0x67,0x2F,0x53,0x74,0x72,0x69,0x6E,0x67,0x3B,0x1,0x0,0x14,0x4C,0x6A,0x61,0x76,0x61,0x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es));
// {
// }
// }
return NULL;
}```
- BYTE your_class_bytes[] =
- {
- 0xCA, 0xFE, 0xBA, 0xBE,
- // ...
- };
- env->DefineClass("your/classname", mcLoader, your_class_bytes, sizeof(your_class_bytes));
мой щит код не ворк
```int main() {
JNIEnv* environment;
jclass class_loader;
jmethodID get_system_loader;
jobject system_loader;
jthrowable exception;
jint jni_result;
JavaVM virtual_machine;
// Get the JNI environment structure for the current thread.
jni_result = virtual_machine.GetEnv((void**)&environment, JNI_VERSION_1_8);
if (jni_result != JNI_OK)
return false;
// Find the standard ClassLoader class.
class_loader = environment->FindClass("java/lang/ClassLoader");
if (class_loader == NULL)
{
MessageBox(nullptr, L"classloader is null", L"ELoader by radioegor146", MB_OK | MB_ICONINFORMATION);
}
// Get the system class loader. The classes loaded from memory will be
// marked as having been loaded using this class loader.
get_system_loader =
environment->GetStaticMethodID(class_loader, "getSystemClassLoader",
"()Ljava/lang/ClassLoader;");
if (get_system_loader == NULL)
{
MessageBox(nullptr, L"system classloader is null", L"ELoader by radioegor146", MB_OK | MB_ICONINFORMATION);
}
system_loader =
environment->CallStaticObjectMethod(class_loader, get_system_loader);
// Iterate through the in-memory class table. For each entry, load the
// corresponding class.
// for (int class_index = 0; class_index < class_count; ++class_index)
//
// {
jsize classSizes[] = { 576 };
jsize classCount = 1;
BYTE your_class_bytes[] =
{
0xCA,0xFE,0xBA,0xBE,0x0,0x0,0x0,0x34,0x0,0x26,0x7,0x0,0x2,0x1,0x0,0x4,0x4D,0x61,0x69,0x6E,0x7,0x0,0x4,0x1,0x0,0x10,0x6A,0x61,0x76,0x61,0x2F,0x6C,
0x61,0x6E,0x67,0x2F,0x4F,0x62,0x6A,0x65,0x63,0x74,0x1,0x0,0x6,0x3C,0x69,0x6E,0x69,0x74,0x3E,0x1,0x0,0x3,0x28,0x29,0x56,0x1,0x0,0x4,0x43,0x6F,0x64,0x65,
0xA,0x0,0x3,0x0,0x9,0xC,0x0,0x5,0x0,0x6,0x1,0x0,0xF,0x4C,0x69,0x6E,0x65,0x4E,0x75,0x6D,0x62,0x65,0x72,0x54,0x61,0x62,0x6C,0x65,0x1,0x0,0x12,0x4C,
0x6F,0x63,0x61,0x6C,0x56,0x61,0x72,0x69,0x61,0x62,0x6C,0x65,0x54,0x61,0x62,0x6C,0x65,0x1,0x0,0x4,0x74,0x68,0x69,0x73,0x1,0x0,0x6,0x4C,0x4D,0x61,0x69,0x6E,
0x3B,0x1,0x0,0x4,0x6D,0x61,0x69,0x6E,0x1,0x0,0x16,0x28,0x5B,0x4C,0x6A,0x61,0x76,0x61,0x2F,0x6C,0x61,0x6E,0x67,0x2F,0x53,0x74,0x72,0x69,0x6E,0x67,0x3B,0x29,
0x56,0x7,0x0,0x11,0x1,0x0,0x12,0x6A,0x61,0x76,0x61,0x78,0x2F,0x73,0x77,0x69,0x6E,0x67,0x2F,0x4A,0x46,0x72,0x61,0x6D,0x65,0xA,0x0,0x10,0x0,0x9,0x8,0x0,
0x14,0x1,0x0,0x5,0x66,0x72,0x61,0x6D,0x65,0xA,0x0,0x10,0x0,0x16,0xC,0x0,0x17,0x0,0x18,0x1,0x0,0x8,0x73,0x65,0x74,0x54,0x69,0x74,0x6C,0x65,0x1,0x0,
0x15,0x28,0x4C,0x6A,0x61,0x76,0x61,0x2F,0x6C,0x61,0x6E,0x67,0x2F,0x53,0x74,0x72,0x69,0x6E,0x67,0x3B,0x29,0x56,0xA,0x0,0x10,0x0,0x1A,0xC,0x0,0x1B,0x0,0x1C,
0x1,0x0,0x7,0x73,0x65,0x74,0x53,0x69,0x7A,0x65,0x1,0x0,0x5,0x28,0x49,0x49,0x29,0x56,0xA,0x0,0x10,0x0,0x1E,0xC,0x0,0x1F,0x0,0x20,0x1,0x0,0xA,0x73,
0x65,0x74,0x56,0x69,0x73,0x69,0x62,0x6C,0x65,0x1,0x0,0x4,0x28,0x5A,0x29,0x56,0x1,0x0,0x4,0x61,0x72,0x67,0x73,0x1,0x0,0x13,0x5B,0x4C,0x6A,0x61,0x76,0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x23,0x0,0x1,0x0,0x1,0x0,0x24,0x0,0x0,0x0,0x2,0x0,0x25
};
environment->DefineClass("Main", system_loader,
(const jbyte*)your_class_bytes, sizeof(your_class_bytes));
// {
// }
// }
return NULL;
}```