diff --git a/Il2CppDumper.sln b/Il2CppDumper.sln
index 0217444..2984437 100644
--- a/Il2CppDumper.sln
+++ b/Il2CppDumper.sln
@@ -1,9 +1,11 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 16
-VisualStudioVersion = 16.0.29806.167
+# Visual Studio Version 17
+VisualStudioVersion = 17.1.32228.430
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Il2CppDumper", "Il2CppDumper\Il2CppDumper.csproj", "{2087F99A-A655-41C1-84BB-54798AEA4080}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Il2CppDumper", "Il2CppDumper\Il2CppDumper.csproj", "{2087F99A-A655-41C1-84BB-54798AEA4080}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Il2CppDumper-x86", "Il2CppDumper\Il2CppDumper-x86.csproj", "{D108619F-DD4C-4D70-ABC2-861E17DB5AC1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -15,6 +17,10 @@ Global
{2087F99A-A655-41C1-84BB-54798AEA4080}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2087F99A-A655-41C1-84BB-54798AEA4080}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2087F99A-A655-41C1-84BB-54798AEA4080}.Release|Any CPU.Build.0 = Release|Any CPU
+ {D108619F-DD4C-4D70-ABC2-861E17DB5AC1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {D108619F-DD4C-4D70-ABC2-861E17DB5AC1}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {D108619F-DD4C-4D70-ABC2-861E17DB5AC1}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {D108619F-DD4C-4D70-ABC2-861E17DB5AC1}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/Il2CppDumper/Il2CppDumper-x86.csproj b/Il2CppDumper/Il2CppDumper-x86.csproj
new file mode 100644
index 0000000..542e6f4
--- /dev/null
+++ b/Il2CppDumper/Il2CppDumper-x86.csproj
@@ -0,0 +1,24 @@
+
+
+
+ Exe
+ net472;net5.0;net6.0
+ 1.0.0.0
+ 1.0.0.0
+ 1.0.0.0
+ Copyright © Perfare 2016-2022
+ true
+ AnyCPU
+ embedded
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Il2CppDumper/Il2CppDumper.csproj b/Il2CppDumper/Il2CppDumper.csproj
index 54b560b..7be5009 100644
--- a/Il2CppDumper/Il2CppDumper.csproj
+++ b/Il2CppDumper/Il2CppDumper.csproj
@@ -3,10 +3,12 @@
Exe
net472;net5.0;net6.0
- 1.0.0
+ 1.0.0.0
1.0.0.0
1.0.0.0
- Copyright © Perfare 2016-2020
+ Copyright © Perfare 2016-2022
+ AnyCPU
+ embedded
diff --git a/Il2CppDumper/Utils/PELoader.cs b/Il2CppDumper/Utils/PELoader.cs
index dd5eef5..d021fa1 100644
--- a/Il2CppDumper/Utils/PELoader.cs
+++ b/Il2CppDumper/Utils/PELoader.cs
@@ -1,4 +1,5 @@
using System;
+using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
@@ -27,10 +28,13 @@ namespace Il2CppDumper
throw new InvalidDataException("ERROR: Invalid PE file");
}
var fileHeader = reader.ReadClass();
- if ((fileHeader.Machine == 0x14c && Environment.Is64BitProcess) //64bit process can't load 32bit dll
- || (fileHeader.Machine == 0x8664 && !Environment.Is64BitProcess)) //32bit process can't load 64bit dll
+ if (fileHeader.Machine == 0x14c && Environment.Is64BitProcess) //64bit process can't load 32bit dll
{
- return new PE(new MemoryStream(buff));
+ throw new InvalidOperationException("The file is a 32-bit file, please try to load it with Il2CppDumper-x86.exe");
+ }
+ if (fileHeader.Machine == 0x8664 && !Environment.Is64BitProcess) //32bit process can't load 64bit dll
+ {
+ throw new InvalidOperationException("The file is a 64-bit file, please try to load it with Il2CppDumper.exe");
}
var pos = reader.Position;
reader.Position = pos + fileHeader.SizeOfOptionalHeader;
@@ -41,9 +45,7 @@ namespace Il2CppDumper
var handle = LoadLibrary(fileName);
if (handle == IntPtr.Zero)
{
- //Missing dependent DLL
- //throw new Win32Exception();
- return new PE(new MemoryStream(buff));
+ throw new Win32Exception(Marshal.GetLastWin32Error());
}
foreach (var section in sections)
{