sneakyevil / IL2CPP_Resolver

A run-time API resolver for IL2CPP Unity.
https://sneakyevil.gitbook.io/il2cpp-resolver/
The Unlicense
362 stars 67 forks source link

Crash on calling IL2CPP::Callback::Initialize(); #61

Open PetrSeifert opened 4 weeks ago

PetrSeifert commented 4 weeks ago

What is the game you are using with IL2CPP Resolver?

https://store.steampowered.com/app/2659050/Movies_Tycoon/

Details:

For the first time, I am trying to create a cheat for the Unity IL2CPP game. This repo seemed useful, so I tried implementing it together with Minhook, but I am crashing on the callback initialization. 

Here is information from the dump file:

ERROR_CODE: (NTSTATUS) 0xc0000005 - The instruction at 0x%p referenced memory at 0x%p. The memory could not be %s.

EXCEPTION_CODE_STR:  c0000005

EXCEPTION_PARAMETER1:  0000000000000008

EXCEPTION_PARAMETER2:  0000000000000000

STACK_TEXT:  
000000e6`5981f868 00007ffa`982b1d3a     : 00000223`206ba5f0 00000225`33b34480 00000000`00000000 00007ffa`60ac1600 : 0x0
000000e6`5981f870 00007ffa`982b2c35     : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : IL2CPP!IL2CPP::Callback::Initialize+0xea
000000e6`5981f8e0 00007ffb`3d79257d     : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : IL2CPP!MainThread+0xf5
000000e6`5981f920 00007ffb`3e2eaf08     : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : kernel32!BaseThreadInitThunk+0x1d
000000e6`5981f950 00000000`00000000     : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : ntdll!RtlUserThreadStart+0x28

FAULTING_SOURCE_LINE:  E:\Programming\IL2CPP-Cheat\Il2cpp_Resolver\API\Callback.hpp

FAULTING_SOURCE_FILE:  E:\Programming\IL2CPP-Cheat\Il2cpp_Resolver\API\Callback.hpp

FAULTING_SOURCE_LINE_NUMBER:  56

FAULTING_SOURCE_CODE:  
    70: 
    71:         CComponent* GetComponentByIndex(il2cppObject* m_pSystemType, unsigned int m_uIndex = 0U)
    72:         {
    73:             il2cppArray<CComponent*>* m_pComponents = GetComponents(m_pSystemType);
>   74:             if (!m_pComponents || m_uIndex >= m_pComponents->m_uMaxLength) return nullptr;
    75: 
    76:             return m_pComponents->operator[](m_uIndex);
    77:         }
    78: 
    79:         CComponent* GetComponentByIndex(const char* m_pSystemTypeName, unsigned int m_uIndex = 0U)

Screenshots/Video:

No response

Minimal, Complete and Verifiable Example code:

Here is my repo with minimal reproduction: https://github.com/PetrSeifert/IL2CPP_Cheat/tree/mcve