This commit is contained in:
恍兮惚兮 2024-05-09 15:56:34 +08:00
parent 17d0a7a84c
commit 952236c710
2 changed files with 8 additions and 11 deletions

View File

@ -121,15 +121,15 @@ namespace il2cpp_symbols
}
return maybes;
}
struct AuthThread{
struct AutoThread{
void*thread=NULL;
AuthThread(){
AutoThread(){
if(!(il2cpp_thread_attach&&il2cpp_domain_get))return;
auto il2cpp_domain=il2cpp_domain_get();
if (!il2cpp_domain) return;
thread= il2cpp_thread_attach(il2cpp_domain);
}
~AuthThread(){
~AutoThread(){
if(!thread)return;
if(!il2cpp_thread_detach)return;
il2cpp_thread_detach(thread);
@ -145,7 +145,7 @@ namespace il2cpp_symbols
uintptr_t get_method_pointer(const char* assemblyName, const char* namespaze,
const char* klassName, const char* name, int argsCount)
{
auto thread=AuthThread();
auto thread=AutoThread();
if(!thread.thread)return NULL;
auto klass=get_il2cppclass1(assemblyName,namespaze,klassName);//正向查询assemblyName可以为空

View File

@ -519,9 +519,6 @@ std::vector<MonoClass*> mono_findklassby_class(std::vector<MonoImage*>& images,c
}
}
return maybes;
}
MonoThread* tryattach(){
}
uintptr_t getmethodofklass(MonoClass* klass,const char* name, int argsCount){
if(!(mono_class_get_method_from_name&&mono_compile_method))return NULL;
@ -530,15 +527,15 @@ uintptr_t getmethodofklass(MonoClass* klass,const char* name, int argsCount){
if(!MonoClassMethod)return NULL;
return (uintptr_t)mono_compile_method((uintptr_t)MonoClassMethod);
}
struct AuthThread{
struct AutoThread{
MonoThread *thread=NULL;
AuthThread(){
AutoThread(){
if(!(mono_get_root_domain&&mono_thread_attach))return ;
auto _root=mono_get_root_domain();
if(!_root)return ;
thread= mono_thread_attach(_root);
}
~AuthThread(){
~AutoThread(){
if(!thread)return;
if(!mono_thread_detach)return;
mono_thread_detach(thread);
@ -546,7 +543,7 @@ struct AuthThread{
};
}
uintptr_t getmonofunctionptr(const char *_dll, const char *_namespace, const char *_class, const char *_method, int paramCount) {
auto thread=AuthThread();
auto thread=AutoThread();
if(!thread.thread)return NULL;
auto images=mono_loop_images();