Perfare / Il2CppDumper

Unity il2cpp reverse engineer
MIT License
6.94k stars 1.37k forks source link

compilation error in il2cpp.h Microsoft_Win32_RegistryKey_StaticFields #771

Closed sobakasu closed 9 months ago

sobakasu commented 9 months ago

6.7.40

Using Microsoft Visual Studio Community 2022 (64-bit) - Current Version 17.8.3 With default cpp / c compiler settings. The following struct has compilation errors:

struct Microsoft_Win32_RegistryKey_StaticFields {
    intptr_t HKEY_CLASSES_ROOT;
    intptr_t HKEY_CURRENT_USER;
    intptr_t HKEY_LOCAL_MACHINE;
    intptr_t HKEY_USERS;
    intptr_t HKEY_PERFORMANCE_DATA;
    intptr_t HKEY_CURRENT_CONFIG;
    intptr_t HKEY_DYN_DATA;
    struct System_String_array* s_hkeyNames;
};

if I use "expand inline" for the first field I get this:

    intptr_t((HKEY)(ULONG_PTR)((LONG)0x80000000));

errors:

Severity    Code    Description 
Error   C2059   syntax error: ')'           
Error   C2059   syntax error: '('           
Error   C2091   function returns function   
Error   C2143   syntax error: missing ')' before 'constant' 
Error   C2143   syntax error: missing ',' before 'constant'
Error   C4430   missing type specifier - int assumed. Note: C++ does not support default-int
Error   C2059   syntax error: 'constant'        

There were also some other errors like naming fields 'stdin' 'stdout' and 'stderr' that the compiler didn't like but they were easy to resolve.

sobakasu commented 9 months ago

I think most of these issues were caused by windows.h. I blame bill gates.

aleksilassila commented 1 month ago

Was there a solution to this other than manually renaming the fields?

sobakasu commented 1 month ago

Was there a solution to this other than manually renaming the fields?

from memory I think I resolved it in my project by changing the order of includes in my header files (windows.h after the il2cpp.h). I am now using this instead: https://github.com/LukeFZ/Il2CppInspectorRedux