vfsfitvnm / frida-il2cpp-bridge

A Frida module to dump, trace or hijack any Il2Cpp application at runtime, without needing the global-metadata.dat file.
https://github.com/vfsfitvnm/frida-il2cpp-bridge/wiki
MIT License
918 stars 191 forks source link

How to get and set object field #449

Closed 2361788963 closed 6 months ago

2361788963 commented 7 months ago

How to get and set object field I don't know how it works in frida-il2cpp-bridge. Why not use il2cpp_field_get_value and il2cpp_field_set_value?

vfsfitvnm commented 7 months ago

You can use Il2Cpp.Field::value:

console.log("value is", yourObject.field("fieldName").value);
// change its value
yourObject.field("fieldName").value = 1234;

This is how static fields are read (il2cpp_field_static_get_value): https://github.com/vfsfitvnm/frida-il2cpp-bridge/blob/97ffc512a8a73886fa413716886327c3546c8134/src/structs/field.ts#L78

And this is how instance fields are read (via pointers): https://github.com/vfsfitvnm/frida-il2cpp-bridge/blob/97ffc512a8a73886fa413716886327c3546c8134/src/structs/field.ts#L133

RevealedSoulEven commented 6 months ago

How to view stack and other types like

private Stack`1 projectilePool; // 0xb8
RevealedSoulEven commented 6 months ago

Please give a way @vfsfitvnm