Il2CppInspector icon indicating copy to clipboard operation
Il2CppInspector copied to clipboard

IDA Python script - "Syntax error near: ..."

Open teslabyte opened this issue 3 years ago • 2 comments

Using the latest GUI version of Il2cppInspector and IDA 7.0 (also tried 7.5 where the same thing happens). One part of IDA's output window (it's very long):

SetType(0xa06c84, 'void LuaFunction_SetEnv(LuaFunction * this, LuaTable * env, MethodInfo * method);') failed!
Syntax error near: LuaFunction
SetType(0xa06d14, 'void LuaFunction_push(LuaFunction * this, void * L, MethodInfo * method);') failed!
Syntax error near: LuaFunction
SetType(0xa06d4c, 'String * LuaFunction_ToString(LuaFunction * this, MethodInfo * method);') failed!
Syntax error near: LuaTable
SetType(0xa06de8, 'void LuaTable__ctor(LuaTable * this, int32_t reference, LuaEnv * luaenv, MethodInfo * method);') failed!
Syntax error near: LuaTable
SetType(0xa06e10, 'Object * LuaTable_get_Item(LuaTable * this, String * field, MethodInfo * method);') failed!
Syntax error near: LuaTable
SetType(0xa06e7c, 'void LuaTable_set_Item(LuaTable * this, String * field, Object * value, MethodInfo * method);') failed!
Syntax error near: LuaTable
SetType(0xa06ef0, 'Object * LuaTable_get_Item_1(LuaTable * this, Object * field, MethodInfo * method);') failed!
Syntax error near: LuaTable
SetType(0xa06f5c, 'void LuaTable_set_Item_1(LuaTable * this, Object * field, Object * value, MethodInfo * method);') failed!
Syntax error near: LuaTable
SetType(0xa06fd0, 'int32_t LuaTable_get_Length(LuaTable * this, MethodInfo * method);') failed!
Syntax error near: IEnumerable
SetType(0xa07050, 'IEnumerable * LuaTable_GetKeys(LuaTable * this, MethodInfo * method);') failed!
Syntax error near: LuaTable
SetType(0xa070f0, 'void LuaTable_SetMetaTable(LuaTable * this, LuaTable * metaTable, MethodInfo * method);') failed!
Syntax error near: LuaTable
SetType(0xa071bc, 'void LuaTable_push(LuaTable * this, void * L, MethodInfo * method);') failed!
Syntax error near: LuaTable
SetType(0xa071f4, 'String * LuaTable_ToString(LuaTable * this, MethodInfo * method);') failed!
Syntax error near: LuaTable_GetKeys_c_Iterator0
SetType(0xa070e8, 'void LuaTable_GetKeys_c_Iterator0__ctor(LuaTable_GetKeys_c_Iterator0 * this, MethodInfo * method);') failed!
Syntax error near: LuaTable_GetKeys_c_Iterator0
SetType(0xa07288, 'bool LuaTable_GetKeys_c_Iterator0_MoveNext(LuaTable_GetKeys_c_Iterator0 * this, MethodInfo * method);') failed!
Syntax error near: LuaTable_GetKeys_c_Iterator0
SetType(0xa073f4, 'Object * LuaTable_GetKeys_c_Iterator0_System_Collections_Generic_IEnumerator_object__get_Current(LuaTable_GetKeys_c_Iterator0 * this, MethodInfo * method);') failed!
Syntax error near: LuaTable_GetKeys_c_Iterator0
SetType(0xa073fc, 'Object * LuaTable_GetKeys_c_Iterator0_System_Collections_IEnumerator_get_Current(LuaTable_GetKeys_c_Iterator0 * this, MethodInfo * method);') failed!
Syntax error near: LuaTable_GetKeys_c_Iterator0
SetType(0xa07404, 'void LuaTable_GetKeys_c_Iterator0_Dispose(LuaTable_GetKeys_c_Iterator0 * this, MethodInfo * method);') failed!
Syntax error near: LuaTable_GetKeys_c_Iterator0
SetType(0xa07418, 'void LuaTable_GetKeys_c_Iterator0_Reset(LuaTable_GetKeys_c_Iterator0 * this, MethodInfo * method);') failed!
Syntax error near: IEnumerator
SetType(0xa0749c, 'IEnumerator * LuaTable_GetKeys_c_Iterator0_System_Collections_IEnumerable_GetEnumerator(LuaTable_GetKeys_c_Iterator0 * this, MethodInfo * method);') failed!

The metadata and il2cpp file can be downloaded here

teslabyte avatar Jun 16 '21 18:06 teslabyte

If you see an error like Type 'X' is already defined it's probably due to a naming conflict. Fix that naming conflict and it should work.

kOchirasu avatar Aug 03 '21 05:08 kOchirasu

Having the same issue. The "Type 'X' is already defined" error appears for me, starting at the "Application types from method calls" segment of code. The specifics that appear are:

Error C:\path\cpp\appdata\il2cpp-types.h:2404: Type 'Object' is already defined
Error C:\path\cpp\appdata\il2cpp-types.h:2436: Type 'String' is already defined
Error C:\path\cpp\appdata\il2cpp-types.h:2440: Type 'Boolean' is already defined
Error C:\path\cpp\appdata\il2cpp-types.h:2528: Type 'Byte' is already defined
Error C:\path\cpp\appdata\il2cpp-types.h:2711: Type 'Object' is already defined
Error C:\path\cpp\appdata\il2cpp-types.h:2712: Syntax error near: }
Error C:\path\cpp\appdata\il2cpp-types.h:2725: Type 'Object' is already defined
Error C:\path\cpp\appdata\il2cpp-types.h:2727: Syntax error near: }
Error C:\path\cpp\appdata\il2cpp-types.h:2776: Type 'String' is already defined
Error C:\path\cpp\appdata\il2cpp-types.h:2777: Type 'String' is already defined
Error C:\path\cpp\appdata\il2cpp-types.h:2778: Type 'String' is already defined
Error C:\path\cpp\appdata\il2cpp-types.h:2781: Syntax error near: }
Error C:\path\cpp\appdata\il2cpp-types.h:2788: Type 'Object' is already defined
Error C:\path\cpp\appdata\il2cpp-types.h:2797: Syntax error near: }
Error C:\path\cpp\appdata\il2cpp-types.h:2804: Type 'Object' is already defined
Error C:\path\cpp\appdata\il2cpp-types.h:2814: Syntax error near: }
Error C:\path\cpp\appdata\il2cpp-types.h:2821: Type 'Object' is already defined
Error C:\path\cpp\appdata\il2cpp-types.h:2831: Syntax error near: }
Error C:\path\cpp\appdata\il2cpp-types.h:2847: Type 'String' is already defined
Error C:\path\cpp\appdata\il2cpp-types.h:2848: Type 'String' is already defined

After this, I have the same errors as teslabyte above, with none (or almost none, there's far too many errors for me to manually go through every one) of the functions having their types properly set. I'm not really sure where the naming conflict could come into play, especially since there are syntax errors and the such in here.

I used the command line version of Il2CppInspector, generated from source. I'm using IDA 7.5. The il2cpp and metadata file I'm working with can be found here, as well as the full console output of the script in a text file. (While I would love to just run the Il2CppInspector generated script for Ghidra, I don't have the ability to let a script run for 20+ days on my machine very easily.)

winterbreezesrule avatar Nov 05 '21 13:11 winterbreezesrule