private ulong FindCodeRegistrationOld() { foreach (var section in data) { il2Cpp.Position = section.offset; while (il2Cpp.Position < section.offsetEnd) { var addr = il2Cpp.Position; if (il2Cpp.ReadIntPtr() == methodCount) { try { var pointer = il2Cpp.MapVATR(il2Cpp.ReadUIntPtr()); if (CheckPointerRangeDataRa(pointer)) { var pointers = il2Cpp.ReadClassArray <ulong>(pointer, methodCount); if (CheckPointerRangeExecVa(pointers)) { return(addr - section.offset + section.address); } } } catch { // ignored } } il2Cpp.Position = addr + il2Cpp.PointerSize; } } return(0ul); }
public ulong FindCodeRegistration() { foreach (var section in search) { il2Cpp.Position = section.start; while ((ulong)il2Cpp.Position < section.end) { var addr = il2Cpp.Position; if (il2Cpp.ReadUInt32() == methodCount) { try { var pointer = il2Cpp.MapVATR(il2Cpp.ReadUInt32()); if (CheckPointerRangeFirst(pointer)) { var sign = il2Cpp.Position; var pointers = il2Cpp.ReadClassArray <uint>(pointer, methodCount); if (CheckPointerRangeSecond(pointers)) { return((ulong)addr - section.start + section.address); //VirtualAddress } il2Cpp.Position = sign; } } catch { // ignored } } } } return(0ul); }
public Il2CppExecutor(Metadata metadata, Il2Cpp il2Cpp) { this.metadata = metadata; this.il2Cpp = il2Cpp; this.TypeDefToName = new UniqueTypeDefNameMap(new WeakReference <Il2CppExecutor>(this)); if (il2Cpp.Version >= 27) { customAttributeGenerators = new ulong[metadata.imageDefs.Sum(x => x.customAttributeCount)]; foreach (var imageDef in metadata.imageDefs) { var imageDefName = metadata.GetStringFromIndex(imageDef.nameIndex); var codeGenModule = il2Cpp.codeGenModules[imageDefName]; var pointers = il2Cpp.ReadClassArray <ulong>(il2Cpp.MapVATR(codeGenModule.customAttributeCacheGenerator), imageDef.customAttributeCount); pointers.CopyTo(customAttributeGenerators, imageDef.customAttributeStart); } } else { customAttributeGenerators = il2Cpp.customAttributeGenerators; } for (int index = 0; index < metadata.typeDefs.Length; ++index) { TypeDefToIndex[metadata.typeDefs[index]] = index; } for (long index = 0; index < il2Cpp.types.Length; ++index) { TypeToIndex[il2Cpp.types[index]] = index; } }
public Il2CppExecutor(Metadata metadata, Il2Cpp il2Cpp) { this.metadata = metadata; this.il2Cpp = il2Cpp; if (il2Cpp.Version >= 27) { customAttributeGenerators = new ulong[metadata.imageDefs.Sum(x => x.customAttributeCount)]; foreach (var imageDef in metadata.imageDefs) { var imageDefName = metadata.GetStringFromIndex(imageDef.nameIndex); var codeGenModule = il2Cpp.codeGenModules[imageDefName]; var pointers = il2Cpp.ReadClassArray <ulong>(il2Cpp.MapVATR(codeGenModule.customAttributeCacheGenerator), imageDef.customAttributeCount); pointers.CopyTo(customAttributeGenerators, imageDef.customAttributeStart); } } else { customAttributeGenerators = il2Cpp.customAttributeGenerators; } }