Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WASM Dumping Issue. #471

Closed
pjsny opened this issue Jun 7, 2021 · 9 comments
Closed

WASM Dumping Issue. #471

pjsny opened this issue Jun 7, 2021 · 9 comments

Comments

@pjsny
Copy link

pjsny commented Jun 7, 2021

  • Il2CppDumper version - v6.6.2

  • Target Unity version - Unknown, Metadata Version = 27

  • Describe the issue

Initializing metadata...
Metadata Version: 27
Initializing il2cpp file...
Il2Cpp Version: 27
Searching...
System.IO.EndOfStreamException: Unable to read beyond the end of the stream.
at System.IO.__Error.EndOfFile()
at System.IO.BinaryReader.FillBuffer(Int32 numBytes)
at System.IO.BinaryReader.ReadUInt32()
at Il2CppDumper.PlusSearch.FindReference(UInt64 addr) in C:\projects\il2cppdumper\Il2CppDumper\Utils\PlusSearch.cs:line 359
at Il2CppDumper.PlusSearch.FindCodeRegistration2019() in C:\projects\il2cppdumper\Il2CppDumper\Utils\PlusSearch.cs:line 339
at Il2CppDumper.WebAssemblyMemory.PlusSearch(Int32 methodCount, Int32 typeDefinitionsCount, Int32 imageCount) in C:\projects\il2cppdumper\Il2CppDumper\ExecutableFormats\WebAssemblyMemory.cs:line 48
at Il2CppDumper.Program.Init(String il2cppPath, String metadataPath, Metadata& metadata, Il2Cpp& il2Cpp) in C:\projects\il2cppdumper\Il2CppDumper\Program.cs:line 197
ERROR: An error occurred while processing.

Files to reproduce

files.zip

@OdinVex
Copy link

OdinVex commented Jun 7, 2021

I get EOF issues too but only when targetting the Linux build of a game versus the Windows one which works, Metadata 24.2. The Linux version will report "WARNING: find .init_proc" with CR and MR reporting 0. Looking into it on my own. I'll probably have to just hook "il2cpp_class_from_name" and "il2cpp_class_get_method_from_name".

@pjsny
Copy link
Author

pjsny commented Jun 8, 2021

Yeah, this is targeting the Web-Assembly build. No native executable for this game, unfortunately.

@OdinVex
Copy link

OdinVex commented Jun 11, 2021

Mine is a native build though, so I'll probably just clone and work on it myself sometime.

@Perfare Perfare added the pending label Jul 6, 2021
@Brian151
Copy link

how do i even get the global-metadata.dat file from a unity webgl game?

@pjsny
Copy link
Author

pjsny commented Aug 13, 2021

Any update on this?

@soyasoya5
Copy link
Contributor

soyasoya5 commented Sep 26, 2021

Have you try setting offsetEnd and addressEnd in this file to STATICTOP?

offsetEnd = long.MaxValue, //hack

According to this answer by @Perfare , you'll have to find the STATICTOP variable in the Unity framework .js file.
#202 (comment)

It may look like this

    GLOBAL_BASE = 1024;
    STATIC_BASE = GLOBAL_BASE;
    STATICTOP = STATIC_BASE + 4397328;

As for obtaining the global-metadata.dat files for Unity WebGL builds, there are hints in the issue I linked above, it should be easy enough to obtain as the data files are usually sent alongside with the .wasm file.

Edit:
After some testing with some WASM dumping on my own and receiving the same error as OP, I've found that the error was not related to the stream processing at all. I managed to obtain a working set of dumps after inputting the correct CodeRegistration and MetadataRegistration. Is it possible that you did not input the correct CodeRegistration & MetadataRegistration?

@me0wday
Copy link

me0wday commented Sep 28, 2021

@soyasoya5 I was experimenting with this too, I noticed for me the tool had issues finding the MetadataRegistration address, any chance you can provide some information on how you found it manually in the wasm file?

@soyasoya5
Copy link
Contributor

@soyasoya5 I was experimenting with this too, I noticed for me the tool had issues finding the MetadataRegistration address, any chance you can provide some information on how you found it manually in the wasm file?

I used wasm2wat to translate it into text format

@zonya1
Copy link

zonya1 commented Oct 1, 2021

so I managed to dump a WebGL game. but do anyone know if its possible to "cross-reference" the methods from the DLLs containing the method names to the WASM file (to find the method in WAT text format)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants