Release 950606
[wine] / include / hook.h
1 /*
2  * Windows hook definitions
3  *
4  * Copyright 1994 Alexandre Julliard
5  */
6
7 #ifndef HOOK_H
8 #define HOOK_H
9
10 #include "windows.h"
11 #include "ldt.h"
12 #include "callback.h"
13
14   /* Hook data (pointed to by a HHOOK) */
15 typedef struct
16 {
17     HHOOK    next;   /* Next hook in chain */
18     HOOKPROC proc;   /* Hook procedure */
19     short    id;     /* Hook id (WH_xxx) */
20     HTASK    htask;  /* Task owning this hook */
21 } HOOKDATA;
22
23
24 #define FIRST_HOOK  WH_MSGFILTER
25 #define LAST_HOOK   WH_SHELL
26
27 #define SYSTEM_HOOK(id)  (systemHooks[(id)-FIRST_HOOK])
28 #define TASK_HOOK(id)    (taskHooks[(id)-FIRST_HOOK])
29 #define INTERNAL_CALL_HOOK(hhook,code,wparam,lparam) \
30     ((hhook) ? CallHookProc(((HOOKDATA*)PTR_SEG_TO_LIN(hhook))->proc,\
31                             code, wparam, lparam) : 0)
32
33 #define CALL_SYSTEM_HOOK(id,code,wparam,lparam) \
34     INTERNAL_CALL_HOOK(SYSTEM_HOOK(id),code,wparam,lparam)
35 #define CALL_TASK_HOOK(id,code,wparam,lparam) \
36     INTERNAL_CALL_HOOK(TASK_HOOK(id),code,wparam,lparam)
37
38 extern HHOOK systemHooks[];
39 extern HHOOK taskHooks[];
40
41 #endif  /* HOOK_H */