Jump to content

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


PixelYT
Go to solution Solved by Ted2,

6 posts in this topic

Recommended Posts

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?

Link to comment
Share on other sites

  • Solution

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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

@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?

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

    • Jurassic World Alive v3.5.29 - [ Dino Don't Move & More ]
      Modded/Hacked App: Jurassic World Alive By Ludia
      Bundle ID: com.ludia.jw2
      iTunes Store Link: https://apps.apple.com/us/app/jurassic-world-alive/id1231085864

      Hack Features:
      - Dino Don't Move
      - Inf.Battery
      - VIP Enabled

      This hack works on the latest x64 or ARM64 iDevices: iPhone 5s, 6, 6 Plus, 6s, 6s Plus, 7, 7 Plus, 8, 8 Plus, X, Xr, Xs, Xs Max, SE, iPod Touch 6G, iPad Air, Air 2, Pro & iPad Mini 2, 3, 4 and later.


      Jailbreak required hack(s): https://iosgods.com/topic/103431-jurassic-world-alive-v1829-dino-dont-move-more/?tab=comments#comment-3107135
      • 1,526 replies
    • Jurassic World Alive v3.5.29 - [ Dino Don't Move & More ]
      Modded/Hacked App: Jurassic World Alive By Ludia
      Bundle ID: com.ludia.jw2
      iTunes Store Link: https://apps.apple.com/us/app/jurassic-world-alive/id1231085864


      Hack Features:
      - Dino Don't Move
      - Inf. Battery
      - VIP Enabled

      This hack is an In-Game Mod Menu (iGMM). In order to activate the Mod Menu, tap on the iOSGods button found inside the app. This hack works on the latest x64 or ARM64 iDevices: iPhone 5s, 6, 6 Plus, 6s, 6s Plus, 7, 7 Plus, 8, 8 Plus, X, Xr, Xs, Xs Max, SE, iPod Touch 6G, iPad Air, Air 2, Pro & iPad Mini 2, 3, 4 and later.
      • 1,460 replies
    • Idle Cinema Empire: Idle Games v2.13.01 +3 Jailed Cheats [ Unlimited Currencies ]
      Modded/Hacked App: Idle Cinema Empire: Idle Games By 书涛 刘
      Bundle ID: com.idle.cinema.empire.sim.tycoon
      iTunes Store Link: https://apps.apple.com/us/app/idle-cinema-empire-idle-games/id1660507282?uo=4


      Hack Features:
      - Unlimited Cash -> Earn some.
      - Unlimited Gold Coins -> Earn some.
      - Unlimited Diamonds -> Earn some.


      Jailbreak required hack(s): [Mod Menu Hack] Idle Cinema Empire: Idle Games ( All Versions ) +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/
      • 42 replies
    • Idle Cinema Empire: Idle Games ( All Versions ) +3 Cheats [ Unlimited Currencies ]
      Modded/Hacked App: Idle Cinema Empire: Idle Games By 书涛 刘
      Bundle ID: com.idle.cinema.empire.sim.tycoon
      iTunes Store Link: https://apps.apple.com/us/app/idle-cinema-empire-idle-games/id1660507282?uo=4


      Hack Features:
      - Unlimited Cash -> Earn some.
      - Unlimited Gold Coins -> Earn some.
      - Unlimited Diamonds -> Earn some.


      Non-Jailbroken & No Jailbreak required hack(s): [Non-Jailbroken Hack] Idle Cinema Empire: Idle Games v2.11.03 +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/
      • 12 replies
    • Dark Slayer : AFK RPG v1.1.4 +2 Cheats [ God Mode ]
      Modded/Hacked App: Dark Slayer : AFK RPG By Gamepub CO., LTD
      Bundle ID: com.gamepub.zhteam
      iTunes Store Link: https://apps.apple.com/us/app/dark-slayer-afk-rpg/id6446265751?uo=4


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


      Hack Features:
      - God Mode
      - Attack Speed Multiplier
      • 170 replies
    • Longleaf Valley: Merge & Plant v1.15.58 +1++ Jailed Cheats [ Unlimited Currencies ]
      Modded/Hacked App: Longleaf Valley: Merge & Plant By TreesPlease Games Ltd
      Bundle ID: com.treespleasegames.merge1
      iTunes Store Link: https://apps.apple.com/us/app/longleaf-valley-merge-plant/id1573565989?uo=4


      Hack Features:
      - Unlimited Currencies -> Will increase instead of decrease.


      Jailbreak required hack(s): [Mod Menu Hack] Longleaf Valley: Merge & Plant ( All Versions ) +1++ 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/
      • 14 replies
    • Longleaf Valley: Merge & Plant ( All Versions ) +1++ Cheats [ Unlimited Currencies ]
      Modded/Hacked App: Longleaf Valley: Merge & Plant By TreesPlease Games Ltd
      Bundle ID: com.treespleasegames.merge1
      iTunes Store Link: https://apps.apple.com/us/app/longleaf-valley-merge-plant/id1573565989?uo=4


      Hack Features:
      - Unlimited Currencies -> Will increase instead of decrease.


      Non-Jailbroken & No Jailbreak required hack(s): [Non-Jailbroken Hack] Longleaf Valley: Merge & Plant v1.10.48 +1++ 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/
      • 2 replies
    • Idle Mushroom Hero : AFK RPG v1.02.067 +4 Jailed Cheats [ Unlimited Currencies ]
      Modded/Hacked App: Idle Mushroom Hero : AFK RPG By Ndolphin Connect
      Bundle ID: com.nextall.mushroomhero.apple
      iTunes Store Link: https://apps.apple.com/us/app/idle-mushroom-hero-afk-rpg/id6475755018?uo=4


      Hack Features:
      - God Mode
      - One-Hit Kill
      - Unlimited Gold -> Will increase instead of decrease.
      - Unlimited Diamonds -> Spend some.


      Jailbreak required hack(s): [Mod Menu Hack] Idle Mushroom Hero : AFK RPG v1.02.066 +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/
      • 14 replies
    • Idle Mushroom Hero : AFK RPG v1.02.067 +5 Cheats [ Unlimited Currencies ]
      Modded/Hacked App: Idle Mushroom Hero : AFK RPG By Ndolphin Connect
      Bundle ID: com.nextall.mushroomhero.apple
      iTunes Store Link: https://apps.apple.com/us/app/idle-mushroom-hero-afk-rpg/id6475755018?uo=4


      Hack Features:
      - God Mode
      - One-Hit Kill
      - Unlimited Gold -> Will increase instead of decrease.
      - Unlimited Diamonds -> Spend some.
      - Auto Win


      Non-Jailbroken & No Jailbreak required hack(s): [Non-Jailbroken Hack] Idle Mushroom Hero : AFK RPG v1.02.066 +4 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/
      • 36 replies
    • Good Pizza, Great Pizza v5.8.1 +2 Jailed Cheats [ Unlimited Currencies ]
      Modded/Hacked App: Good Pizza, Great Pizza By TAPBLAZE, LLC
      Bundle ID: com.tapblaze.pizzabusiness
      iTunes Store Link: https://apps.apple.com/us/app/good-pizza-great-pizza/id911121200?uo=4


      Hack Features:
      - Unlimited Cash
      - Unlimited Diamonds


      Jailbreak required hack(s): [Mod Menu Hack] Good Pizza, Great Pizza v5.5.6 +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/
      • 24 replies
    • Good Pizza, Great Pizza v5.8.1 +2 Cheats [ Unlimited Currencies ]
      Modded/Hacked App: Good Pizza, Great Pizza By TAPBLAZE, LLC
      Bundle ID: com.tapblaze.pizzabusiness
      iTunes Store Link: https://apps.apple.com/us/app/good-pizza-great-pizza/id911121200?uo=4


      Hack Features:
      - Unlimited Cash
      - Unlimited Diamonds


      Non-Jailbroken & No Jailbreak required hack(s): [Non-Jailbroken Hack] Good Pizza, Great Pizza v5.5.6 +2 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/
      • 16 replies
    • Merge Lion v2.2.0 +8 Jailed Cheats [ Unlimited Everything ]
      Modded/Hacked App: Merge Lion By GOMBLE GAMES PTE. LTD.
      Bundle ID: com.gomble.ios.mergelion
      iTunes Store Link: https://apps.apple.com/us/app/merge-lion/id6472009816?uo=4


      Hack Features:
      - Unlimited Gold
      - Unlimited Lives
      - Unlimited Boosters
      - Unlimited In-Game Boosters
      - Unlimited Bingo Lions
      - Unlimited Energy
      - Unlimited Pushes
      - Unlimited Capsules


      Jailbreak required hack(s): [Mod Menu Hack] Merge Lion v2.1.9 +9 Cheats [ Unlimited Everything ] - 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/
      • 7 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