Jump to content

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


Go to solution Solved by Ted2,

6 posts in this topic

Recommended Posts

Posted

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?

  • Solution
Posted (edited)

No, in programming you have getters and setters;

int getCoins() {
	return coins
}

void setCoins(int newValue) {
	coins = new_value
}

As you can see, to one of those functions you can pass a new value (SET). The other one just returns a variable (GET).

Function pointers are not any different, because the function pointer is that function and so, they work the same.

 

If for some reason you don't want to hook it, then I recommend opening the binary in IDA, go to the ReloadDuration method, and see which variable(s) is being used here (0x<some_value>. I assume this is an Unity game, so on top of the class ReloadDuration is in, you'll find a list of variables. See which one of them is inside ReloadDuration.

You can then change these variables in the FixedUpdate method, like so:

*(int*)((uint64_t)instance + 0x<variable_code> = 0;

 

Updated by Ted2
  • Like 1
Posted
8 hours ago, Ted2 said:

No, in programming you have getters and setters;


int getCoins() {
	return coins
}

void setCoins(int newValue) {
	coins = new_value
}

As you can see, to one of those functions you can pass a new value (SET). The other one just returns a variable (GET).

Function pointers are not any different, because the function pointer is that function and so, they work the same.

 

If for some reason you don't want to hook it, then I recommend opening the binary in IDA, go to the ReloadDuration method, and see which variable(s) is being used here (0x<some_value>. I assume this is an Unity game, so on top of the class ReloadDuration is in, you'll find a list of variables. See which one of them is inside ReloadDuration.

You can then change these variables in the FixedUpdate method, like so:


*(int*)((uint64_t)instance + 0x<variable_code> = 0;

 

Okay, I don't have a problem with hooking, it's just that I wanted to know if it was possible to set a value to a function inside a hook, but other than that, I have no problem patching or hooking the function.

Posted

@Ted2 I just have one more quick question, that i'll ask here, I already asked on another site, but didn't receive a good response. So there was one class called IAPManager or something like that, and inside it there were many useful functions that if called, would buy you whatever it is supposed to, but inside that class there was no Update/LateUpdate/FixedUpdate method (I know in some cases they can be renamed, but I looked and that wasn't the case), so would I hook Start or Awake and call those functions through a function pointer? Which one works, or does neither work?

Posted
19 minutes ago, PixelYT said:

@Ted2 I just have one more quick question, that i'll ask here, I already asked on another site, but didn't receive a good response. So there was one class called IAPManager or something like that, and inside it there were many useful functions that if called, would buy you whatever it is supposed to, but inside that class there was no Update/LateUpdate/FixedUpdate method (I know in some cases they can be renamed, but I looked and that wasn't the case), so would I hook Start or Awake and call those functions through a function pointer? Which one works, or does neither work?

https://docs.unity3d.com/Manual/ExecutionOrder.html

This is a great graph that tells you what and when they're being executed.

So I don't think any of those two will work.

 

It's possible other classes have an instance of this IAPManager class, and handle it there.

But without more info, I can't really answer.

  • Like 1
Posted
2 hours ago, Ted2 said:

https://docs.unity3d.com/Manual/ExecutionOrder.html

This is a great graph that tells you what and when they're being executed.

So I don't think any of those two will work.

 

It's possible other classes have an instance of this IAPManager class, and handle it there.

But without more info, I can't really answer.

Alright thanks for the help

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below. For more information, please read our Posting Guidelines.
Reply to this topic... Posting Guidelines

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Our picks

    • Zombie Streets: Undead Shooter v1.0.49 +3 Jailed Cheats [ Unlimited Currencies ]
      Modded/Hacked App: Zombie Streets: Undead Shooter By Frank Slofstra
      Bundle ID: com.builditgames.zombiestreets
      iTunes Store Link: https://apps.apple.com/us/app/zombie-streets-undead-shooter/id1670656973?uo=4


      Hack Features:
      - Unlimited Currencies
      - God Mode
      - One-Hit Kill


      Jailbreak required hack(s): [Mod Menu Hack] Zombie Streets: Undead Shooter v1.0.19 +3 Cheats [ Unlimited Currencies ] - Free Jailbroken Cydia Cheats - iOSGods
      Modded Android APK(s): https://iosgods.com/forum/68-android-section/
      For more fun, check out the Club(s): https://iosgods.com/clubs/
      • 47 replies
    • Tile Family®:Match Puzzle Game v1.72.5 +5 Jailed Cheats [ Unlimited Currencies ]
      Modded/Hacked App: Tile Family®:Match Puzzle Game By Jump Plaid GmbH
      Bundle ID: com.tile.match.blockpuzzle
      iTunes Store Link: https://apps.apple.com/us/app/tile-family-match-puzzle-game/id6444056676?uo=4


      Hack Features:
      - Unlimited Coins -> Earn or spend some.
      - Unlimited Lives -> Use coins.
      - Unlimited Stars -> Earn or spend some.
      - Unlimited Boosters -> Earn or spend some.
      - No Ads


      Jailbreak required hack(s): [Mod Menu Hack] Tile Family®:Match Puzzle Game v1.54.1 +5 Cheats [ Unlimited Currencies ] - Free Jailbroken Cydia Cheats - iOSGods
      Modded Android APK(s): https://iosgods.com/forum/68-android-section/
      For more fun, check out the Club(s): https://iosgods.com/clubs/
      • 27 replies
    • Tile Family®:Match Puzzle Game v1.72.5 +5 Cheats [ Unlimited Currencies ]
      Modded/Hacked App: Tile Family®:Match Puzzle Game By Jump Plaid GmbH
      Bundle ID: com.tile.match.blockpuzzle
      iTunes Store Link: https://apps.apple.com/us/app/tile-family-match-puzzle-game/id6444056676?uo=4


      Hack Features:
      - Unlimited Coins -> Earn or spend some.
      - Unlimited Lives -> Use coins.
      - Unlimited Stars -> Earn or spend some.
      - Unlimited Boosters -> Earn or spend some.
      -- No Ads


      Non-Jailbroken & No Jailbreak required hack(s): [Non-Jailbroken Hack] Tile Family®:Match Puzzle Game v1.54.1 +5 Jailed Cheats [ Unlimited Currencies ] - Free Non-Jailbroken IPA Cheats - iOSGods
      Modded Android APK(s): https://iosgods.com/forum/68-android-section/
      For more fun, check out the Club(s): https://iosgods.com/clubs/
      • 34 replies
    • Clash of Destiny: Good vs Evil v1.6.1 +2 Jailed Cheats [ Damage & Defence ]
      Modded/Hacked App: Clash of Destiny: Good vs Evil By BoomBit, Inc.
      Bundle ID: com.clash.destiny
      iTunes Store Link: https://apps.apple.com/us/app/clash-of-destiny-good-vs-evil/id6473921912?uo=4


      Hack Features:
      - Damage Multiplier
      - Defence Multiplier


      Jailbreak required hack(s): [Mod Menu Hack] Clash of Destiny: Good vs Evil v1.1 +2 Cheats [ Damage & Defence ] - ViP Cheats - iOSGods
      Modded Android APK(s): https://iosgods.com/forum/68-android-section/
      For more fun, check out the Club(s): https://iosgods.com/clubs/
      • 28 replies
    • Clash of Destiny: Good vs Evil v1.6.1 +2 Cheats [ Damage & Defence ]
      Modded/Hacked App: Clash of Destiny: Good vs Evil By BoomBit, Inc.
      Bundle ID: com.clash.destiny
      iTunes Store Link: https://apps.apple.com/us/app/clash-of-destiny-good-vs-evil/id6473921912?uo=4


      Hack Features:
      - Damage Multiplier
      - Defence Multiplier


      Non-Jailbroken & No Jailbreak required hack(s): [IPA Mod Menu] Clash of Destiny: Good vs Evil v1.1 +2 Jailed Cheats [ Damage & Defence ] - ViP Non-Jailbroken Hacks & Cheats - iOSGods
      Modded Android APK(s): https://iosgods.com/forum/68-android-section/
      For more fun, check out the Club(s): https://iosgods.com/clubs/
      • 57 replies
    • Kitty Keep v1.18.15 +2 Jailed Cheats [ God Mode ]
      Modded/Hacked App: Kitty Keep™ By Funovus LLC
      Bundle ID: com.funovus.wildcastle2
      iTunes Store Link: https://apps.apple.com/us/app/kitty-keep/id6476017989?uo=4


      Mod Requirements:
      - Non-Jailbroken/Jailed or Jailbroken iPhone/iPad/iPod Touch.
      - Sideloadly / Cydia Impactor or alternatives.
      - A Computer Running Windows/macOS/Linux with iTunes installed.


      Hack Features:
      - God Mode
      - Unlimited Mana -> Will not decrease.


      Jailbreak required hack(s): [Mod Menu Hack] Kitty Keep v1.1.3 +2 Cheats [ God Mode ] - Free Jailbroken Cydia Cheats - iOSGods
      Modded Android APK(s): https://iosgods.com/forum/68-android-section/
      For more fun, check out the Club(s): https://iosgods.com/clubs/
      • 24 replies
    • Kitty Keep v1.18.15 +2 Cheats [ God Mode ]
      Modded/Hacked App: Kitty Keep™ By Funovus LLC
      Bundle ID: com.funovus.wildcastle2
      iTunes Store Link: https://apps.apple.com/us/app/kitty-keep/id6476017989?uo=4


      Mod Requirements:
      - Jailbroken iPhone/iPad/iPod Touch.
      - iGameGod / Filza / iMazing or any other file managers for iOS.
      - Cydia Substrate, ElleKit, Substitute or libhooker depending on your jailbreak.
      - PreferenceLoader (from Cydia, Sileo or Zebra).


      Hack Features:
      - God Mode
      - Unlimited Mana -> Will not decrease.


      Non-Jailbroken & No Jailbreak required hack(s): [Non-Jailbroken Hack] Kitty Keep v1.1.3 +2 Jailed Cheats [ God Mode ] - Free Non-Jailbroken IPA Cheats - iOSGods
      Modded Android APK(s): https://iosgods.com/forum/68-android-section/
      For more fun, check out the Club(s): https://iosgods.com/clubs/
      • 30 replies
    • Zombie Streets: Undead Shooter v1.0.49 +3 Cheats [ Unlimited Currencies ]
      Modded/Hacked App: Zombie Streets: Undead Shooter By Frank Slofstra
      Bundle ID: com.builditgames.zombiestreets
      iTunes Store Link: https://apps.apple.com/us/app/zombie-streets-undead-shooter/id1670656973?uo=4


      Hack Features:
      - Unlimited Currencies
      - God Mode
      - One-Hit Kill


      Non-Jailbroken & No Jailbreak required hack(s): [Non-Jailbroken Hack] Zombie Streets: Undead Shooter v1.0.19 +3 Jailed Cheats [ Unlimited Currencies ] - Free Non-Jailbroken IPA Cheats - iOSGods
      Modded Android APK(s): https://iosgods.com/forum/68-android-section/
      For more fun, check out the Club(s): https://iosgods.com/clubs/
      • 50 replies
    • Football Superstar 2: USA Ed. v1.0.20 +2 Jailed Cheats [ Unlimited Currencies ]
      Modded/Hacked App: Football Superstar 2: USA Ed. By Scott Baillie
      Bundle ID: com.lazyboydevelopments.usafootysuperstar2
      iTunes Store Link: https://apps.apple.com/us/app/football-superstar-2-usa-ed/id6449435265?uo=4


      Hack Features:
      - Unlimited Cash
      - Unlimited Exp


      Jailbreak required hack(s): [Mod Menu Hack] Football Superstar 2: USA Ed. v1.0.18 +2 Cheats [ Unlimited Currencies ] - Free Jailbroken Cydia Cheats - iOSGods
      Modded Android APK(s): https://iosgods.com/forum/68-android-section/
      For more fun, check out the Club(s): https://iosgods.com/clubs/
      • 13 replies
    • Basketball Superstar 2 v1.0.22 +2 Cheats [ Unlimited Currencies ]
      Modded/Hacked App: Basketball Superstar 2 By Lazy Boy Developments
      Bundle ID: com.lazyboydevelopments.basketballsuperstar2
      iTunes Store Link: https://apps.apple.com/us/app/basketball-superstar-2/id6444349148
       

      Hack Features:
      - Unlimited Cash
      - Unlimited Exp


      Non-Jailbroken & No Jailbreak required hack(s): https://iosgods.com/topic/168891-basketball-superstar-2-v102-3-jailed-cheats-unlimited-currencies/
      Modded Android APK(s): https://iosgods.com/forum/68-android-section/
      For more fun, check out the Club(s): https://iosgods.com/clubs/
      • 61 replies
    • Football Superstar 2 v1.0.48 +2 Cheats [ Unlimited Currencies ]
      Modded/Hacked App: Football Superstar 2 By Lazy Boy Developments
      Bundle ID: com.lazyboydevelopments.footballsuperstar2
      iTunes Store Link: https://apps.apple.com/us/app/football-superstar-2/id1607289341
       

      Hack Features:
      - Unlimited Cash
      - Unlimited Exp


      Non-Jailbroken & No Jailbreak required hack(s): https://iosgods.com/topic/167872-football-superstar-2-v1011-1-jailed-cheat-free-i-ap/
      Modded Android APK(s): https://iosgods.com/forum/68-android-section/
      For more fun, check out the Club(s): https://iosgods.com/clubs/
      • 142 replies
    • Basketball Superstar 2 v1.0.22 +2 Jailed Cheats [ Unlimited Currencies ]
      Modded/Hacked App: Basketball Superstar 2 By Lazy Boy Developments
      Bundle ID: com.lazyboydevelopments.basketballsuperstar2
      iTunes Store Link: https://apps.apple.com/us/app/basketball-superstar-2/id6444349148
       

      Mod Requirements:
      - Non-Jailbroken/Jailed or Jailbroken iPhone/iPad/iPod Touch.
      - Sideloadly / Cydia Impactor or alternatives.
      - A Computer Running Windows/macOS/Linux with iTunes installed.


      Hack Features:
      - Unlimited Cash
      - Unlimited Exp


      Jailbreak required hack(s): https://iosgods.com/topic/168897-basketball-superstar-2-v102-2-cheats-unlimited-currencies/
      Modded Android APK(s): https://iosgods.com/forum/68-android-section/
      For more fun, check out the Club(s): https://iosgods.com/clubs/
        • Agree
      • 111 replies
×
  • Create New...

Important Information

We would like to place cookies on your device to help make this website better. The website cannot give you the best user experience without cookies. You can accept or decline our cookies. You may also adjust your cookie settings. Privacy Policy - Guidelines