CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Dec 1999
    Location
    Cincinnati, Ohio
    Posts
    195

    Question malloc, another implementation of

    Folks,

    I am using Microsoft's Detour Code.

    If you are not familary with this code, it allow a DLL to hook into a process and detour any API calls. The idea is that you do as you please with the API call and then pass it onto the API and finally return to the caller.

    All is well and good, but one must be careful in how one writes the detoured code. The biggest problem is making sure that the one does not detour the detouring code. The solution is to be very careful in the 3rd party code that is used, INCLUDING THE c runtime, like malloc! Malloc eventually calls the WinAPI function HeapAlloc().

    I need to find an implementation of malloc that will allow me to modify it to call the real API funtions, not the detoured ones. Does anyone know where I can find such an open source code?

    Sam

  2. #2
    Join Date
    Sep 2002
    Location
    Maryland - Fear The Turtle!
    Posts
    7,537

    Re: malloc, another implementation of

    Originally posted by scarleton
    Folks,

    I am using Microsoft's Detour Code.

    If you are not familary with this code, it allow a DLL to hook into a process and detour any API calls. The idea is that you do as you please with the API call and then pass it onto the API and finally return to the caller.

    All is well and good, but one must be careful in how one writes the detoured code. The biggest problem is making sure that the one does not detour the detouring code. The solution is to be very careful in the 3rd party code that is used, INCLUDING THE c runtime, like malloc! Malloc eventually calls the WinAPI function HeapAlloc().

    I need to find an implementation of malloc that will allow me to modify it to call the real API funtions, not the detoured ones. Does anyone know where I can find such an open source code?

    Sam
    Can you provide an example on what exactly is the problem? if your look at the samples in the src there is already a hook for the malloc, and I do believe it calls the real malloc for the hook...so what is the issue? Most of us have used detours just as a passing fancy, since you cannot use it commercially...and we use other interception techniques...mostly kernel hooks since usermode is so..80's...to do what we need. You statement does not really make senes to me, but then I've never really look at detours other than as a party favor....

  3. #3
    Join Date
    Dec 1999
    Location
    Cincinnati, Ohio
    Posts
    195
    Why can you not use it commercially?

  4. #4
    Join Date
    Sep 2002
    Location
    Maryland - Fear The Turtle!
    Posts
    7,537
    Originally posted by scarleton
    Why can you not use it commercially?
    try reading the license agreements...or maybe I should try again...but I do recall (and we are talking a long time ago here) that it states that you cannot use it for commercial products....

  5. #5
    Join Date
    Dec 1999
    Location
    Cincinnati, Ohio
    Posts
    195

    Re: Re: malloc, another implementation of

    Originally posted by Mick ...and we use other interception techniques...mostly kernel hooks since usermode is so..80's...to do what we need.
    Ok, I read the license agreements Can you enlighten me as to where I can learn about these other interception techniques?

  6. #6
    Join Date
    Sep 2002
    Location
    Maryland - Fear The Turtle!
    Posts
    7,537
    well I guess it starts with the question what is it that you seek to do? specifically???

    technically speaking, you can modify the detours code and use it as your own...or is that legally speaking?

  7. #7
    Join Date
    Dec 1999
    Location
    Cincinnati, Ohio
    Posts
    195
    There are a number of things I want to do. But one thing is make a tool that will record and play back user's interaction with an application.

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