Tutorial How to modify Set Methods in Unity's il2cpp

rikolig

Platinian
Jun 7, 2019
6
0
1
23
terter
Please help. I did everything according to the tutorial, but all to no avail. Can you suggest what I did wrong?

This is from dnspy
C++:
[Token(Token = "0x17000015")]
public bool IsWin
{
    [Token(Token = "0x60000F2")]
    [Address(RVA = "0x4DB7F0", Offset = "0x4DB7F0", VA = "0x4DB7F0")]
    [Attribute(Name = "CompilerGeneratedAttribute", RVA = "0x2764E4", Offset = "0x2764E4")]
    get
    {
        return default(bool);
    }
    [Token(Token = "0x60000F3")]
    [Address(RVA = "0x4DB7F8", Offset = "0x4DB7F8", VA = "0x4DB7F8")]
    [Attribute(Name = "CompilerGeneratedAttribute", RVA = "0x2764F4", Offset = "0x2764F4")]
    set
    {
    }
}
this is hook
C++:
void (*set_IsWin)(void *instance, bool value);

//the void *instance is a self-created variable.
bool (*old_get_IsWin)(void *instance);
bool get_IsWin(void *instance) {
    //Check if instance is NULL to prevent CRASH
    if (instance != NULL && WinOK)
    {
        set_IsWin(instance, true); //Function Pointer mod
    }
    //return the original value (this code isn't really needed if you have a toggle/switch)
    return old_get_IsWin(instance);
}
and this call
C++:
set_IsWin = (void (*)(void *, bool))getAbsoluteAddress(targetLibName,0x4DB7F8);
    HOOK_LIB("libil2cpp.so", "0x4DB7F0", get_IsWin, old_get_IsWin);
 

CHEATS GAMES

Solid & Active Platinian
Aug 9, 2019
64
18
8
39
Brazil
Please help. I did everything according to the tutorial, but all to no avail. Can you suggest what I did wrong?

This is from dnspy
C++:
[Token(Token = "0x17000015")]
public bool IsWin
{
    [Token(Token = "0x60000F2")]
    [Address(RVA = "0x4DB7F0", Offset = "0x4DB7F0", VA = "0x4DB7F0")]
    [Attribute(Name = "CompilerGeneratedAttribute", RVA = "0x2764E4", Offset = "0x2764E4")]
    get
    {
        return default(bool);
    }
    [Token(Token = "0x60000F3")]
    [Address(RVA = "0x4DB7F8", Offset = "0x4DB7F8", VA = "0x4DB7F8")]
    [Attribute(Name = "CompilerGeneratedAttribute", RVA = "0x2764F4", Offset = "0x2764F4")]
    set
    {
    }
}
this is hook
C++:
void (*set_IsWin)(void *instance, bool value);

//the void *instance is a self-created variable.
bool (*old_get_IsWin)(void *instance);
bool get_IsWin(void *instance) {
    //Check if instance is NULL to prevent CRASH
    if (instance != NULL && WinOK)
    {
        set_IsWin(instance, true); //Function Pointer mod
    }
    //return the original value (this code isn't really needed if you have a toggle/switch)
    return old_get_IsWin(instance);
}
and this call
C++:
set_IsWin = (void (*)(void *, bool))getAbsoluteAddress(targetLibName,0x4DB7F8);
    HOOK_LIB("libil2cpp.so", "0x4DB7F0", get_IsWin, old_get_IsWin);

try using only the set method
 
  • Like
Reactions: rikolig

power2020202020

Solid & Active Platinian
Nov 3, 2022
58
15
8
34
brazil
Please help. I did everything according to the tutorial, but all to no avail. Can you suggest what I did wrong?

This is from dnspy
C++:
[Token(Token = "0x17000015")]
public bool IsWin
{
    [Token(Token = "0x60000F2")]
    [Address(RVA = "0x4DB7F0", Offset = "0x4DB7F0", VA = "0x4DB7F0")]
    [Attribute(Name = "CompilerGeneratedAttribute", RVA = "0x2764E4", Offset = "0x2764E4")]
    get
    {
        return default(bool);
    }
    [Token(Token = "0x60000F3")]
    [Address(RVA = "0x4DB7F8", Offset = "0x4DB7F8", VA = "0x4DB7F8")]
    [Attribute(Name = "CompilerGeneratedAttribute", RVA = "0x2764F4", Offset = "0x2764F4")]
    set
    {
    }
}
this is hook
C++:
void (*set_IsWin)(void *instance, bool value);

//the void *instance is a self-created variable.
bool (*old_get_IsWin)(void *instance);
bool get_IsWin(void *instance) {
    //Check if instance is NULL to prevent CRASH
    if (instance != NULL && WinOK)
    {
        set_IsWin(instance, true); //Function Pointer mod
    }
    //return the original value (this code isn't really needed if you have a toggle/switch)
    return old_get_IsWin(instance);
}
and this call
C++:
set_IsWin = (void (*)(void *, bool))getAbsoluteAddress(targetLibName,0x4DB7F8);
    HOOK_LIB("libil2cpp.so", "0x4DB7F0", get_IsWin, old_get_IsWin);
use mshookfunction .. no hook_lib