This commit is contained in:
Perfare 2023-02-03 10:11:25 +08:00
parent 826a73a2c8
commit 0b498e0834
3 changed files with 38 additions and 20 deletions

View file

@ -267,5 +267,20 @@ namespace Il2CppDumper
}
public override bool CheckDump() => false;
public override ulong ReadUIntPtr()
{
var pointer = ReadUInt64();
if (pointer > 0xFFFFFFFF)
{
var addr = Position;
var section = sections.First(x => addr >= x.offset && addr <= x.offset + x.size);
if (section.sectname == "__const" || section.sectname == "__data")
{
pointer &= 0xFFFFFFFF;
}
}
return pointer;
}
}
}

View file

@ -104,14 +104,10 @@ namespace Il2CppDumper
return ReadUInt16();
case "Byte":
return ReadByte();
case "Int64" when Is32Bit:
return (long)ReadInt32();
case "Int64":
return ReadInt64();
case "UInt64" when Is32Bit:
return (ulong)ReadUInt32();
return ReadIntPtr();
case "UInt64":
return ReadUInt64();
return ReadUIntPtr();
default:
throw new NotSupportedException();
}
@ -224,7 +220,7 @@ namespace Il2CppDumper
return Is32Bit ? ReadInt32() : ReadInt64();
}
public ulong ReadUIntPtr()
public virtual ulong ReadUIntPtr()
{
return Is32Bit ? ReadUInt32() : ReadUInt64();
}

View file

@ -265,25 +265,32 @@ namespace Il2CppDumper
il2Cpp.Position += il2Cpp.PointerSize;
if (il2Cpp.ReadIntPtr() == typeDefinitionsCount)
{
var pointer = il2Cpp.MapVATR(il2Cpp.ReadUIntPtr());
if (CheckPointerRangeDataRa(pointer))
try
{
var pointers = il2Cpp.ReadClassArray<ulong>(pointer, typeDefinitionsCount);
if (il2Cpp is ElfBase)
var pointer = il2Cpp.MapVATR(il2Cpp.ReadUIntPtr());
if (CheckPointerRangeDataRa(pointer))
{
if (CheckPointerRangeExecVa(pointers))
var pointers = il2Cpp.ReadClassArray<ulong>(pointer, typeDefinitionsCount);
if (il2Cpp is ElfBase)
{
return addr - il2Cpp.PointerSize * 10 - section.offset + section.address;
}
}
else
{
if (CheckPointerRangeDataVa(pointers))
{
return addr - il2Cpp.PointerSize * 10 - section.offset + section.address;
if (CheckPointerRangeExecVa(pointers))
{
return addr - il2Cpp.PointerSize * 10 - section.offset + section.address;
}
}
else
{
if (CheckPointerRangeDataVa(pointers))
{
return addr - il2Cpp.PointerSize * 10 - section.offset + section.address;
}
}
}
}
catch
{
// ignored
}
}
}
il2Cpp.Position = addr + il2Cpp.PointerSize;