Skip to content

Failed to find code/metadata registration on Android ARM APK #508

@321Proteus

Description

@321Proteus

I've downloaded an Android package using APKDownloader and tried to run it through Cpp2IL using a 64-bit Linux machine, but got the following error output:

$ cpp2il-dev \
    --game-path Game_merged.apk \               
    --verbose
===Cpp2IL by Samboy063===
A Tool to Reverse Unity's "il2cpp" Build Process.
Version 2022.1.0+e66a74bb3a36e9593e30008d48e67264ddb8a5b3

[Info] [Program] Running on Unix
[Info] [Plugins] Loading plugins from /home/user/Game/Plugins...
[Verb] [Plugins] Collecting and instantiating plugins...
[Verb] [Plugins]        Loading plugin Cpp2IL.Core.Cpp2IlCorePlugin from assembly: Cpp2IL.Core.dll
[Verb] [Plugins] Invoking OnLoad on 1 plugins.
[Verb] [Plugin: Cpp2IL Built-In] Initializing...
[Verb] [Plugin: Cpp2IL Built-In]        Registering built-in instruction set handlers...
[Verb] [Plugin: Cpp2IL Built-In]        Registering built-in binary parsers...
[Verb] [Plugin: Cpp2IL Built-In]        Registering built-in output formats...
[Verb] [Plugin: Cpp2IL Built-In]        Registering built-in processing layers
[Verb] [Plugin: Cpp2IL Built-In] Core plugin loaded in 112825 ticks (11.2825ms)
[Info] [Plugins] Using Plugin: Cpp2IL Built-In
[Verb] [Plugins] OnLoad complete
[Verb] [Program] Beginning path resolution...
[Verb] [Program] Trying HandleSingleApk as provided path is an apk file
[Info] [APK] Attempting to extract required files from APK Game_merged.apk
[Info] [APK] Extracting APK/lib/armeabi-v7a/libil2cpp.so to /tmp/tmpMiCMk8.tmp
[Info] [APK] Extracting APK/assets/bin/Data/Managed/Metadata/global-metadata.dat to /tmp/tmpgJTUiM.tmp
[Info] [APK] Reading globalgamemanagers to determine unity version...
[Info] [APK] Determined game's unity version to be 2021.3.56f2
[Verb] [Program] No processing layers requested
[Info] [Library] Initializing Metadata...
[Verb] [Library]        IL2CPP Metadata Declares its version as 31
[Info] [Library]        Using actual IL2CPP Metadata version 31
[Verb] [Library]        Reading image definitions...OK (0.4965 ms)
[Verb] [Library]        Reading assembly definitions...OK (0.3009 ms)
[Verb] [Library]        Reading type definitions...20934 OK (5.3003 ms)
[Verb] [Library]        Reading interface offsets...OK (0.9484 ms)
[Verb] [Library]        Reading vtable indices...OK (6.753 ms)
[Verb] [Library]        Reading method definitions...OK (93.5487 ms)
[Verb] [Library]        Reading method parameter definitions...OK (33.3146 ms)
[Verb] [Library]        Reading field definitions...OK (48.6994 ms)
[Verb] [Library]        Reading default field values...OK (1.0842 ms)
[Verb] [Library]        Reading default parameter values...OK (0.2468 ms)
[Verb] [Library]        Reading property definitions...OK (8.6806 ms)
[Verb] [Library]        Reading interface definitions...OK (1.0654 ms)
[Verb] [Library]        Reading nested type definitions...OK (17.3651 ms)
[Verb] [Library]        Reading event definitions...OK (0.6602 ms)
[Verb] [Library]        Reading generic container definitions...OK (0.3325 ms)
[Verb] [Library]        Reading generic parameter definitions...OK (0.5918 ms)
[Verb] [Library]        Reading generic parameter constraint indices...OK (0.0505 ms)
[Verb] [Library]        Reading referenced assemblies...OK (0.0454 ms)
[Verb] [Library]        Reading string definitions...OK (1.149 ms)
[Verb] [Library]        Reading field references...OK (0.1479 ms)
[Verb] [Library]        Reading Attribute data...OK (2.4197 ms)
[Verb] [Library]        Building Lookup Table for field defaults...OK (8.0914 ms)
[Info] [Library] Initialized Metadata in 237ms
[Info] [Library] Using binary type ELF (from LibCpp2IL)
[Info] [Library] Searching Binary for Required Data...
[Verb] [Library]        Reading Elf File Ident...OK (0.2754 ms)
[Verb] [Library]        Binary is 32-bit and little-endian.
[Verb] [Library]        Reading and validating full ELF header...OK (0.2883 ms)
[Verb] [Library]        Elf File contains instructions of type ArmV7
[Verb] [Library]        Reading ELF program header table...Read 8 OK (0.3161 ms)
[Verb] [Library]        Reading ELF section header table and names...
[Verb] [Library]                -Name for section at 0x0 is 
[Verb] [Library]                -Name for section at 0x134 is .note.android.ident
[Verb] [Library]                -Name for section at 0x1CC is .note.gnu.build-id
[Verb] [Library]                -Name for section at 0x1F0 is .dynsym
[Verb] [Library]                -Name for section at 0xB3B0 is .dynstr
[Verb] [Library]                -Name for section at 0x274A0 is .gnu.hash
[Verb] [Library]                -Name for section at 0x2C3F8 is .hash
[Verb] [Library]                -Name for section at 0x31084 is .gnu.version
[Verb] [Library]                -Name for section at 0x326BC is .gnu.version_d
[Verb] [Library]                -Name for section at 0x326D8 is .gnu.version_r
[Verb] [Library]                -Name for section at 0x32738 is .rel.dyn
[Verb] [Library]                -Name for section at 0x6BC830 is .rel.plt
[Verb] [Library]                -Name for section at 0x6BED58 is .plt
[Verb] [Library]                -Name for section at 0x6C2530 is .text
[Verb] [Library]                -Name for section at 0xFA4CA0 is il2cpp
[Verb] [Library]                -Name for section at 0x6292E7C is .ARM.exidx
[Verb] [Library]                -Name for section at 0x6510284 is .ARM.extab
[Verb] [Library]                -Name for section at 0x675DE08 is .rodata
[Verb] [Library]                -Name for section at 0x7040D20 is .data.rel.ro
[Verb] [Library]                -Name for section at 0x7286C18 is .fini_array
[Verb] [Library]                -Name for section at 0x7286C20 is .init_array
[Verb] [Library]                -Name for section at 0x7286C80 is .dynamic
[Verb] [Library]                -Name for section at 0x7286DA4 is .got
[Verb] [Library]                -Name for section at 0x72E8000 is .data
[Verb] [Library]                -Name for section at 0x74D0F28 is .bss
[Verb] [Library]                -Name for section at 0x74D0F28 is .comment
[Verb] [Library]                -Name for section at 0x74D1008 is .note.gnu.gold-version
[Verb] [Library]                -Name for section at 0x74D1024 is .ARM.attributes
[Verb] [Library]                -Name for section at 0x74D105C is .gnu_debuglink
[Verb] [Library]                -Name for section at 0x74D1074 is .shstrtab
[Verb] [Library]        Read 30 OK (1.2236 ms)
[Verb] [Library]        ELF global offset is 0x0
[Verb] [Library]        Finding Relocations...
[Verb] [Library]                -Got 857119 from REL section .rel.dyn
[Verb] [Library]                -Got 1189 from REL section .rel.plt
[Verb] [Library]                -Ignoring dynamic REL section starting at 0x206648 because it's already been processed.
[Verb] [Library]        -Now Processing 858308 relocations...OK (381.7109 ms)
[Verb] [Library]        Processing Symbols...
[Verb] [Library]                -Found .dynsym at 0x1F0
[Verb] [Library]                -Found DT_SYMTAB at 0x1F0
[Verb] [Library]                -Found 2844 symbols in table at 0x1F0
[Verb] [Library]                -Found 15 symbols in table at 0x1F0
[Verb] [Library]        OK (6.5753 ms)
[Verb] [Library]        Processing Initializers...Got 24 OK (1.6272 ms)
[Verb] [Library]        Checking ELF Symbol Table for code and/or meta reg...Didn't find them, scanning binary...
[Verb] [Library] Searching for il2cpp structures in an ELF binary using non-arch-specific method...
[Verb] [Library]        Looking for code reg (this might take a while)...
[Verb] [Library]                        Looking for bytes: 6d 73 63 6f 72 6c 69 62 2e 64 6c 6c 00
[Verb] [Library]                        Found 1 occurrences of mscorlib.dll: [67B6DCE]
[Verb] [Library]                        Looking for bytes: ce 6d 7b 06
[Verb] [Library]                        Found 1 potential codegen modules for mscorlib: [7263708]
[Verb] [Library]                        Looking for bytes: 08 37 26 07
[Verb] [Library]                        Found 1 address for potential codegen modules in potential codegen module lists: [7315090]
[Verb] [Library]                        Looking for bytes: 20 4e 31 07
[Verb] [Library]                        Looking for bytes: 1c 4e 31 07
[Verb] [Library]                        Looking for bytes: 18 4e 31 07
[Verb] [Library]                        Looking for bytes: 14 4e 31 07
[Verb] [Library]                        Looking for bytes: 10 4e 31 07
[Verb] [Library]                        Looking for bytes: 0c 4e 31 07
[Verb] [Library]                        Looking for bytes: 08 4e 31 07
[Verb] [Library]                        Looking for bytes: 04 4e 31 07
[Verb] [Library]                        Looking for bytes: 00 4e 31 07
[Verb] [Library]                        Looking for bytes: fc 4d 31 07
[Warn] [Library] Hit backtrack limit of 166 modules and still didn't find a valid pCodegenModules pointer.
[Verb] [Library]        Got code reg 0x0
[Verb] [Library]        Looking for meta reg (post-27)...
[Verb] [Library]                        Looking for the number of type definitions, 0x51C6
[Verb] [Library]                        Looking for bytes: c6 51 00 00
[Verb] [Library]                        Found 8 instances of the number of type definitions: [6B48C2C, 6BEC420, 6C9B684, 6CF3984, 6D6A4D4, 6D74AE8, 71DF0F8, 71DF100]
[Verb] [Library]                        Found 8 potential metadata registrations: [6B48BFC, 6BEC3F0, 6C9B654, 6CF3954, 6D6A4A4, 6D74AB8, 71DF0C8, 71DF0D0]
[Verb] [Library]                        Rejected Metadata registration at 0x6B48BFC, because it has a count field 0xFFFFFFFF at offset 2 which is above sanity limit of 0xC0000. If metadata registration detection fails, may need to bump up the limit.
[Verb] [Library]                        Warning: metadata registration 0x6BEC3F0 has 2424 metadata usages at a pointer of 0x5B46. We're on v27, these should be 0.
[Verb] [Library]                        Rejecting metadata registration 0x6BEC3F0 because it has 2422 types, which is less than metadata-file-defined type def count of 20934
[Verb] [Library]                        Warning: metadata registration 0x6C9B654 has 69639 metadata usages at a pointer of 0x100ED. We're on v27, these should be 0.
[Verb] [Library]                        Rejecting metadata registration 0x6C9B654 because it has 69638 field offsets, while metadata file defines 20934 type defs
[Verb] [Library]                        Rejecting metadata registration 0x6CF3954 because the pointer at index 1, which is 0xFFFFFFFF, can't be mapped to the binary.
[Verb] [Library]                        Warning: metadata registration 0x6D6A4A4 has 127406 metadata usages at a pointer of 0x1CF05. We're on v27, these should be 0.
[Verb] [Library]                        Rejecting metadata registration 0x6D6A4A4 because it has 127405 field offsets, while metadata file defines 20934 type defs
[Verb] [Library]                        Warning: metadata registration 0x6D74AB8 has 121190 metadata usages at a pointer of 0x541A. We're on v27, these should be 0.
[Verb] [Library]                        Rejecting metadata registration 0x6D74AB8 because it has 121189 field offsets, while metadata file defines 20934 type defs
[Verb] [Library]                        Rejected Metadata registration at 0x71DF0C8, because it has a count field 0x25E5AF8 at offset 0 which is above sanity limit of 0xC0000. If metadata registration detection fails, may need to bump up the limit.
[Verb] [Library]                        Accepting metadata reg as VA 0x71DF0D0
[Verb] [Library]        Got meta reg 0x71df0d0
[Info] [Library] Got Binary codereg: 0x0, metareg: 0x71DF0D0 in 730ms.
[Info] [Library] Initializing Binary...
[Warn] [Library] At least one of the registration structs was not able to be found. Attempting to use fallback locator delegate to find them (this will fail unless you have a plugin that helps with this!)...
[Verb] [Library] After fallback, code registration is null and metadata registration is not null.
[Fail] [Program] 

Cpp2IL.Core.Exceptions.LibCpp2ILInitializationException: Fatal Exception initializing LibCpp2IL!
 ---> System.Exception: Failed to find code registration or metadata registration!
   at LibCpp2IL.Il2CppBinary.Init(UInt64 pCodeRegistration, UInt64 pMetadataRegistration, Il2CppMetadata metadata) in /home/user/.cache/yay/cpp2il-dev-git/src/cpp2il-dev/LibCpp2IL/Il2CppBinary.cs:line 83
   at LibCpp2IL.LibCpp2IlBinaryRegistry.CreateAndInit(Byte[] buffer, Il2CppMetadata metadata) in /home/user/.cache/yay/cpp2il-dev-git/src/cpp2il-dev/LibCpp2IL/LibCpp2IlBinaryRegistry.cs:line 77
   at LibCpp2IL.LibCpp2IlMain.Initialize(Byte[] binaryBytes, Byte[] metadataBytes, UnityVersion unityVersion) in /home/user/.cache/yay/cpp2il-dev-git/src/cpp2il-dev/LibCpp2IL/LibCpp2IlMain.cs:line 162
   at LibCpp2IL.LibCpp2IlMain.LoadFromFile(String pePath, String metadataPath, UnityVersion unityVersion) in /home/user/.cache/yay/cpp2il-dev-git/src/cpp2il-dev/LibCpp2IL/LibCpp2IlMain.cs:line 206
   at Cpp2IL.Core.Cpp2IlApi.InitializeLibCpp2Il(String assemblyPath, String metadataPath, UnityVersion unityVersion, Boolean allowUserToInputAddresses) in /home/user/.cache/yay/cpp2il-dev-git/src/cpp2il-dev/Cpp2IL.Core/Cpp2IlApi.cs:line 67
   --- End of inner exception stack trace ---
   at Cpp2IL.Core.Cpp2IlApi.InitializeLibCpp2Il(String assemblyPath, String metadataPath, UnityVersion unityVersion, Boolean allowUserToInputAddresses) in /home/user/.cache/yay/cpp2il-dev-git/src/cpp2il-dev/Cpp2IL.Core/Cpp2IlApi.cs:line 73
   at Cpp2IL.Program.MainWithArgs(Cpp2IlRuntimeArgs runtimeArgs) in /home/user/.cache/yay/cpp2il-dev-git/src/cpp2il-dev/Cpp2IL/Program.cs:line 679
   at Cpp2IL.Program.Main(String[] args) in /home/user/.cache/yay/cpp2il-dev-git/src/cpp2il-dev/Cpp2IL/Program.cs:line 617

This happens for both armeabi-v7a and arm64-v8a. I've also noticed that the same error is shown when I apply the metadata and the IL2CPP binary separately (that's how I downloaded them, the log is shown for the package merged by APKEditor)
For convenience, I've uploaded the file to my Google Drive.
Any advice or help will be very appreciated!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions