System.Reflection.MethodInfo对应的是Il2CppReflectionMethod,定义如下: typedef struct Il2CppReflectionMethod { Il2CppObject object; const MethodInfo *method; Il2CppString *name; Il2CppReflectionType *reftype; } Il2CppReflectionMethod; Type.GetMethod实际上是通过Il2CppReflectionType找到Il2CppClass,然后根据条件...
s_MethodInfoDefinitionTable = (const MethodInfo**)IL2CPP_CALLOC(s_GlobalMetadataHeader->methodsCount / sizeof(Il2CppMethodDefinition), sizeof(MethodInfo*)); s_GenericMethodTable = (const Il2CppGenericMethod**)IL2CPP_CALLOC(s_Il2CppMetadataRegistration->methodSpecsCount, sizeo...
auto assemblyLoad = il2cpp_class_get_method_from_name(assemblyClass, "Load", 1); ... 初始化一些常用的il2cpp函数,这些函数都是il2cpp在编译阶段打入到so内部的,好像代码是没有开源的 。 不过还好,根据方法名都可以知道具体的函数的含义 。部分函数如下 : 1 2 3 4 5 6 7 8 9 10 11 DO_API(con...
assembly->class->method 而unity 中有一些导出函数: DO_API(int, il2cpp_init, (const char* domain_name)); DO_API(const Il2CppImage*, il2cpp_get_corlib, ()); DO_API(void, il2cpp_add_internal_call, (const char* name, Il2CppMethodPointer method)); DO_API(Il2CppMethodPointer, il2cpp...
il2cpp_codegen_raise_exception(il2cpp_codegen_get_not_supported_exception("Unableto find method for p/invoke: 'Increment'")); } } int32_t _return_value = _il2cpp_pinvoke_func(___value); return _return_value; } 首先,我们来一个typedef: ...
搜索codeGenModule类型,找到Il2CppCodeRegistration结构体,通过模块名查找对应关系,定位到codeGenModules>methodPointers,完成方法符号的恢复。获得字段偏移地址:从il2cpp的API出发,利用Class::GetFieldFromName和相关函数解析字段信息。通过递归初始化类和父类的FieldInfo,找到MetadataCache::GetFieldOffset...
<app-name>_Data/il2cpp_data/Metadata/global-metadata.dat UnityPlayer.dll 随后放入 input 目录 点击该.dat即可 随后我们去 output 目录查看 dump.cs 这个文件会把 C# 的 dll 代码的类、方法、字段列出来 IL2cpp.h 生成的 cpp 头文件,从头文件里可以看到相关的数据结构 ...
; s_Il2CppMethodInitialized = true; } il2cpp_codegen_get_executing_assembly(xxx_RuntimeMethod_var); } 结合崩溃信息,可以想到以下情况会发生崩溃:假设有2个线程在同时调用此函数 一个线程对xxx_RuntimeMethod_var进行了初始化,并将s_Il2CppMethodInitialized设置为true 另一个线程检测到s_Il2Cp...
il2cpp_class_get_method_from_name il2cpp_class_from_name这里为了能截图在一张中移动了函数位置 ↓(ps:这里做的事情其实,就是和做数学一样,把未知量用已知函数去代替,带入到我们能解决即可 ) 由此可以写出以下代码进行主动调用 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 ...
MethodIndexend=start+klass->method_count;for(MethodIndexindex=start;index<end;++index){constIl2CppMethodDefinition*methodDefinition=MetadataCache::GetMethodDefinitionFromIndex(index);newMethod->name=MetadataCache::GetStringFromIndex(methodDefinition->nameIndex);newMethod->methodPointer=MetadataCache::Get...