mirror of
https://github.com/Perfare/Il2CppDumper.git
synced 2025-01-25 02:03:02 -03:00
提取函数
This commit is contained in:
parent
c03e915182
commit
7a13ac1af9
2 changed files with 18 additions and 10 deletions
|
@ -70,6 +70,7 @@ namespace Il2CppDumper
|
||||||
}
|
}
|
||||||
var pt_dynamic = programSegment.First(x => x.p_type == PT_DYNAMIC);
|
var pt_dynamic = programSegment.First(x => x.p_type == PT_DYNAMIC);
|
||||||
dynamicSection = ReadClassArray<Elf32_Dyn>(pt_dynamic.p_offset, pt_dynamic.p_filesz / 8u);
|
dynamicSection = ReadClassArray<Elf32_Dyn>(pt_dynamic.p_offset, pt_dynamic.p_filesz / 8u);
|
||||||
|
ReadSymbol();
|
||||||
if (!isDumped)
|
if (!isDumped)
|
||||||
{
|
{
|
||||||
RelocationProcessing();
|
RelocationProcessing();
|
||||||
|
@ -204,18 +205,21 @@ namespace Il2CppDumper
|
||||||
return false;
|
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<Elf32_Sym>(dynsymOffset, (long)dynsymSize / 16);
|
||||||
|
}
|
||||||
|
|
||||||
private void RelocationProcessing()
|
private void RelocationProcessing()
|
||||||
{
|
{
|
||||||
Console.WriteLine("Applying relocations...");
|
Console.WriteLine("Applying relocations...");
|
||||||
try
|
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 reldynOffset = MapVATR(dynamicSection.First(x => x.d_tag == DT_REL).d_un);
|
||||||
var reldynSize = dynamicSection.First(x => x.d_tag == DT_RELSZ).d_un;
|
var reldynSize = dynamicSection.First(x => x.d_tag == DT_RELSZ).d_un;
|
||||||
symbolTable = ReadClassArray<Elf32_Sym>(dynsymOffset, (long)dynsymSize / 16);
|
|
||||||
var relTable = ReadClassArray<Elf32_Rel>(reldynOffset, reldynSize / 8);
|
var relTable = ReadClassArray<Elf32_Rel>(reldynOffset, reldynSize / 8);
|
||||||
var isx86 = elfHeader.e_machine == 0x3;
|
var isx86 = elfHeader.e_machine == 0x3;
|
||||||
foreach (var rel in relTable)
|
foreach (var rel in relTable)
|
||||||
|
|
|
@ -59,6 +59,7 @@ namespace Il2CppDumper
|
||||||
}
|
}
|
||||||
var pt_dynamic = programSegment.First(x => x.p_type == PT_DYNAMIC);
|
var pt_dynamic = programSegment.First(x => x.p_type == PT_DYNAMIC);
|
||||||
dynamicSection = ReadClassArray<Elf64_Dyn>(pt_dynamic.p_offset, (long)pt_dynamic.p_filesz / 16L);
|
dynamicSection = ReadClassArray<Elf64_Dyn>(pt_dynamic.p_offset, (long)pt_dynamic.p_filesz / 16L);
|
||||||
|
ReadSymbol();
|
||||||
if (!isDumped)
|
if (!isDumped)
|
||||||
{
|
{
|
||||||
RelocationProcessing();
|
RelocationProcessing();
|
||||||
|
@ -145,18 +146,21 @@ namespace Il2CppDumper
|
||||||
return false;
|
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<Elf64_Sym>(dynsymOffset, (long)dynsymSize / 24L);
|
||||||
|
}
|
||||||
|
|
||||||
private void RelocationProcessing()
|
private void RelocationProcessing()
|
||||||
{
|
{
|
||||||
Console.WriteLine("Applying relocations...");
|
Console.WriteLine("Applying relocations...");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ulong dynsymOffset = MapVATR(dynamicSection.First(x => x.d_tag == DT_SYMTAB).d_un);
|
var relaOffset = MapVATR(dynamicSection.First(x => x.d_tag == DT_RELA).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 relaSize = dynamicSection.First(x => x.d_tag == DT_RELASZ).d_un;
|
var relaSize = dynamicSection.First(x => x.d_tag == DT_RELASZ).d_un;
|
||||||
symbolTable = ReadClassArray<Elf64_Sym>(dynsymOffset, (long)dynsymSize / 24L);
|
|
||||||
var relaTable = ReadClassArray<Elf64_Rela>(relaOffset, (long)relaSize / 24L);
|
var relaTable = ReadClassArray<Elf64_Rela>(relaOffset, (long)relaSize / 24L);
|
||||||
foreach (var rela in relaTable)
|
foreach (var rela in relaTable)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue