Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 652481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:16:37+00:00 2026-05-13T22:16:37+00:00

This is just a simple question. I’ve been reading the source of something which

  • 0

This is just a simple question. I’ve been reading the source of something which attaches to a memory address of a subroutine using DetourAttach(&(PVOID &)BindKeyT, BindKeyD); where BindKeyT is the address to a subroutine in memory. I’m curious, what exactly does (&(PVOID &) mean in english? I understand that PVOID is a void pointer, but how does this get translated into a function which can be used to attach a detour to?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T22:16:38+00:00Added an answer on May 13, 2026 at 10:16 pm

    Terry Mahaffey is right, what you are passing is a pointer to a pointer to the function. This is commonly used whenever the function you are passing the pointer to (in this case, DetourAttach) wants to return more than one value, and one of those returned values is a pointer. Since functions in C/C++ can only return a single value, the only way to obtain multiple values from them is via pointers.

    A simple example would be when one wishes to return a pointer to a block of allocated memory. Then one can write a function like:

    int allocstr(int len, char **retptr)
     {
      char *p = malloc(len + 1); /* +1 for \0 */
      if(p == NULL)
       return 0;
      *retptr = p;
      return 1;
     }
    

    To answer your other question, of how to setup a memory address to be used as a function, one can do it like so:

    void* (void * BindKeyT)(const char* key) = actual_BindKeyT;
    
    // actual_BindKeyT is a pointer to a function that will be defined elsewhere, 
    // and whose declaration you will include in your project through a header file
    // or a dll import
    
    void * BindKeyD(const char* key)
    {
        // Code for your hook function
    }
    
    DetourAttach(&(PVOID&)BindKeyT, BindKeyD);
    

    (taken from http://zenersblog.blogspot.com/2008/04/api-hooking-with-detours-part-1.html)

    Bear in mind that the declarations for BindKeyT and BindKeyD should match.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is just a simple question. I'm currently using Mozilla's Rhino to develop a
Is it a simple case of just never using the this.XYZ construct?
This is just a simple question: how do I exclude a piece of html
This is hopefully just a simple question involving performance optimizations when it comes to
This is probably a simple question, and i'm just being dense. I've looked through
[see later answer for more] I think this is just a simple rails question,
just simple question, recently i have setup a web server to build project using
This is a really really simple question to which I seem to be entirely
This is just a simple question, and I can't find the answer in the
I know this is a really simple question, but I was just wondering if

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.