diff --git a/Il2CppDumper/Elf.cs b/Il2CppDumper/Elf.cs index 130da25..e760d4e 100644 --- a/Il2CppDumper/Elf.cs +++ b/Il2CppDumper/Elf.cs @@ -70,6 +70,7 @@ namespace Il2CppDumper } var pt_dynamic = programSegment.First(x => x.p_type == PT_DYNAMIC); dynamicSection = ReadClassArray(pt_dynamic.p_offset, pt_dynamic.p_filesz / 8u); + ReadSymbol(); if (!isDumped) { RelocationProcessing(); @@ -204,18 +205,21 @@ namespace Il2CppDumper return false; } + private void ReadSymbol() + { + var dynsymOffset = MapVATR(dynamicSection.First(x => x.d_tag == DT_SYMTAB).d_un); + var dynstrOffset = MapVATR(dynamicSection.First(x => x.d_tag == DT_STRTAB).d_un); + var dynsymSize = dynstrOffset - dynsymOffset; + symbolTable = ReadClassArray(dynsymOffset, (long)dynsymSize / 16); + } private void RelocationProcessing() { Console.WriteLine("Applying relocations..."); try { - var dynsymOffset = MapVATR(dynamicSection.First(x => x.d_tag == DT_SYMTAB).d_un); - var dynstrOffset = MapVATR(dynamicSection.First(x => x.d_tag == DT_STRTAB).d_un); - var dynsymSize = dynstrOffset - dynsymOffset; var reldynOffset = MapVATR(dynamicSection.First(x => x.d_tag == DT_REL).d_un); var reldynSize = dynamicSection.First(x => x.d_tag == DT_RELSZ).d_un; - symbolTable = ReadClassArray(dynsymOffset, (long)dynsymSize / 16); var relTable = ReadClassArray(reldynOffset, reldynSize / 8); var isx86 = elfHeader.e_machine == 0x3; foreach (var rel in relTable) diff --git a/Il2CppDumper/Elf64.cs b/Il2CppDumper/Elf64.cs index 03d9e82..bb50071 100644 --- a/Il2CppDumper/Elf64.cs +++ b/Il2CppDumper/Elf64.cs @@ -59,6 +59,7 @@ namespace Il2CppDumper } var pt_dynamic = programSegment.First(x => x.p_type == PT_DYNAMIC); dynamicSection = ReadClassArray(pt_dynamic.p_offset, (long)pt_dynamic.p_filesz / 16L); + ReadSymbol(); if (!isDumped) { RelocationProcessing(); @@ -145,18 +146,21 @@ namespace Il2CppDumper return false; } + private void ReadSymbol() + { + var dynsymOffset = MapVATR(dynamicSection.First(x => x.d_tag == DT_SYMTAB).d_un); + var dynstrOffset = MapVATR(dynamicSection.First(x => x.d_tag == DT_STRTAB).d_un); + var dynsymSize = dynstrOffset - dynsymOffset; + symbolTable = ReadClassArray(dynsymOffset, (long)dynsymSize / 24L); + } + private void RelocationProcessing() { Console.WriteLine("Applying relocations..."); - try { - ulong dynsymOffset = MapVATR(dynamicSection.First(x => x.d_tag == DT_SYMTAB).d_un); - ulong dynstrOffset = MapVATR(dynamicSection.First(x => x.d_tag == DT_STRTAB).d_un); - var dynsymSize = dynstrOffset - dynsymOffset; - ulong relaOffset = MapVATR(dynamicSection.First(x => x.d_tag == DT_RELA).d_un); + var relaOffset = MapVATR(dynamicSection.First(x => x.d_tag == DT_RELA).d_un); var relaSize = dynamicSection.First(x => x.d_tag == DT_RELASZ).d_un; - symbolTable = ReadClassArray(dynsymOffset, (long)dynsymSize / 24L); var relaTable = ReadClassArray(relaOffset, (long)relaSize / 24L); foreach (var rela in relaTable) {