Hook Lists

A hook list contains the addresses of the functions that the system calls while processing a hook. An application can take advantage of a particular type of hook by defining a hook function and using WinSetHook to enter the address of the function in the corresponding hook list. To specify the hook type in WinSetHook, the application uses one of the following constants:

┌────────────────────┬────────────────────────────────────────┐
│Constant Name       │Description                             │
├────────────────────┼────────────────────────────────────────┤
│HK_CHECKMSGFILTER   │Lets applications apply very specific   │
│                    │message filtering. See HK_CHECKMSGFILTER│
│                    │- Check Message Filter Hook.            │
├────────────────────┼────────────────────────────────────────┤
│HK_CODEPAGECHANGED  │Lets applications determine when the    │
│                    │code page changes. See HK_CODEPAGECHANGE│
│                    │- Code Page Changed Hook.               │
├────────────────────┼────────────────────────────────────────┤
│HK_DESTROYWINDOW    │Called whenever a window is destroyed.  │
│                    │See HK_DESTROYWINDOW - Destroy Window   │
│                    │Hook.                                   │
├────────────────────┼────────────────────────────────────────┤
│HK_FINDWORD         │Lets applications control where         │
│                    │WinDrawText places line breaks. See     │
│                    │HK_FINDWORD - Find Word Hook.           │
├────────────────────┼────────────────────────────────────────┤
│HK_FLUSHBUF         │Lets applications save data before the  │
│                    │system reboots. See HK_FLUSHBUF - Flush │
│                    │Buffer Hook.                            │
├────────────────────┼────────────────────────────────────────┤
│HK_HELP             │Monitors the WM_HELP message. See       │
│                    │HK_HELP - Help Hook.                    │
├────────────────────┼────────────────────────────────────────┤
│HK_INPUT            │Monitors messages in the specified      │
│                    │message queue. See HK_INPUT - Input Hook│
│                    │.                                       │
├────────────────────┼────────────────────────────────────────┤
│HK_JOURNALPLAYBACK  │Lets applications insert messages into  │
│                    │the system message queue. See           │
│                    │HK_JOURNALPLAYBACK - Journal Playback   │
│                    │Hook.                                   │
├────────────────────┼────────────────────────────────────────┤
│HK_JOURNALRECORD    │Lets applications record mouse and      │
│                    │keyboard input messages. See            │
│                    │HK_JOURNALRECORD - Journal Record Hook. │
├────────────────────┼────────────────────────────────────────┤
│HK_LOADER           │Lets the library and procedure loading  │
│                    │and deleting calls be intercepted. See  │
│                    │HK_LOADER - Loader Hook.                │
├────────────────────┼────────────────────────────────────────┤
│HK_LOCKUP           │Called when the system locks itself up. │
│                    │See HK_LOCKUP - Lockup Hook.            │
├────────────────────┼────────────────────────────────────────┤
│HK_MSGCONTROL       │Monitors the flow of messages to be     │
│                    │intercepted. See HK_MSGCONTROL - Message│
│                    │Control Hook.                           │
├────────────────────┼────────────────────────────────────────┤
│HK_MSGFILTER        │Monitors input events during system     │
│                    │modal loops. See HK_MSGFILTER - Message │
│                    │Filter Hook.                            │
├────────────────────┼────────────────────────────────────────┤
│HK_MSGINPUT         │Lets applications simulate user input,  │
│                    │and only mouse and keyboard messages    │
│                    │should be passed in. All other messages │
│                    │will be discarded. Mouse and keyboard   │
│                    │messages injected into this hook will   │
│                    │have the same effect as if they were    │
│                    │generated by the mouse or keyboard      │
│                    │device driver. The messages are routed  │
│                    │in the same manner as normal user input.│
│                    │See HK_MSGINPUT - Message Input Hook.   │
├────────────────────┼────────────────────────────────────────┤
│HK_PLIST_ENTRY      │Called every time a program-list call or│
│                    │initialization file call is invoked by  │
│                    │an application. It is called before the │
│                    │call is run. See HK_PLIST_ENTRY -       │
│                    │Program List Call Hook.                 │
├────────────────────┼────────────────────────────────────────┤
│HK_PLIST_EXIT       │Called every time a program-list call or│
│                    │initialization file call is invoked by  │
│                    │an application.  It is called before the│
│                    │call is run. See HK_PLIST_EXIT - Program│
│                    │List Exit Hook.                         │
├────────────────────┼────────────────────────────────────────┤
│HK_REGISTERUSERMSG  │Called whenever a user message or data  │
│                    │type is registered. See                 │
│                    │HK_REGISTERUSERMSG - Register User      │
│                    │Message Hook.                           │
├────────────────────┼────────────────────────────────────────┤
│HK_SENDMSG          │Monitors messages sent by using         │
│                    │WinSendMsg. See HK_SENDMSG - Send       │
│                    │Message Hook.                           │
├────────────────────┼────────────────────────────────────────┤
│HK_WINDOWDC         │Called when a device context is         │
│                    │allocated or freed. See HK_WINDOWDC -   │
│                    │Device Context Hook.                    │
└────────────────────┴────────────────────────────────────────┘

While running a function that contains a hook, the system checks for any function addresses in the hook list that correspond to the type of hook. If an address is found, the system tries to locate and run the function.


[Back: About Hooks]
[Next: Hook Chains]