示例#1
0
        public ulong FindCodeRegistration64Bit()
        {
            foreach (var section in search)
            {
                il2Cpp.Position = section.start;
                while ((ulong)il2Cpp.Position < section.end)
                {
                    var addr = il2Cpp.Position;
                    if (il2Cpp.ReadInt64() == methodCount)
                    {
                        try
                        {
                            var pointer = il2Cpp.MapVATR(il2Cpp.ReadUInt64());
                            if (CheckPointerRangeFirst(pointer))
                            {
                                var sign     = il2Cpp.Position;
                                var pointers = il2Cpp.ReadClassArray <ulong>(pointer, methodCount);
                                if (CheckPointerRangeSecond(pointers))
                                {
                                    return((ulong)addr - section.start + section.address); //VirtualAddress
                                }
                                il2Cpp.Position = sign;
                            }
                        }
                        catch
                        {
                            // ignored
                        }
                    }
                }
            }

            return(0ul);
        }
示例#2
0
        private ulong FindCodeRegistration64Bit()
        {
            foreach (var section in data)
            {
                il2Cpp.Position = section.offset;
                while (il2Cpp.Position < section.offsetEnd)
                {
                    var addr = il2Cpp.Position;
                    if (il2Cpp.ReadInt64() == methodCount)
                    {
                        try
                        {
                            ulong pointer = il2Cpp.MapVATR(il2Cpp.ReadUInt64());
                            if (CheckPointerRangeDataRa(pointer))
                            {
                                var pointers = il2Cpp.ReadClassArray <ulong>(pointer, methodCount);
                                if (CheckPointerRangeExecVa(pointers))
                                {
                                    return(addr - section.offset + section.address);
                                }
                            }
                        }
                        catch
                        {
                            // ignored
                        }
                    }
                    il2Cpp.Position = addr + 8;
                }
            }

            return(0ul);
        }