Hooking Win32 API calls
Posted on 2009-02-21
Simple question: I would like to learn how to hook a given Win32 call, so I can either deny the call, or replace the call with something else. I don't want to do this for malicious purposes, I need this for my own application only.
For example, I want to hook the calls into ::MessageBox, for example. This is so I can set up a another windows hook to watch for the window creation, then change, say, the text on the dialog, or the background colour of the dialog. This is to prevent the need for a whole new class of dialog to be created, then replace every call to ::MessageBox with this new dialog, but also to catch message boxes displayed via MFC internally, eg those displayed during Serialization Fail ("Failed to load document").
(I asked a question similar to this a while ago, and was pointed at the Windows Theme API. But I don't want to use that for many reasons that are not relevant here :) )
PS Any book titles that discuss this topic will also be welcomed.