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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Our picks

    • Monster Super League By Four Thirty Three v4.0.7 - [ x Player Damage & More ]
      Modded/Hacked App: Monster Super League By Smart Study Games Co., Ltd.
      Bundle ID: com.ftt.msleague
      iTunes Store Link: https://apps.apple.com/us/app/monster-super-league/id1092463295?uo=4

       

      📌 Mod Requirements

      - Jailbroken iPhone or iPad.
      - iGameGod / Filza / iMazing.
      - Cydia Substrate, ElleKit, Substitute or libhooker depending on your jailbreak (from Sileo, Cydia or Zebra).

       

      🤩 Hack Features

      - x Player Damage - x1 - 100
      - x Player Defense - x1 - 100
      - Infinite Skills
      - 100% Capture Rate

       

      Non-Jailbroken Hack: https://iosgods.com/topic/73458-monster-super-league-v390-new-mod-menu/

       

      ⬇️ iOS Hack Download Link: https://iosgods.com/topic/73355-monster-super-league-by-four-thirty-three-v393-x-player-damage-more/
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 1,287 replies
    • Peanuts: Snoopy Town Tale Cheats v4.6.2 +2
      Modded/Hacked App: Peanuts: Snoopy Town Tale By PIXOWL INC.
      Bundle ID: com.activision.peanuts
      App Store Link: https://apps.apple.com/us/app/peanuts-snoopy-town-tale/id1013992870?uo=4

       

      📌 Mod Requirements

      - Jailbroken iPhone or iPad.
      - iGameGod / Filza / iMazing.
      - Cydia Substrate, ElleKit, Substitute or libhooker depending on your jailbreak (from Sileo, Cydia or Zebra).

       

      🤩 Hack Features

      - Freeze Currencies
      - Free iAP

       

      Non-Jailbroken Hack: https://iosgods.com/topic/95917-peanuts-snoopy-town-tale-v462-jailed-cheats-1/
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 104 replies
    • Warhammer 40,000: Tacticus v1.31.99 +4 Cheats
      Modded/Hacked App: Warhammer 40,000: Tacticus By Snowprint Studios AB
      Bundle ID: com.snowprintstudios.tacticus
      iTunes Store Link: https://apps.apple.com/us/app/warhammer-40-000-tacticus/id1599937506?uo=4

      Hack Features:
      - Always Win [ even if all your characters die, you win ]
      - Custom Ability Stats
      - Ability Always Available
      - Game Speed Multiplier

      Note: Use characters that do ability attack to multiple enemies like Varro Tigurius & Bellator


      Non-Jailbroken & No Jailbreak required hack(s): https://iosgods.com/topic/163492-warhammer-40000-tacticus-v1133-3-cheats-for-jailed-idevices/


      iOS Hack Download Link: https://iosgods.com/topic/163377-warhammer-40000-tacticus-v1133-4-cheats/
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 303 replies
    • [ Seven Deadly Sins KR ] 일곱 개의 대죄: GRAND CROSS Cheats v8.6.77 +5
      Modded/Hacked App: 일곱 개의 대죄: GRAND CROSS By Netmarble Corporation
      Bundle ID: com.netmarble.nanakr
      iTunes Store Link: https://apps.apple.com/kr/app/%EC%9D%BC%EA%B3%B1-%EA%B0%9C%EC%9D%98-%EB%8C%80%EC%A3%84-grand-cross/id1449552940?uo=4


      Hack Features:
      - God Mode
      - One Hit Kill
      - Multiply Attack
      - Multiply Defense
      - Make Enemies God Mode for some quests


      iOS Hack Download Link: https://iosgods.com/topic/154899-seven-deadly-sins-kr-%EC%9D%BC%EA%B3%B1-%EA%B0%9C%EC%9D%98-%EB%8C%80%EC%A3%84-grand-cross-cheats-v750-5/
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 181 replies
    • [ Seven Deadly Sins JP ] - 七つの大罪 光と闇の交戦 : グラクロ Cheats v8.6.77 +5
      Modded/Hacked App: 七つの大罪 光と闇の交戦 : グラクロ By Netmarble Corporation
      Bundle ID: com.netmarble.nanatsunotaizai
      iTunes Store Link: https://apps.apple.com/jp/app/七つの大罪-光と闇の交戦-グラクロ/id1268959718?uo=4&at=1010lce4


      Hack Features:
      - God Mode
      - OHK


      iOS Hack Download Link: https://iosgods.com/topic/112888-seven-deadly-sins-%E4%B8%83%E3%81%A4%E3%81%AE%E5%A4%A7%E7%BD%AA-%E5%85%89%E3%81%A8%E9%97%87%E3%81%AE%E4%BA%A4%E6%88%A6-%E3%82%B0%E3%83%A9%E3%82%AF%E3%83%AD-v340-god-mode-unlimited-mp/
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 1,083 replies
    • The Seven Deadly Sins Cheats v2.85.0 +5
      Modded/Hacked App: The Seven Deadly Sins by Netmarble Corporation
      Bundle ID: com.netmarble.nanagb
      iTunes Store Link: https://apps.apple.com/us/app/the-seven-deadly-sins/id1475440231?uo=4&at=1010lce4


      Hack Features:
      - God Mode
      - OHK
      - Infinite MP


      iOS Hack Download Link: https://iosgods.com/topic/131686-arm64-the-seven-deadly-sins-cheats-v117-3/
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 2,061 replies
    • Guild of Heroes: Fantasy RPG v1.182.2 - [ x Player Damage & More ]
      Modded/Hacked App: Guild of Heroes: Fantasy RPG By BIT.GAMES PBL
      Bundle ID: com.goplaytoday.guildofheroes
      iTunes Store Link: https://itunes.apple.com/us/app/guild-of-heroes-fantasy-rpg/id979474617?mt=8&uo=4&at=1010lce4


      Mod Requirements:
      - Jailbroken iPhone/iPad/iPod Touch.
      - iFile / Filza / iFunBox / iTools or any other file managers for iOS.
      - Cydia Substrate (from Cydia).
      - PreferenceLoader (from Cydia).


      Hack Features:
      - x Player Damage - x1 - 10
      - x Player Defense - x1 - 10
      - Enemies Auto Die
      - Premium Activate
      - Freeze Resources
      - Freeze Potions

      All features are unlinked and only for player, you!
      Note:
      Not Responsible For Any Bans


      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.
      Non-Jailbroken & No Jailbreak required hack(s): https://iosgods.com/topic/79822-guild-of-heroes-fantasy-rpg-v1679-5k-gold-sell-value-more/
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 1,712 replies
    • Asphalt Legends Unite Cheats v46.0.5 +2
      Modded/Hacked App: Asphalt 9: Legends By Gameloft
      Bundle ID: com.gameloft.asphalt9
      iTunes Store Link: https://itunes.apple.com/us/app/asphalt-9-legends/id805603214


      Hack Features:
      - Unlimited Nitro Use / No Nitro Consumption
      - No Traffic / No Incoming Cars
      More to come!
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 8,658 replies
    • Chapters: Interactive Stories v2.0.9 +1 Cheats
      Modded/Hacked App: Chapters: Interactive Stories By Crazy Maple Studio, Inc.
      Bundle ID: com.mars.avgchapters
      iTunes Store Link: https://apps.apple.com/us/app/chapters-interactive-stories/id1277029359?uo=4



      Hack Features:
      - Freeze Tickets [read chapter for free]


      Non-Jailbroken & No Jailbreak required hack(s): https://iosgods.com/topic/138328-chapters-interactive-stories-v193-1-cheats-for-jailed-idevices/


      iOS Hack Download Link: https://iosgods.com/topic/137489-chapters-interactive-stories-v193-1-cheats/
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 368 replies
    • Hill Climb Racing 2 v1.67.4 Cheats +1
      Modded/Hacked App: Hill Climb Racing 2 By Fingersoft
      Bundle ID: com.fingersoft.hillclimbracing2
      iTunes Store Link: https://apps.apple.com/us/app/hill-climb-racing-2/id1146465836?uo=4


      Hack Features:
      - Freeze Coins
      - Freeze Gems
      - Freeze Scraps


      Non-Jailbroken & No Jailbreak required hack(s): https://iosgods.com/topic/108295-hill-climb-racing-2-v1611-jailed-cheats-2/


      iOS Hack Download Link: https://iosgods.com/topic/108298-hill-climb-racing-2-v1612-cheats-3/
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 2,194 replies
    • Arknights Cheats v30.5.02 +8 - [ God Mode & More ]
      Modded/Hacked App: Arknights By YOSTAR (HONG KONG) LIMITED
      Bundle ID: com.YoStarEN.Arknights
      iTunes Store Link: https://apps.apple.com/us/app/arknights/id1464872022?uo=4

       

      🔧 Mod Requirements

      - Jailbroken iPhone or iPad.
      - iGameGod / Filza / iMazing.
      - Cydia Substrate, ElleKit, Substitute or libhooker depending on your jailbreak (from Cydia, Sileo or Zebra).

       

      🚀 Hack Features

      - God Mode
      - Frozen Enemies
      - One Hit Kill
      - Instant - Win
      - No Deploy Cost
      - Multiply Damage
      - Multiply Defense
      - Multiply Character Speed


      🍏 For Non-Jailbroken & No Jailbreak required hacks: https://iosgods.com/topic/191668-arknights-v27361-jailed-cheats-8/

       

      📥 iOS Hack Download Link: https://iosgods.com/topic/117802-arknights-cheats-v27361-8-god-mode-more/
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 1,066 replies
    • Zombie Harbor: FPS Zombie Game v1.1.0 +12 Jailed Cheats [ Damage & Defence ]
      Modded/Hacked App: Zombie Harbor: FPS Zombie Game By MYGAMES MENA FZ LLC
      Bundle ID: games.my.zombie.shooter.fps
      App Store Link: https://apps.apple.com/us/app/zombie-harbor-fps-zombie-game/id6744439436?uo=4

       
       

      🤩 Hack Features

      - Freeze Currencies
      - Freeze Ammo
      - No Recoil
      - No Spread
      - Increased Fire Rate

      VIP
      - Damage Multiplier
      - Defence Multiplier
      - God Mode
      - Move Speed Multiplier
      - Unlimited Currencies
      - Kill All Enemies
      - Become Invisible
        • Informative
        • Winner
        • Like
      • 2 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