Help! HOW TO HOOK on VOID?

lanzouyun

Platinian
I read the relevant information, but I don't know how to hook void
1658888558781.png

1658889145354.png

1658889186310.png


C++:
void *isatk;
//bool isatk = false;
void (*old_AddDamage)(void *instance);
void AddDamage(void *instance){
    if(instance != NULL){
        if(isatk){
            ((uint64_t) instance);
              //*(int *) ((uint64_t) instance + 0x10) = 0;
          //  old_AddDamage(instance, 999);
        }
    }
    old_AddDamage(instance);
}

// old_AddDamage = (void(*)(void *,int))getAbsoluteAddress(targetLibName, 0x9BBBA4);
A64HookFunction((void *) getAbsoluteAddress("libil2cpp.so",0x9BBBA4),(void *)AddDamage,(void**)&old_AddDamage);

        case 0:
bool isatk = boolean;
            break;
does this work?
I tried it and it crashes the game process,What is the right way to do it?
 
You write here:
void (*old_AddDamage)(void *instance);

and
old_AddDamage = (void(*)(void *,int))getAbsoluteAddress(targetLibName, 0x9BBBA4);

So the original AddDamage just have instance parameter there is no int parameter so what is the purpose of your code ?
Because don't have second parameter in original method AddDamage you can not do anything to take more damage or controll the damage.
 
Back
Top Bottom