4 * Copyright 1995 Alexandre Julliard
7 #ifndef __WINE_CALLBACK_H
8 #define __WINE_CALLBACK_H
13 #include "wine/winuser16.h"
15 extern int (*IF1632_CallLargeStack
)( int (*func
)(void), void *arg
);
17 #define CALL_LARGE_STACK(func,arg) \
18 (IF1632_CallLargeStack ? \
19 IF1632_CallLargeStack( (int(*)())(func), (void *)(arg) ) : \
20 ((int(*)())(func))((void *)arg))
22 typedef void (*RELAY
)();
23 extern FARPROC
THUNK_Alloc( FARPROC16 func
, RELAY relay
);
24 extern void THUNK_Free( FARPROC thunk
);
25 extern BOOL
THUNK_Init(void);
26 extern void THUNK_InitCallout(void);
28 extern void CALL32_Init( void *func
, void *target
, void *stack
) WINE_NORETURN
;
32 LONG (CALLBACK
*CallRegisterShortProc
)( CONTEXT86
*, INT
);
33 LONG (CALLBACK
*CallRegisterLongProc
)( CONTEXT86
*, INT
);
34 INT16 (CALLBACK
*CallWindowsExitProc
)( FARPROC16
, INT16
);
35 INT16 (CALLBACK
*CallWordBreakProc
)( EDITWORDBREAKPROC16
, SEGPTR
, INT16
,
37 VOID (CALLBACK
*CallBootAppProc
)( FARPROC16
, HANDLE16
, HFILE16
);
38 WORD (CALLBACK
*CallLoadAppSegProc
)( FARPROC16
, HANDLE16
, HFILE16
, WORD
);
39 WORD (CALLBACK
*CallLocalNotifyFunc
)( FARPROC16
, WORD
, HLOCAL16
, WORD
);
40 HGLOBAL16 (CALLBACK
*CallResourceHandlerProc
)( FARPROC16
, HGLOBAL16
, HMODULE16
, HRSRC16
);
41 DWORD (CALLBACK
*CallUTProc
)( FARPROC16
, DWORD
, DWORD
);
42 LRESULT (CALLBACK
*CallASPIPostProc
)( FARPROC16
, SEGPTR
);
45 extern const CALLBACKS_TABLE
*Callbacks
;
49 BOOL16
WINAPI (*PeekMessage16
)( LPMSG16 msg
, HWND16 hwnd
,
50 UINT16 first
, UINT16 last
, UINT16 flags
);
51 BOOL
WINAPI (*PeekMessageA
)( LPMSG lpmsg
, HWND hwnd
,
52 UINT min
, UINT max
, UINT wRemoveMsg
);
53 BOOL
WINAPI (*PeekMessageW
)( LPMSG lpmsg
, HWND hwnd
,
54 UINT min
, UINT max
, UINT wRemoveMsg
);
56 BOOL16
WINAPI (*GetMessage16
)( SEGPTR msg
, HWND16 hwnd
,
57 UINT16 first
, UINT16 last
);
58 BOOL
WINAPI (*GetMessageA
)( MSG
* lpmsg
, HWND hwnd
,
60 BOOL
WINAPI (*GetMessageW
)( MSG
* lpmsg
, HWND hwnd
,
63 LRESULT
WINAPI (*SendMessage16
)( HWND16 hwnd
, UINT16 msg
,
64 WPARAM16 wParam
, LPARAM lParam
);
65 LRESULT
WINAPI (*SendMessageA
)( HWND hwnd
, UINT msg
,
66 WPARAM wParam
, LPARAM lParam
);
67 LRESULT
WINAPI (*SendMessageW
)( HWND hwnd
, UINT msg
,
68 WPARAM wParam
, LPARAM lParam
);
70 BOOL16
WINAPI (*PostMessage16
)( HWND16 hwnd
, UINT16 message
,
71 WPARAM16 wParam
, LPARAM lParam
);
72 BOOL
WINAPI (*PostMessageA
)( HWND hwnd
, UINT message
,
73 WPARAM wParam
, LPARAM lParam
);
74 BOOL
WINAPI (*PostMessageW
)( HWND hwnd
, UINT message
,
75 WPARAM wParam
, LPARAM lParam
);
77 BOOL16
WINAPI (*PostAppMessage16
)( HTASK16 hTask
, UINT16 message
,
78 WPARAM16 wParam
, LPARAM lParam
);
79 BOOL
WINAPI (*PostThreadMessageA
)( DWORD idThread
, UINT message
,
80 WPARAM wParam
, LPARAM lParam
);
81 BOOL
WINAPI (*PostThreadMessageW
)( DWORD idThread
, UINT message
,
82 WPARAM wParam
, LPARAM lParam
);
84 BOOL16
WINAPI (*TranslateMessage16
)( const MSG16
*msg
);
85 BOOL
WINAPI (*TranslateMessage
)( const MSG
*msg
);
87 LONG
WINAPI (*DispatchMessage16
)( const MSG16
* msg
);
88 LONG
WINAPI (*DispatchMessageA
)( const MSG
* msg
);
89 LONG
WINAPI (*DispatchMessageW
)( const MSG
* msg
);
91 BOOL16
WINAPI (*RedrawWindow16
)( HWND16 hwnd
, const RECT16
*rectUpdate
,
92 HRGN16 hrgnUpdate
, UINT16 flags
);
94 BOOL
WINAPI (*RedrawWindow
)( HWND hwnd
, const RECT
*rectUpdate
,
95 HRGN hrgnUpdate
, UINT flags
);
97 WORD
WINAPI (*UserSignalProc
)( UINT uCode
, DWORD dwThreadOrProcessID
,
98 DWORD dwFlags
, HMODULE16 hModule
);
99 void WINAPI (*FinalUserInit16
)( void );
101 INT16
WINAPI (*InitApp16
)( HINSTANCE16 hInst
);
102 HQUEUE16
WINAPI (*InitThreadInput16
)( WORD unknown
, WORD flags
);
103 void WINAPI (*UserYield16
)( void );
104 WORD
WINAPI (*DestroyIcon32
)( HGLOBAL16 handle
, UINT16 flags
);
105 DWORD
WINAPI (*WaitForInputIdle
)( HANDLE hProcess
, DWORD dwTimeOut
);
107 INT
WINAPI (*MessageBoxA
)( HWND hWnd
, LPCSTR text
, LPCSTR title
, UINT type
);
108 INT
WINAPI (*MessageBoxW
)( HWND hwnd
, LPCWSTR text
, LPCWSTR title
, UINT type
);
112 extern CALLOUT_TABLE Callout
;
114 #include "pshpack1.h"
116 typedef struct tagTHUNK
118 BYTE popl_eax
; /* 0x58 popl %eax (return address)*/
119 BYTE pushl_func
; /* 0x68 pushl $proc */
120 FARPROC16 proc WINE_PACKED
;
121 BYTE pushl_eax
; /* 0x50 pushl %eax */
122 BYTE jmp
; /* 0xe9 jmp relay (relative jump)*/
123 RELAY relay WINE_PACKED
;
124 struct tagTHUNK
*next WINE_PACKED
;
130 #define CALLTO16_THUNK_MAGIC 0x54484e4b /* "THNK" */
132 #define DECL_THUNK(aname,aproc,arelay) \
134 aname.popl_eax = 0x58; \
135 aname.pushl_func = 0x68; \
136 aname.proc = (FARPROC) (aproc); \
137 aname.pushl_eax = 0x50; \
139 aname.relay = (RELAY)((char *)(arelay) - (char *)(&(aname).next)); \
141 aname.magic = CALLTO16_THUNK_MAGIC;
143 #endif /* __WINE_CALLBACK_H */