mirror of
https://github.com/Perfare/Il2CppDumper.git
synced 2025-01-25 02:03:02 -03:00
修正Macho下的基址
This commit is contained in:
parent
f62db1bd24
commit
d4fb890d42
2 changed files with 24 additions and 6 deletions
|
@ -12,7 +12,7 @@ namespace Il2CppDumper
|
|||
private List<MachoSection> sections = new List<MachoSection>();
|
||||
private static readonly byte[] FeatureBytes1 = { 0x0, 0x22 };//MOVS R2, #0
|
||||
private static readonly byte[] FeatureBytes2 = { 0x78, 0x44, 0x79, 0x44 };//ADD R0, PC and ADD R1, PC
|
||||
|
||||
private ulong vmaddr;
|
||||
|
||||
public Macho(Stream stream, float version, long maxMetadataUsages) : base(stream, version, maxMetadataUsages)
|
||||
{
|
||||
|
@ -27,7 +27,16 @@ namespace Il2CppDumper
|
|||
var cmdsize = ReadUInt32();
|
||||
if (cmd == 1) //LC_SEGMENT
|
||||
{
|
||||
Position += 40; //skip segname, vmaddr, vmsize, fileoff, filesize, maxprot, initprot
|
||||
var segname = Encoding.UTF8.GetString(ReadBytes(16)).TrimEnd('\0');
|
||||
if (segname == "__TEXT") //__PAGEZERO
|
||||
{
|
||||
vmaddr = ReadUInt32();
|
||||
}
|
||||
else
|
||||
{
|
||||
Position += 4;
|
||||
}
|
||||
Position += 20; //skip vmsize, fileoff, filesize, maxprot, initprot
|
||||
var nsects = ReadUInt32();
|
||||
Position += 4; //skip flags
|
||||
for (var j = 0; j < nsects; j++)
|
||||
|
@ -168,7 +177,7 @@ namespace Il2CppDumper
|
|||
|
||||
public override ulong GetRVA(ulong pointer)
|
||||
{
|
||||
return pointer - 0x4000u;
|
||||
return pointer - vmaddr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace Il2CppDumper
|
|||
private List<MachoSection64Bit> sections = new List<MachoSection64Bit>();
|
||||
private static readonly byte[] FeatureBytes1 = { 0x2, 0x0, 0x80, 0xD2 };//MOV X2, #0
|
||||
private static readonly byte[] FeatureBytes2 = { 0x3, 0x0, 0x80, 0x52 };//MOV W3, #0
|
||||
|
||||
private ulong vmaddr;
|
||||
|
||||
public Macho64(Stream stream, float version, long maxMetadataUsages) : base(stream, version, maxMetadataUsages)
|
||||
{
|
||||
|
@ -26,7 +26,16 @@ namespace Il2CppDumper
|
|||
var cmdsize = ReadUInt32();
|
||||
if (cmd == 0x19) //LC_SEGMENT_64
|
||||
{
|
||||
Position += 56; //skip segname, vmaddr, vmsize, fileoff, filesize, maxprot, initprot
|
||||
var segname = Encoding.UTF8.GetString(ReadBytes(16)).TrimEnd('\0');
|
||||
if (segname == "__TEXT") //__PAGEZERO
|
||||
{
|
||||
vmaddr = ReadUInt64();
|
||||
}
|
||||
else
|
||||
{
|
||||
Position += 8;
|
||||
}
|
||||
Position += 32; //skip vmsize, fileoff, filesize, maxprot, initprot
|
||||
var nsects = ReadUInt32();
|
||||
Position += 4; //skip flags
|
||||
for (var j = 0; j < nsects; j++)
|
||||
|
@ -196,7 +205,7 @@ namespace Il2CppDumper
|
|||
|
||||
public override ulong GetRVA(ulong pointer)
|
||||
{
|
||||
return pointer - 0x100000000ul;
|
||||
return pointer - vmaddr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue