This commit is contained in:
Perfare 2023-02-08 20:07:22 +08:00
parent 6c9bf6648f
commit 23285b5636
6 changed files with 26 additions and 16 deletions

View file

@ -29,7 +29,7 @@ namespace Il2CppDumper
FixedProgramSegment(); FixedProgramSegment();
} }
pt_dynamic = programSegment.First(x => x.p_type == PT_DYNAMIC); 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, pt_dynamic.p_filesz / 16L);
if (IsDumped) if (IsDumped)
{ {
FixedDynamicSection(); FixedDynamicSection();
@ -187,7 +187,7 @@ namespace Il2CppDumper
{ {
var 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; var relaSize = dynamicSection.First(x => x.d_tag == DT_RELASZ).d_un;
var relaTable = ReadClassArray<Elf64_Rela>(relaOffset, (long)relaSize / 24L); var relaTable = ReadClassArray<Elf64_Rela>(relaOffset, relaSize / 24L);
foreach (var rela in relaTable) foreach (var rela in relaTable)
{ {
var type = rela.r_info & 0xffffffff; var type = rela.r_info & 0xffffffff;

View file

@ -97,7 +97,7 @@ namespace Il2CppDumper
if (Version < 23) if (Version < 23)
{ {
var __mod_init_func = sections.First(x => x.sectname == "__mod_init_func"); var __mod_init_func = sections.First(x => x.sectname == "__mod_init_func");
var addrs = ReadClassArray<ulong>(__mod_init_func.offset, (long)__mod_init_func.size / 8); var addrs = ReadClassArray<ulong>(__mod_init_func.offset, __mod_init_func.size / 8);
foreach (var i in addrs) foreach (var i in addrs)
{ {
if (i > 0) if (i > 0)
@ -163,7 +163,7 @@ namespace Il2CppDumper
* B sub * B sub
*/ */
var __mod_init_func = sections.First(x => x.sectname == "__mod_init_func"); var __mod_init_func = sections.First(x => x.sectname == "__mod_init_func");
var addrs = ReadClassArray<ulong>(__mod_init_func.offset, (long)__mod_init_func.size / 8); var addrs = ReadClassArray<ulong>(__mod_init_func.offset, __mod_init_func.size / 8);
foreach (var i in addrs) foreach (var i in addrs)
{ {
if (i > 0) if (i > 0)
@ -200,7 +200,7 @@ namespace Il2CppDumper
* B sub * B sub
*/ */
var __mod_init_func = sections.First(x => x.sectname == "__mod_init_func"); var __mod_init_func = sections.First(x => x.sectname == "__mod_init_func");
var addrs = ReadClassArray<ulong>(__mod_init_func.offset, (long)__mod_init_func.size / 8); var addrs = ReadClassArray<ulong>(__mod_init_func.offset, __mod_init_func.size / 8);
foreach (var i in addrs) foreach (var i in addrs)
{ {
if (i > 0) if (i > 0)

View file

@ -169,7 +169,7 @@ namespace Il2CppDumper
{ {
var 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; var relaSize = dynamicSection.First(x => x.d_tag == DT_RELASZ).d_un;
var relaTable = ReadClassArray<Elf64_Rela>(relaOffset, (long)relaSize / 24L); var relaTable = ReadClassArray<Elf64_Rela>(relaOffset, relaSize / 24L);
foreach (var rela in relaTable) foreach (var rela in relaTable)
{ {
var type = rela.r_info & 0xffffffff; var type = rela.r_info & 0xffffffff;

View file

@ -199,6 +199,11 @@ namespace Il2CppDumper
return t; return t;
} }
public T[] ReadClassArray<T>(ulong addr, ulong count) where T : new()
{
return ReadClassArray<T>(addr, (long)count);
}
public T[] ReadClassArray<T>(ulong addr, long count) where T : new() public T[] ReadClassArray<T>(ulong addr, long count) where T : new()
{ {
Position = addr; Position = addr;

View file

@ -52,7 +52,7 @@ namespace Il2CppDumper
{ {
if (codeRegistration != 0) if (codeRegistration != 0)
{ {
var limit = this is WebAssemblyMemory ? 0x35000 : 0x50000; //TODO var limit = this is WebAssemblyMemory ? 0x35000u : 0x50000u; //TODO
if (Version >= 24.2) if (Version >= 24.2)
{ {
pCodeRegistration = MapVATR<Il2CppCodeRegistration>(codeRegistration); pCodeRegistration = MapVATR<Il2CppCodeRegistration>(codeRegistration);
@ -108,7 +108,7 @@ namespace Il2CppDumper
public virtual void Init(ulong codeRegistration, ulong metadataRegistration) public virtual void Init(ulong codeRegistration, ulong metadataRegistration)
{ {
pCodeRegistration = MapVATR<Il2CppCodeRegistration>(codeRegistration); pCodeRegistration = MapVATR<Il2CppCodeRegistration>(codeRegistration);
var limit = this is WebAssemblyMemory ? 0x35000 : 0x50000; //TODO var limit = this is WebAssemblyMemory ? 0x35000u : 0x50000u; //TODO
if (Version == 27 && pCodeRegistration.invokerPointersCount > limit) if (Version == 27 && pCodeRegistration.invokerPointersCount > limit)
{ {
Version = 27.1; Version = 27.1;
@ -249,6 +249,11 @@ namespace Il2CppDumper
return ReadClass<T>(MapVATR(addr)); return ReadClass<T>(MapVATR(addr));
} }
public T[] MapVATR<T>(ulong addr, ulong count) where T : new()
{
return ReadClassArray<T>(MapVATR(addr), count);
}
public T[] MapVATR<T>(ulong addr, long count) where T : new() public T[] MapVATR<T>(ulong addr, long count) where T : new()
{ {
return ReadClassArray<T>(MapVATR(addr), count); return ReadClassArray<T>(MapVATR(addr), count);

View file

@ -5,7 +5,7 @@ namespace Il2CppDumper
public class Il2CppCodeRegistration public class Il2CppCodeRegistration
{ {
[Version(Max = 24.1)] [Version(Max = 24.1)]
public long methodPointersCount; public ulong methodPointersCount;
[Version(Max = 24.1)] [Version(Max = 24.1)]
public ulong methodPointers; public ulong methodPointers;
[Version(Max = 21)] [Version(Max = 21)]
@ -13,7 +13,7 @@ namespace Il2CppDumper
[Version(Max = 21)] [Version(Max = 21)]
public ulong delegateWrappersFromNativeToManaged; // note the double indirection to handle different calling conventions public ulong delegateWrappersFromNativeToManaged; // note the double indirection to handle different calling conventions
[Version(Min = 22)] [Version(Min = 22)]
public long reversePInvokeWrapperCount; public ulong reversePInvokeWrapperCount;
[Version(Min = 22)] [Version(Min = 22)]
public ulong reversePInvokeWrappers; public ulong reversePInvokeWrappers;
[Version(Max = 22)] [Version(Max = 22)]
@ -28,23 +28,23 @@ namespace Il2CppDumper
public ulong ccwMarshalingFunctionsCount; public ulong ccwMarshalingFunctionsCount;
[Version(Min = 21, Max = 22)] [Version(Min = 21, Max = 22)]
public ulong ccwMarshalingFunctions; public ulong ccwMarshalingFunctions;
public long genericMethodPointersCount; public ulong genericMethodPointersCount;
public ulong genericMethodPointers; public ulong genericMethodPointers;
[Version(Min = 24.5, Max = 24.5)] [Version(Min = 24.5, Max = 24.5)]
[Version(Min = 27.1)] [Version(Min = 27.1)]
public ulong genericAdjustorThunks; public ulong genericAdjustorThunks;
public long invokerPointersCount; public ulong invokerPointersCount;
public ulong invokerPointers; public ulong invokerPointers;
[Version(Max = 24.5)] [Version(Max = 24.5)]
public long customAttributeCount; public ulong customAttributeCount;
[Version(Max = 24.5)] [Version(Max = 24.5)]
public ulong customAttributeGenerators; public ulong customAttributeGenerators;
[Version(Min = 21, Max = 22)] [Version(Min = 21, Max = 22)]
public long guidCount; public ulong guidCount;
[Version(Min = 21, Max = 22)] [Version(Min = 21, Max = 22)]
public ulong guids; // Il2CppGuid public ulong guids; // Il2CppGuid
[Version(Min = 22)] [Version(Min = 22)]
public long unresolvedVirtualCallCount; //29.1 unresolvedIndirectCallCount; public ulong unresolvedVirtualCallCount; //29.1 unresolvedIndirectCallCount;
[Version(Min = 22)] [Version(Min = 22)]
public ulong unresolvedVirtualCallPointers; public ulong unresolvedVirtualCallPointers;
[Version(Min = 29.1)] [Version(Min = 29.1)]
@ -60,7 +60,7 @@ namespace Il2CppDumper
[Version(Min = 24.3)] [Version(Min = 24.3)]
public ulong windowsRuntimeFactoryTable; public ulong windowsRuntimeFactoryTable;
[Version(Min = 24.2)] [Version(Min = 24.2)]
public long codeGenModulesCount; public ulong codeGenModulesCount;
[Version(Min = 24.2)] [Version(Min = 24.2)]
public ulong codeGenModules; public ulong codeGenModules;
} }