CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2004
    Posts
    82

    API Hooking question

    I want to hook some APIs. I has some questions when reading the article on codeguru website
    http://www.codeguru.com/Cpp/W-P/dll...ticle.php/c127/

    The sample in that article is to hook DirectDrawCreate function in DDRAW.dll, and change it with his own function in his own dll. I am just wondering why he set a global WH_CBT hook but with a callback function doing nothing (just do CallNextHookEx).

    When I made some mouse hook or keyborad hook, I always did my work in the callback function, so I am confused that why we changed when do API hooking.

    Thanks in advance!

  2. #2
    Join Date
    Apr 2005
    Location
    Livonia Michigan
    Posts
    142

    Re: API Hooking question

    That link didn't take me anywhere so I'm guessing.

    He probably create a WH_CBT hook to create an instance of his dll in every process. This would be nessisary if you were trying to hook every call to an api
    The Strawdog's out in the street

  3. #3
    Join Date
    Feb 2004
    Posts
    82

    Re: API Hooking question

    Sorry about the link. it is:

    HTML Code:
    <a href=http://www.codeguru.com/Cpp/W-P/dll/hooking/article.php/c127/>api hooking </a>
    I think you are right. So to use WH_CBT hook is just make a chance to create the dll instance for very processes. the hook itself is not essential, and I might use some other types of global hook such as WH_GETMESSAGE hook to do the same job. Am I right? Thank you!
    Last edited by olin; April 25th, 2005 at 08:16 AM.

  4. #4
    Join Date
    Apr 2005
    Location
    Livonia Michigan
    Posts
    142

    Re: API Hooking question

    From the link

    This code is intended to be included in a DLL inserted through a global Windows Hook (CBT hook for example).
    looks like I guessed right
    The Strawdog's out in the street

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