ELF: Rebase if requested even if image is not dumped (#119)

This commit is contained in:
Katy Coe
2020-12-30 08:23:59 +01:00
parent 012266ef87
commit ec6f65b7dc
5 changed files with 11 additions and 10 deletions

View File

@@ -176,7 +176,6 @@ namespace Il2CppInspector.CLI
// Set load options // Set load options
var loadOptions = new LoadOptions { var loadOptions = new LoadOptions {
ImageBase = 0xffffffff_ffffffff,
BinaryFilePath = options.BinaryFiles.First() BinaryFilePath = options.BinaryFiles.First()
}; };

View File

@@ -201,9 +201,14 @@ namespace Il2CppInspector
// Dumped images must be rebased // Dumped images must be rebased
if (isMemoryImage) { if (isMemoryImage) {
if (LoadOptions.ImageBase == 0xffffffff_ffffffff) if (LoadOptions.ImageBase == 0)
throw new InvalidOperationException("To load a dumped ELF image, you must specify the image base virtual address"); throw new InvalidOperationException("To load a dumped ELF image, you must specify the image base virtual address");
}
// Rebase if requested (whether dumped or not) and treat it as a memory image,
// disabling processing of relocations, symbols and decryption
if (LoadOptions.ImageBase != 0) {
isMemoryImage = true;
rebase(conv.FromULong(LoadOptions.ImageBase)); rebase(conv.FromULong(LoadOptions.ImageBase));
} }

View File

@@ -9,9 +9,9 @@ namespace Il2CppInspector
// Modifiers for use when loading binary files // Modifiers for use when loading binary files
public class LoadOptions public class LoadOptions
{ {
// For dumped ELF files, the virtual address to which we should rebase - ignored for other file types // For ELF files, the virtual address to which we should rebase - ignored for other file types
// Use 2^64-1 to prevent rebasing on a dumped file // Use zero to prevent rebasing
public ulong ImageBase { get; set; } public ulong ImageBase { get; set; } = 0ul;
// For Linux process memory map inputs, we need the full path so we can find the .bin files // For Linux process memory map inputs, we need the full path so we can find the .bin files
// For packed PE files, we need the full path to reload the file via Win32 API // For packed PE files, we need the full path to reload the file via Win32 API

View File

@@ -240,10 +240,7 @@ namespace Il2CppInspectorGUI
// Reset image load options to their defaults // Reset image load options to their defaults
public void ResetLoadOptions() { public void ResetLoadOptions() {
ImageLoadOptions = new LoadOptions { ImageLoadOptions = new LoadOptions();
ImageBase = 0xffffffff_ffffffff,
BinaryFilePath = null
};
} }
// Attempt to load an IL2CPP application package (APK or IPA) // Attempt to load an IL2CPP application package (APK or IPA)

View File

@@ -60,7 +60,7 @@
<TextBox.ToolTip> <TextBox.ToolTip>
<ToolTip Background="LightYellow"> <ToolTip Background="LightYellow">
<TextBlock> <TextBlock>
For ELF binaries that have been dumped from memory, specify the base address of the dump<LineBreak/>Ignored for normal ELF binaries For ELF binaries that have been dumped from memory, specify the base address of the dump<LineBreak/>Use zero to disable rebasing
</TextBlock> </TextBlock>
</ToolTip> </ToolTip>
</TextBox.ToolTip> </TextBox.ToolTip>