hooking n : a golf shot that curves to the left for a right-handed golfer; "he tooks lessons to cure his hooking" [syn: hook, draw]
- present participle of hook
Hooking in programming is a technique employing so called hooks to make a chain of procedures as an event handler. Thus, after the handled event occurs, control flow follows the chain in specific order. The new hook registers its own address as handler for the event and is expected to call the original handler at some point, usually at the end. Each hook is required to pass execution to the previous handler, eventually arriving to the default one, otherwise the chain is broken. Unregistering the hook means setting the original procedure as the event handler.
Hooking can be used for many purposes, including debugging and extending original functionality. It can also be misused to inject (potentially malicious) code to the event handler - for example, rootkits try to make themselves invisible by faking the output of API calls that would otherwise reveal their existence.
A special form of hooking employs intercepting the library functions calls made by a process. Function hooking is implemented by changing the very first few code instructions of the target function to jump to an injected code. Alternatively on systems using the Shared library concept , the Interrupt Vector Table or the Import Descriptor Table can be modified in memory
ExamplesHooking is an extremely complex process on most systems, and the programs trying to hook usually have to be run with administrator privileges. There are very few practical applications using hooks whose source is open: However there is one library once provided by Microsoft in a sample, which can be used to hook function calls into Dynamic-link library files: The original sample is hard to acquire, but key files are still available on some SVN repositories, for example on Sourceforge: Link on the SVN repository by SF.net The sample is commented and should explain itself. Another example can be found in the source code of the Psotnic IRC bot.
hooking in Arabic: خطف
hooking in German: Hook (EDV)
hooking in French: Hook (informatique)
hooking in Japanese: フック (プログラミング)