mirror of
https://github.com/Perfare/Il2CppDumper.git
synced 2025-01-25 10:13:01 -03:00
Fixed #394
This commit is contained in:
parent
95173b37a6
commit
7f2817ef12
1 changed files with 5 additions and 3 deletions
|
@ -25,20 +25,22 @@ namespace Il2CppDumper
|
||||||
}
|
}
|
||||||
var fileHeader = ReadClass<FileHeader>();
|
var fileHeader = ReadClass<FileHeader>();
|
||||||
var pos = Position;
|
var pos = Position;
|
||||||
if (fileHeader.Machine == 0x14c) //Intel 386
|
var magic = ReadUInt16();
|
||||||
|
Position -= 2;
|
||||||
|
if (magic == 0x10b)
|
||||||
{
|
{
|
||||||
Is32Bit = true;
|
Is32Bit = true;
|
||||||
var optionalHeader = ReadClass<OptionalHeader>();
|
var optionalHeader = ReadClass<OptionalHeader>();
|
||||||
imageBase = optionalHeader.ImageBase;
|
imageBase = optionalHeader.ImageBase;
|
||||||
}
|
}
|
||||||
else if (fileHeader.Machine == 0x8664) //AMD64
|
else if (magic == 0x20b)
|
||||||
{
|
{
|
||||||
var optionalHeader = ReadClass<OptionalHeader64>();
|
var optionalHeader = ReadClass<OptionalHeader64>();
|
||||||
imageBase = optionalHeader.ImageBase;
|
imageBase = optionalHeader.ImageBase;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new NotSupportedException("ERROR: Unsupported machine.");
|
throw new NotSupportedException($"Invalid Optional header magic {magic}");
|
||||||
}
|
}
|
||||||
Position = pos + fileHeader.SizeOfOptionalHeader;
|
Position = pos + fileHeader.SizeOfOptionalHeader;
|
||||||
sections = ReadClassArray<SectionHeader>(fileHeader.NumberOfSections);
|
sections = ReadClassArray<SectionHeader>(fileHeader.NumberOfSections);
|
||||||
|
|
Loading…
Add table
Reference in a new issue