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

    • Powerlust - Action RPG Offline v1.67.09 +2 Jailed Cheats [ Damage ]
      Modded/Hacked App: Powerlust - Action RPG offline By Bartlomiej Mamzer
      Bundle ID: bartmamzer.powerlust.actionrpg.roguelike
      App Store Link: https://apps.apple.com/us/app/powerlust-action-rpg-offline/id1439088319?uo=4

       


      🤩 Hack Features

      - God Mode
      - Damage Multiplier
      • 0 replies
    • Powerlust - Action RPG Offline v1.67.09 +2 Cheats [ Damage ]
      Modded/Hacked App: Powerlust - Action RPG offline By Bartlomiej Mamzer
      Bundle ID: bartmamzer.powerlust.actionrpg.roguelike
      App Store Link: https://apps.apple.com/us/app/powerlust-action-rpg-offline/id1439088319?uo=4

       
       

      🤩 Hack Features

      - God Mode
      - Damage Multiplier
      • 0 replies
    • NETHER DUNGEONS v1.18 [+3 Cheats]
      Modded/Hacked App: NETHER DUNGEONS By ARAKUMA STUDIO S.A.
      Bundle ID: com.ArakumaStudio.NetherDungeons
      iTunes Store Link: https://apps.apple.com/us/app/nether-dungeons/id6737908225?uo=4



      🤩 Hack Features

      - Never Die
      - Activate Vip Mode
      - Add Currency
       
      • 4 replies
    • NETHER DUNGEONS v1.18 [+3 Jailed Cheats]
      Modded/Hacked App: NETHER DUNGEONS By ARAKUMA STUDIO S.A.
      Bundle ID: com.ArakumaStudio.NetherDungeons
      iTunes Store Link: https://apps.apple.com/us/app/nether-dungeons/id6737908225?uo=4

       

      🤩 Hack Features

      - Never Die
      - Activate Vip Mode
      - Add Currency
      • 3 replies
    • Kiwoyong: Raise Your Dragon ( 키워용: 도굴라이프 ) v1.5.16 +2 Cheats [ Damage ]
      Modded/Hacked App: 키워용: 도굴라이프 By Co., Ltd. NGELGAMES
      Bundle ID: kr.ngelgames.dragon
      App Store Link: https://apps.apple.com/kr/app/%ED%82%A4%EC%9B%8C%EC%9A%A9-%EB%8F%84%EA%B5%B4%EB%9D%BC%EC%9D%B4%ED%94%84/id6618145893?uo=4

       
       

      🤩 Hack Features

      - God Mode
      - Damage Multiplier
      • 2 replies
    • Hungry Shark World v6.7.7 +5 Jailed Cheats [ Unlimited Currencies ]
      Modded/Hacked App: Hungry Shark World By Ubisoft
      Bundle ID: com.ubisoft.hungrysharkworld
      iTunes Store Link: https://apps.apple.com/us/app/hungry-shark-world/id1046846443?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:
      - Unlimited Coins
      - Unlimited Gems
      - Unlimited Pearls
      - Unlimited Boost
      - Season Pass Unlocked


      Jailbreak required hack(s): [Mod Menu Hack] Hungry Shark World v5.9.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/
        • Informative
        • Thanks
        • Winner
        • Like
      • 228 replies
    • Hungry Shark World v6.7.7 +5 Cheats [ Unlimited Currencies ]
      Modded/Hacked App: Hungry Shark World By Ubisoft
      Bundle ID: com.ubisoft.hungrysharkworld
      iTunes Store Link: https://apps.apple.com/us/app/hungry-shark-world/id1046846443?uo=4


      Hack Features:
      - Unlimited Coins
      - Unlimited Gems
      - Unlimited Pearls
      - Unlimited Boost
      - Season Pass Unlocked


      Non-Jailbroken & No Jailbreak required hack(s): [Non-Jailbroken Hack] Hungry Shark World v5.9.1 +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/
        • Thanks
        • Like
      • 92 replies
    • Run! Goddess v1.0.10 [+3 Jailed Cheats]
      Modded/Hacked App: Run! Goddess By TOP GAMES INC.
      Bundle ID: com.topgamesinc.rg
      iTunes Store Link: https://apps.apple.com/us/app/run-goddess/id6667111749?uo=4



      🤩 Hack Features

      - No Skill Cooldown
      - Slow Enemy
      - Enemy Can't Attack (Enemy Can't Do Damage)
      • 31 replies
    • Run! Goddess v1.0.10 [+3 Cheats]
      Modded/Hacked App: Run! Goddess By TOP GAMES INC.
      Bundle ID: com.topgamesinc.rg
      iTunes Store Link: https://apps.apple.com/us/app/run-goddess/id6667111749?uo=4

       

      🤩 Hack Features

      - No Skill Cooldown
      - Slow Enemy
      - Enemy Can't Attack (Enemy Can't Do Damage)
       
      • 26 replies
    • Sword Master Story Cheats v4.107.556 +5
      Modded/Hacked App: Sword Master Story By SuperPlanet corp.
      Bundle ID: com.superplanet.swordmaster
      iTunes Store Link: https://apps.apple.com/us/app/sword-master-story/id1521447065?uo=4


      Hack Features:
      - Custom Player Stats
      - Weak Enemies
      - One Hit Kill
      - & More

      Press & Hold to read feature description


      iOS Hack Download Link: https://iosgods.com/topic/146819-sword-master-story-cheats-v42294-3/
        • Informative
        • Agree
        • Thanks
        • Winner
        • Like
      • 1,445 replies
    • Subway Surfers v3.45.0 +22 Jailed Cheats [ Currencies + More ]
      Modded/Hacked App: Subway Surfers By Sybo Games ApS
      Bundle ID: com.kiloo.subwaysurfers
      iTunes Store Link: https://apps.apple.com/us/app/subway-surfers/id512939461?uo=4


      Hack Features:
      - Unlimited Currencies
      - Freeze Currencies
      - Free In-App Purchases
      - All Characters Unlocked
      - All Boards Unlocked
      - God Mode
      - No Stumble
      - Score Multiplier
      - Speed Multiplier
      - Gravity Multiplier
      - Jump Height Multiplier
      - Air Jump Height Multiplier
      - Unlimited Jumps
      - Unlimited Powers
      - Instant Lane Change
      - Freeze Trains
      - No Clip
      - Disable All Pickup
      - No Revive Cost
      - Unlimited Jetpack Time
      - Camera Stops
      - Camera Follows


      Jailbreak required hack(s): [Mod Menu Hack] Subway Surfers v3.40.0 +20 Cheats [ Currencies + More ] - 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/
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 36 replies
    • Subway Surfers v3.45.0 +22 Cheats [ Currencies + More ]
      Modded/Hacked App: Subway Surfers By Sybo Games ApS
      Bundle ID: com.kiloo.subwaysurfers
      iTunes Store Link: https://apps.apple.com/us/app/subway-surfers/id512939461?uo=4


      Hack Features:
      - Unlimited Currencies
      - Freeze Currencies
      - Free In-App Purchases
      - All Characters Unlocked
      - All Boards Unlocked
      - God Mode
      - No Stumble
      - Score Multiplier
      - Speed Multiplier
      - Gravity Multiplier
      - Jump Height Multiplier
      - Air Jump Height Multiplier
      - Unlimited Jumps
      - Unlimited Powers
      - Instant Lane Change
      - Freeze Trains
      - No Clip
      - Disable All Pickup
      - No Revive Cost
      - Unlimited Jetpack Time
      - Camera Stops
      - Camera Follows


      Non-Jailbroken & No Jailbreak required hack(s): [IPA Mod Menu] Subway Surfers v3.40.0 +20 Jailed Cheats [ Currencies + More ] - 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/
        • Agree
        • Haha
        • Thanks
        • Like
      • 40 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