Jump to content
View in the app

A better way to browse. Learn more.

Tuts 4 You

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Hook/Call the same function?

Featured Replies

Posted

So I have a C++ dll injected into a process and I want to hook/call the same function. Problem is that if I have the hook call the function then it can turn into some nasty recursion.

What is the best way to Hook/Call the same function?

Some thoughts

-Could call the hook's trampoline instead which will cause it to skip over the hook. (Will only work if hooking the start of a function)

-Could set a flag that will skip the hook. Not sure how I would do that without it being a giant mess though.

So I have a C++ dll injected into a process and I want to hook/call the same function. Problem is that if I have the hook call the function then it can turn into some nasty recursion.

What is the best way to Hook/Call the same function?

Some thoughts

-Could call the hook's trampoline instead which will cause it to skip over the hook. (Will only work if hooking the start of a function)

-Could set a flag that will skip the hook. Not sure how I would do that without it being a giant mess though.

Your first thought would probably be the cleanest method to use if you are hooking the start of the function as you said.

Adding a flag could get messy depending on how you plan to implement it.

  • Author

Okay well I did some thinking. Maybe I could make a SafeCalling class which would store the threadid and patch addrs in a static vector which would have static accessors for ASM use and when it is finished calling it would remove the threadid and patch addrs.

Then I would build into the codecaves my hook class uses to read that vector making sure it isnt blocking.

Create an account or sign in to comment

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.