Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Directly Hooking a Function

Directly Hooking a Function

Scheduled Pinned Locked Moved C / C++ / MFC
help
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • X Offline
    X Offline
    Xen3h
    wrote on last edited by
    #1

    Say I know the address of a function (does this help), I want it to call my copy of the function, and then the original function. I want to do it without making a wrapper, and without hooking GetProcAddress because I can already do it that way, but i'd like a much more direct way possibly involving inline asm etc. Any help + ideas is appreciated. :)

    R 1 Reply Last reply
    0
    • X Xen3h

      Say I know the address of a function (does this help), I want it to call my copy of the function, and then the original function. I want to do it without making a wrapper, and without hooking GetProcAddress because I can already do it that way, but i'd like a much more direct way possibly involving inline asm etc. Any help + ideas is appreciated. :)

      R Offline
      R Offline
      Robert Kuster
      wrote on last edited by
      #2

      > I want to do it without making a wrapper, and without hooking GetProcAddress ... You have to modify the entry point of the original function so that it first executes a JMP instruction to your implementation. Check this link: http://www.fengyuan.com/article/wmprint.html[^] There you will find a nice user32!BeginPaint hook implementation. However, because most user32 and kernel32 functions call an appropriate function in ntdll.dll, rather than executing the 0x2E interrupt directly (like BeginPaint does), your implementation will probably differ somewhat too; it will always depend on how the entry point of the original function looks like. More useful links: 1. Intel OpCodes[^] 2. Api Hooking Revealed[^] 3. API Spying Techniques for Windows 9x, NT and 2000 [^] Regards, RK

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups