Perfare / Il2CppDumper

Unity il2cpp reverse engineer
MIT License
6.9k stars 1.35k forks source link

Error while generating struct #687

Closed AF-Source closed 1 year ago

AF-Source commented 1 year ago

Whenever I dump everything works but for some reason I get this error when it's trying to generate struct. In config, if I set 'GenerateStruct' to false, it works, however I need the struct. The error I get: System.InvalidOperationException: Sequence contains no matching element at System.Linq.ThrowHelper.ThrowNoMatchException() at Il2CppDumper.Macho64.MapVATR(UInt64 addr) in C:\projects\il2cppdumper\Il2CppDumper\ExecutableFormats\Macho64.cs:line 74 at Il2CppDumper.StructGenerator.ParseType(Il2CppType il2CppType, Il2CppGenericContext context) in C:\projects\il2cppdumper\Il2CppDumper\Outputs\StructGenerator.cs:line 542 at Il2CppDumper.StructGenerator.WriteScript(String outputDir) in C:\projects\il2cppdumper\Il2CppDumper\Outputs\StructGenerator.cs:line 430 at Il2CppDumper.Program.Dump(Metadata metadata, Il2Cpp il2Cpp, String outputDir) in C:\projects\il2cppdumper\Il2CppDumper\Program.cs:line 268 at Il2CppDumper.Program.Main(String[] args) in C:\projects\il2cppdumper\Il2CppDumper\Program.cs:line 102 I attached the archive with the metadata and executable file below archive.zip

AF-Source commented 1 year ago

Anything? If not, do you need me to provide anything else? EDIT: Il2Cpp Version 29 Metadata Version 29 Target Unity Version 2021.3 Il2CppDumper-net7-v6.7.32

Perfare commented 1 year ago

After my testing I found that this is an error that should not occur. Are the executable and global-metadata.dat from the same version? Because I found that their modification time is quite different.

AF-Source commented 1 year ago

I'll check, but pretty sure it is. It dumps everything correctly and only structure failed to generated. I'll double check about that and see if that solves the issue.

AF-Source commented 1 year ago

I decrypted the app again and got a fresh .ipa, from there extracted the UnityFramework and metadata(which works successfully for the dump.cs file and the .dll inspection) but it still fails Initializing metadata... Metadata Version: 29 Initializing il2cpp file... Il2Cpp Version: 29 Searching... CodeRegistration : 30cefe8 MetadataRegistration : 317bd60 Dumping... Done! Generate struct... System.InvalidOperationException: Sequence contains no matching element at System.Linq.ThrowHelper.ThrowNoMatchException() at Il2CppDumper.Macho64.MapVATR(UInt64 addr) in C:\projects\il2cppdumper\Il2CppDumper\ExecutableFormats\Macho64.cs:line 74 at Il2CppDumper.StructGenerator.ParseType(Il2CppType il2CppType, Il2CppGenericContext context) in C:\projects\il2cppdumper\Il2CppDumper\Outputs\StructGenerator.cs:line 542 at Il2CppDumper.StructGenerator.WriteScript(String outputDir) in C:\projects\il2cppdumper\Il2CppDumper\Outputs\StructGenerator.cs:line 430 at Il2CppDumper.Program.Dump(Metadata metadata, Il2Cpp il2Cpp, String outputDir) in C:\projects\il2cppdumper\Il2CppDumper\Program.cs:line 268 at Il2CppDumper.Program.Main(String[] args) in C:\projects\il2cppdumper\Il2CppDumper\Program.cs:line 102 Here is the new metadata and executable file(they should be the same as the previous one I uploaded though) new_upload.zip I am running Microsoft.NETCore.App 7.0.2 not sure if that would be relevant here though. If you need any further logs/information on my system, let me know.

AF-Source commented 1 year ago

Hi. Can I ask what the issue was with? I am genuinely curious from a developer perspective?

Perfare commented 1 year ago

In fact, I don't know what the reason is. This error should not exist. My practice is to let him not report the error.

vivi170 commented 2 weeks ago

Read config... config.json file does not exist. Using defaults Initializing metadata... Metadata Version: 24.1 Initializing il2cpp file... Applying relocations... Il2Cpp Version: 24.1 Inputted address: 8DF6F000 Searching... CodeRegistration : 0 MetadataRegistration : 95a4a27c CodeRegistration : 95a4a244 MetadataRegistration : 95a4a27c Output path: C:\Users\TB.RD vivi\Downloads\GAME GUARDIAN\ Dumping... Done! Generate struct... There was an error trying to generate struct: System.IO.EndOfStreamException: Unable to read beyond the end of the stream. at System.IO.BinaryReader.ReadByte() at Il2CppDumper.BinaryStream.ReadStringToNull(UInt64 addr) at Il2CppDumper.Metadata.GetStringFromIndex(UInt32 index) at Il2CppDumper.StructGenerator.AddVTableMethod(StructInfo structInfo, Il2CppTypeDefinition typeDef) at Il2CppDumper.StructGenerator.AddStruct(Il2CppTypeDefinition typeDef) at Il2CppDumper.StructGenerator.WriteScript(String outputDir) at Il2CppDumper.FormGUI.Dump(Metadata metadata, Il2Cpp il2Cpp, String outputDir) Generating dummy dll... System.ArgumentException: An item with the same key has already been added. Key: 173 at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior) at Il2CppDumper.DummyAssemblyGenerator..ctor(Il2CppExecutor il2CppExecutor, Boolean addToken) at Il2CppDumper.DummyAssemblyExporter.Export(Il2CppExecutor il2CppExecutor, String outputDir, Boolean addToken) at Il2CppDumper.FormGUI.Dump(Metadata metadata, Il2Cpp il2Cpp, String outputDir) at Il2CppDumper.FormGUI.Dumper(String file, String metadataPath, String outputPath)

how do I solve this error