Added HANDLE_WM_NOTIFY and FORWARD_WM_NOTIFY.
[wine] / include / callback.h
1 /*
2  * Callback functions
3  *
4  * Copyright 1995 Alexandre Julliard
5  */
6
7 #ifndef __WINE_CALLBACK_H
8 #define __WINE_CALLBACK_H
9
10 #include "windef.h"
11 #include "winnt.h"
12 #include "wingdi.h"
13 #include "wine/winuser16.h"
14
15 extern void SYSDEPS_SwitchToThreadStack( void (*func)(void) ) WINE_NORETURN;
16 extern int SYSDEPS_CallOnLargeStack( int (*func)(void *), void *arg );
17
18 #define CALL_LARGE_STACK( func, arg ) \
19         SYSDEPS_CallOnLargeStack( (int (*)(void *))(func), (void *)(arg) )
20
21 typedef void (*RELAY)();
22 extern FARPROC THUNK_Alloc( FARPROC16 func, RELAY relay );
23 extern void THUNK_Free( FARPROC thunk );
24 extern BOOL THUNK_Init(void);
25 extern void THUNK_InitCallout(void);
26
27
28 typedef struct
29 {
30     BOOL WINAPI     (*PeekMessageA)( LPMSG, HWND, UINT, UINT, UINT );
31     BOOL WINAPI     (*GetMessageA)( MSG*, HWND, UINT, UINT );
32     LRESULT WINAPI  (*SendMessageA)( HWND, UINT, WPARAM, LPARAM );
33     BOOL WINAPI     (*PostMessageA)( HWND, UINT, WPARAM, LPARAM );
34     BOOL16 WINAPI   (*PostAppMessage16)( HTASK16, UINT16, WPARAM16, LPARAM );
35     BOOL WINAPI     (*TranslateMessage)( const MSG *msg );
36     LONG WINAPI     (*DispatchMessageA)( const MSG* msg );
37     BOOL WINAPI     (*RedrawWindow)( HWND, const RECT *, HRGN, UINT );
38     WORD WINAPI     (*UserSignalProc)( UINT, DWORD, DWORD, HMODULE16 );
39     void WINAPI     (*FinalUserInit16)( void );
40     HQUEUE16 WINAPI (*InitThreadInput16)( WORD, WORD );
41     void WINAPI     (*UserYield16)( void );
42     WORD WINAPI     (*DestroyIcon32)( HGLOBAL16, UINT16 );
43     DWORD WINAPI    (*WaitForInputIdle)( HANDLE, DWORD );
44     DWORD WINAPI    (*MsgWaitForMultipleObjects)( DWORD, HANDLE *, BOOL, DWORD, DWORD );
45     HWND WINAPI     (*WindowFromDC)( HDC );
46     INT WINAPI      (*MessageBoxA)( HWND, LPCSTR, LPCSTR, UINT );
47     INT WINAPI      (*MessageBoxW)( HWND, LPCWSTR, LPCWSTR, UINT );
48 }  CALLOUT_TABLE;
49
50 extern CALLOUT_TABLE Callout;
51
52 #include "pshpack1.h"
53
54 typedef struct tagTHUNK
55 {
56     BYTE             popl_eax;           /* 0x58  popl  %eax (return address)*/
57     BYTE             pushl_func;         /* 0x68  pushl $proc */
58     FARPROC16        proc WINE_PACKED;
59     BYTE             pushl_eax;          /* 0x50  pushl %eax */
60     BYTE             jmp;                /* 0xe9  jmp   relay (relative jump)*/
61     RELAY            relay WINE_PACKED;
62     struct tagTHUNK *next WINE_PACKED;
63     DWORD            magic;
64 } THUNK;
65
66 #include "poppack.h"
67
68 #define CALLTO16_THUNK_MAGIC 0x54484e4b   /* "THNK" */
69
70 #define DECL_THUNK(aname,aproc,arelay) \
71     THUNK aname; \
72     aname.popl_eax = 0x58; \
73     aname.pushl_func = 0x68; \
74     aname.proc = (FARPROC) (aproc); \
75     aname.pushl_eax = 0x50; \
76     aname.jmp = 0xe9; \
77     aname.relay = (RELAY)((char *)(arelay) - (char *)(&(aname).next)); \
78     aname.next = NULL; \
79     aname.magic = CALLTO16_THUNK_MAGIC;
80
81 #endif /* __WINE_CALLBACK_H */