Tuesday, 13 July 2021

Can a you set a value to a function pointer inside a hook?

Let's say I found this method and I wanna change the value to 0: private int ReloadDuration(); // 0x2347C82 I would just do it by hooking it and returning 0 like this: int (*old_ReloadDuration)(void *instance); int ReloadDuration(void *instance) { if(instance != NULL) { return 0; } return old_ReloadDuration(instance); } // MShookfunction whatever lol But can I do it by making a function pointer and changing the value of it inside a hook and how would I do it? Would I do it like this? int (*ReloadDuration)(void *instance) = (int (*)(void *))getAbsoluteAddress(targetLibName, 0xOFFSET); // Function pointer for int ReloadDuration void (*old_FixedUpdate)(void *instance); void FixedUpdate(void *instance) { if(instance != NULL) { int Reloadtime = ReloadDuration(instance); // Declare a variable to our function pointer and call it ReloadTime int ReloadTime = 0; // Set the value to 0 } old_FixedUpdate(instance); } // MSHookfunction of Fixedupdate, whatever @Ted2 you or anyone can help me please?

from iOSGods RSS Feed https://ift.tt/3AZAH7Q

No comments:

Post a Comment