Formats: Add Section class and [Try]GetSection() interface
This commit is contained in:
@@ -31,6 +31,8 @@ namespace Il2CppInspector
|
|||||||
Dictionary<string, Symbol> GetSymbolTable();
|
Dictionary<string, Symbol> GetSymbolTable();
|
||||||
uint[] GetFunctionTable();
|
uint[] GetFunctionTable();
|
||||||
IEnumerable<Export> GetExports();
|
IEnumerable<Export> GetExports();
|
||||||
|
IEnumerable<Section> GetSections();
|
||||||
|
bool TryGetSections(out IEnumerable<Section> sections);
|
||||||
|
|
||||||
uint MapVATR(ulong uiAddr);
|
uint MapVATR(ulong uiAddr);
|
||||||
bool TryMapVATR(ulong uiAddr, out uint fileOffset);
|
bool TryMapVATR(ulong uiAddr, out uint fileOffset);
|
||||||
@@ -183,6 +185,19 @@ namespace Il2CppInspector
|
|||||||
// Find all symbol exports for the image
|
// Find all symbol exports for the image
|
||||||
public virtual IEnumerable<Export> GetExports() => null;
|
public virtual IEnumerable<Export> GetExports() => null;
|
||||||
|
|
||||||
|
// Get all sections for the image in a universal format
|
||||||
|
public virtual IEnumerable<Section> GetSections() => throw new NotImplementedException();
|
||||||
|
|
||||||
|
public bool TryGetSections(out IEnumerable<Section> sections) {
|
||||||
|
try {
|
||||||
|
sections = GetSections();
|
||||||
|
return true;
|
||||||
|
} catch (NotImplementedException) {
|
||||||
|
sections = null;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Map an RVA to an offset into the file image
|
// Map an RVA to an offset into the file image
|
||||||
// No mapping by default
|
// No mapping by default
|
||||||
public virtual uint MapVATR(ulong uiAddr) => (uint) uiAddr;
|
public virtual uint MapVATR(ulong uiAddr) => (uint) uiAddr;
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ namespace Il2CppInspector
|
|||||||
foreach (var entry in dataEntries) {
|
foreach (var entry in dataEntries) {
|
||||||
pht[entry.SegmentIndex].f_p_filesz = entry.EncryptedCompressedSize;
|
pht[entry.SegmentIndex].f_p_filesz = entry.EncryptedCompressedSize;
|
||||||
pht[entry.SegmentIndex].f_p_offset = entry.FileOffset;
|
pht[entry.SegmentIndex].f_p_offset = entry.FileOffset;
|
||||||
pht[entry.SegmentIndex].p_memsz = entry.MemorySize;
|
pht[entry.SegmentIndex].f_p_memsz = entry.MemorySize;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Filter out unused phdr entries
|
// Filter out unused phdr entries
|
||||||
|
|||||||
21
Il2CppInspector.Common/FileFormatReaders/Section.cs
Normal file
21
Il2CppInspector.Common/FileFormatReaders/Section.cs
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2020 Katy Coe - http://www.djkaty.com - https://github.com/djkaty
|
||||||
|
|
||||||
|
All rights reserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Il2CppInspector
|
||||||
|
{
|
||||||
|
// A code file function export
|
||||||
|
public class Section
|
||||||
|
{
|
||||||
|
public ulong VirtualStart;
|
||||||
|
public ulong VirtualEnd;
|
||||||
|
public uint ImageStart;
|
||||||
|
public uint ImageEnd;
|
||||||
|
public bool IsExec;
|
||||||
|
public bool IsData;
|
||||||
|
public bool IsBSS;
|
||||||
|
public string Name;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user