CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: Detours?

  1. #1
    Join Date
    Jun 2009
    Posts
    118

    Detours?

    I want to know what the difference of this detour would be

    Code:
    DWORD WINAPI MYFUNCTION (int num1, file *filename, DWORD size)
    {
           originalMYFUNCTION(num1, filename, size);
           num1 = NULL;
           filename = NULL;
           size = NULL;
           return NULL;
    }
    
    DWORD WINAPI MYFUNCTION (int num1, file *filename, DWORD size)
    {
           return NULL;
    }
    Basically I want the function to return NULL and return null pointers and any values passed back to the main program as NULL. Which of these detoured functions is accomplishing that?

  2. #2
    Join Date
    Feb 2005
    Posts
    2,160

    Re: Detours?

    Parameters are not "passed back to the main program" unless they are passed by reference. All the assignment you are doing in the first function is done on copies of those parameters passed to the function.

  3. #3
    Join Date
    Jun 2009
    Posts
    118

    Re: Detours?

    Quote Originally Posted by hoxsiew View Post
    Parameters are not "passed back to the main program" unless they are passed by reference. All the assignment you are doing in the first function is done on copies of those parameters passed to the function.
    But say its pass by reference, in the first function would they receive NULL, or would they receive whatever is passed back from the orig function

  4. #4
    Join Date
    Jan 2007
    Posts
    90

    Re: Detours?

    hello

    essetially you have over written the values what the Oginal function has returned. so you will receives NULL only.

    regards
    deepak

  5. #5
    Join Date
    Jun 2009
    Posts
    118

    Re: Detours?

    thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured